Citeproc.CslJson

citeproc-0.9.0.1: Generates citations and bibliography from CSL styles.

Safe Haskell | None
Language | Haskell2010

Citeproc.CslJson

Description

CSL JSON is the structured text format defined in https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html. It is used to represent formatted text inside CSL JSON bibliographies. For the most part it is a subset of HTML, with some special features like smart quote parsing. This module defines a parser and a renderer for this format, as well as `CiteprocOutput` and other typeclass instances.

Synopsis

- data CslJson a
  - = CslText a
  - | CslEmpty
  - | CslConcat (CslJson a) (CslJson a)
  - | CslQuoted (CslJson a)
  - | CslItalic (CslJson a)
  - | CslNormal (CslJson a)
  - | CslBold (CslJson a)
  - | CslUnderline (CslJson a)
  - | CslNoDecoration (CslJson a)
  - | CslSmallCaps (CslJson a)
  - | CslBaseline (CslJson a)
  - | CslSup (CslJson a)
  - | CslSub (CslJson a)
  - | CslNoCase (CslJson a)
  - | CslDiv Text (CslJson a)
  - | CslLink Text (CslJson a)
- cslJsonToJson :: CslJson Text -> [Value]
- renderCslJson :: Bool -> Locale -> CslJson Text -> Text
- parseCslJson :: Locale -> Text -> CslJson Text

# Documentation

data CslJson a #

Constructors

CslText a |
CslEmpty |
CslConcat (CslJson a) (CslJson a) |
CslQuoted (CslJson a) |
CslItalic (CslJson a) |
CslNormal (CslJson a) |
CslBold (CslJson a) |
CslUnderline (CslJson a) |
CslNoDecoration (CslJson a) |
CslSmallCaps (CslJson a) |
CslBaseline (CslJson a) |
CslSup (CslJson a) |
CslSub (CslJson a) |
CslNoCase (CslJson a) |
CslDiv Text (CslJson a) |
CslLink Text (CslJson a) |

#### Instances

Instances details

Functor CslJson # |
Instance details Defined in Citeproc.CslJson Methods fmap :: (a -> b) -> CslJson a -> CslJson b # (<$) :: a -> CslJson b -> CslJson a #
Foldable CslJson # |
Instance details Defined in Citeproc.CslJson Methods fold :: Monoid m => CslJson m -> m # foldMap :: Monoid m => (a -> m) -> CslJson a -> m # foldMap' :: Monoid m => (a -> m) -> CslJson a -> m # foldr :: (a -> b -> b) -> b -> CslJson a -> b # foldr' :: (a -> b -> b) -> b -> CslJson a -> b # foldl :: (b -> a -> b) -> b -> CslJson a -> b # foldl' :: (b -> a -> b) -> b -> CslJson a -> b # foldr1 :: (a -> a -> a) -> CslJson a -> a # foldl1 :: (a -> a -> a) -> CslJson a -> a # toList :: CslJson a -> [a] # null :: CslJson a -> Bool # length :: CslJson a -> Int # elem :: Eq a => a -> CslJson a -> Bool # maximum :: Ord a => CslJson a -> a # minimum :: Ord a => CslJson a -> a # sum :: Num a => CslJson a -> a # product :: Num a => CslJson a -> a #
Traversable CslJson # |
Instance details Defined in Citeproc.CslJson Methods traverse :: Applicative f => (a -> f b) -> CslJson a -> f (CslJson b) # sequenceA :: Applicative f => CslJson (f a) -> f (CslJson a) # mapM :: Monad m => (a -> m b) -> CslJson a -> m (CslJson b) # sequence :: Monad m => CslJson (m a) -> m (CslJson a) #
FromJSON (CslJson Text) # |
Instance details Defined in Citeproc.CslJson Methods parseJSON :: Value -> Parser (CslJson Text) # parseJSONList :: Value -> Parser [CslJson Text] # omittedField :: Maybe (CslJson Text) #
ToJSON (CslJson Text) # |
Instance details Defined in Citeproc.CslJson Methods toJSON :: CslJson Text -> Value # toEncoding :: CslJson Text -> Encoding # toJSONList :: [CslJson Text] -> Value # toEncodingList :: [CslJson Text] -> Encoding # omitField :: CslJson Text -> Bool #
CiteprocOutput (CslJson Text) # |
Instance details Defined in Citeproc.CslJson Methods toText :: CslJson Text -> Text # fromText :: Text -> CslJson Text # dropTextWhile :: (Char -> Bool) -> CslJson Text -> CslJson Text # dropTextWhileEnd :: (Char -> Bool) -> CslJson Text -> CslJson Text # addFontVariant :: FontVariant -> CslJson Text -> CslJson Text # addFontStyle :: FontStyle -> CslJson Text -> CslJson Text # addFontWeight :: FontWeight -> CslJson Text -> CslJson Text # addTextDecoration :: TextDecoration -> CslJson Text -> CslJson Text # addVerticalAlign :: VerticalAlign -> CslJson Text -> CslJson Text # addTextCase :: Maybe Lang -> TextCase -> CslJson Text -> CslJson Text # addDisplay :: DisplayStyle -> CslJson Text -> CslJson Text # addQuotes :: CslJson Text -> CslJson Text # movePunctuationInsideQuotes :: CslJson Text -> CslJson Text # inNote :: CslJson Text -> CslJson Text # mapText :: (Text -> Text) -> CslJson Text -> CslJson Text # addHyperlink :: Text -> CslJson Text -> CslJson Text # localizeQuotes :: Locale -> CslJson Text -> CslJson Text #
Monoid (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods mempty :: CslJson a # mappend :: CslJson a -> CslJson a -> CslJson a # mconcat :: [CslJson a] -> CslJson a #
Semigroup (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods (<>) :: CslJson a -> CslJson a -> CslJson a # sconcat :: NonEmpty (CslJson a) -> CslJson a # stimes :: Integral b => b -> CslJson a -> CslJson a #
Show a => Show (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods showsPrec :: Int -> CslJson a -> ShowS # show :: CslJson a -> String # showList :: [CslJson a] -> ShowS #
Eq a => Eq (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods (==) :: CslJson a -> CslJson a -> Bool # (/=) :: CslJson a -> CslJson a -> Bool #
Ord a => Ord (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods compare :: CslJson a -> CslJson a -> Ordering # (<) :: CslJson a -> CslJson a -> Bool # (<=) :: CslJson a -> CslJson a -> Bool # (>) :: CslJson a -> CslJson a -> Bool # (>=) :: CslJson a -> CslJson a -> Bool # max :: CslJson a -> CslJson a -> CslJson a # min :: CslJson a -> CslJson a -> CslJson a #
Uniplate (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods uniplate :: CslJson a -> (Str (CslJson a), Str (CslJson a) -> CslJson a) # descend :: (CslJson a -> CslJson a) -> CslJson a -> CslJson a # descendM :: Applicative m => (CslJson a -> m (CslJson a)) -> CslJson a -> m (CslJson a) #
Biplate (CslJson a) (CslJson a) # |
Instance details Defined in Citeproc.CslJson Methods biplate :: CslJson a -> (Str (CslJson a), Str (CslJson a) -> CslJson a) # descendBi :: (CslJson a -> CslJson a) -> CslJson a -> CslJson a # descendBiM :: Applicative m => (CslJson a -> m (CslJson a)) -> CslJson a -> m (CslJson a) #

cslJsonToJson :: CslJson Text -> [Value] #

renderCslJson #

Arguments

:: Bool | Escape & using entities
-> Locale | Locale (used for quote styles)
-> CslJson Text | CslJson to render
-> Text |

Render `CslJson` as `Text`. Set the first parameter to True when rendering HTML output (so that entities are escaped). Set it to False when rendering for CSL JSON bibliographies.

parseCslJson :: Locale -> Text -> CslJson Text #