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

Safe Haskell | Safe-Inferred
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 Source #

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

Foldable CslJson Source # |

Instance details

Defined in Citeproc.CslJson

Methods

fold :: Monoid m => CslJson m -> m Source #

foldMap :: Monoid m => (a -> m) -> CslJson a -> m Source #

foldMap' :: Monoid m => (a -> m) -> CslJson a -> m Source #

foldr :: (a -> b -> b) -> b -> CslJson a -> b Source #

foldr' :: (a -> b -> b) -> b -> CslJson a -> b Source #

foldl :: (b -> a -> b) -> b -> CslJson a -> b Source #

foldl' :: (b -> a -> b) -> b -> CslJson a -> b Source #

foldr1 :: (a -> a -> a) -> CslJson a -> a Source #

foldl1 :: (a -> a -> a) -> CslJson a -> a Source #

toList :: CslJson a -> [a] Source #

null :: CslJson a -> Bool Source #

length :: CslJson a -> Int Source #

elem :: Eq a => a -> CslJson a -> Bool Source #

maximum :: Ord a => CslJson a -> a Source #

minimum :: Ord a => CslJson a -> a Source #

sum :: Num a => CslJson a -> a Source #

product :: Num a => CslJson a -> a Source #

Traversable CslJson Source # |
Instance details Defined in Citeproc.CslJson Methods traverse :: Applicative f => (a -> f b) -> CslJson a -> f (CslJson b) Source # sequenceA :: Applicative f => CslJson (f a) -> f (CslJson a) Source # mapM :: Monad m => (a -> m b) -> CslJson a -> m (CslJson b) Source # sequence :: Monad m => CslJson (m a) -> m (CslJson a) Source #
Functor CslJson Source # |
Instance details Defined in Citeproc.CslJson Methods fmap :: (a -> b) -> CslJson a -> CslJson b Source # (<$) :: a -> CslJson b -> CslJson a Source #
FromJSON (CslJson Text) Source # |
Instance details Defined in Citeproc.CslJson Methods parseJSON :: Value -> Parser (CslJson Text) Source # parseJSONList :: Value -> Parser [CslJson Text] Source #
ToJSON (CslJson Text) Source # |
Instance details Defined in Citeproc.CslJson Methods toJSON :: CslJson Text -> Value Source # toEncoding :: CslJson Text -> Encoding Source # toJSONList :: [CslJson Text] -> Value Source # toEncodingList :: [CslJson Text] -> Encoding Source #
Monoid (CslJson a) Source # |
Instance details Defined in Citeproc.CslJson Methods mempty :: CslJson a Source # mappend :: CslJson a -> CslJson a -> CslJson a Source # mconcat :: [CslJson a] -> CslJson a Source #
Semigroup (CslJson a) Source # |
Instance details Defined in Citeproc.CslJson Methods (<>) :: CslJson a -> CslJson a -> CslJson a Source # sconcat :: NonEmpty (CslJson a) -> CslJson a Source # stimes :: Integral b => b -> CslJson a -> CslJson a Source #
Show a => Show (CslJson a) Source # |
Instance details Defined in Citeproc.CslJson Methods showsPrec :: Int -> CslJson a -> ShowS Source # show :: CslJson a -> String Source # showList :: [CslJson a] -> ShowS Source #
CiteprocOutput (CslJson Text) Source # |

Instance details

Defined in Citeproc.CslJson

Methods

toText :: CslJson Text -> Text Source #

fromText :: Text -> CslJson Text Source #

dropTextWhile :: (Char -> Bool) -> CslJson Text -> CslJson Text Source #

dropTextWhileEnd :: (Char -> Bool) -> CslJson Text -> CslJson Text Source #

addFontVariant :: FontVariant -> CslJson Text -> CslJson Text Source #

addFontStyle :: FontStyle -> CslJson Text -> CslJson Text Source #

addFontWeight :: FontWeight -> CslJson Text -> CslJson Text Source #

addTextDecoration :: TextDecoration -> CslJson Text -> CslJson Text Source #

addVerticalAlign :: VerticalAlign -> CslJson Text -> CslJson Text Source #

addTextCase :: Maybe Lang -> TextCase -> CslJson Text -> CslJson Text Source #

addDisplay :: DisplayStyle -> CslJson Text -> CslJson Text Source #

addQuotes :: CslJson Text -> CslJson Text Source #

movePunctuationInsideQuotes :: CslJson Text -> CslJson Text Source #

inNote :: CslJson Text -> CslJson Text Source #

mapText :: (Text -> Text) -> CslJson Text -> CslJson Text Source #

addHyperlink :: Text -> CslJson Text -> CslJson Text Source #

localizeQuotes :: Locale -> CslJson Text -> CslJson Text Source #

Eq a => Eq (CslJson a) Source # |
Instance details Defined in Citeproc.CslJson Methods (==) :: CslJson a -> CslJson a -> Bool Source # (/=) :: CslJson a -> CslJson a -> Bool Source #
Ord a => Ord (CslJson a) Source # |

Instance details

Defined in Citeproc.CslJson

Methods

compare :: CslJson a -> CslJson a -> Ordering Source #

(<) :: CslJson a -> CslJson a -> Bool Source #

(<=) :: CslJson a -> CslJson a -> Bool Source #

(>) :: CslJson a -> CslJson a -> Bool Source #

(>=) :: CslJson a -> CslJson a -> Bool Source #

max :: CslJson a -> CslJson a -> CslJson a Source #

min :: CslJson a -> CslJson a -> CslJson a Source #

Uniplate (CslJson a) Source # |
Instance details Defined in Citeproc.CslJson Methods uniplate :: CslJson a -> (Str (CslJson a), Str (CslJson a) -> CslJson a) Source # descend :: (CslJson a -> CslJson a) -> CslJson a -> CslJson a Source # descendM :: Applicative m => (CslJson a -> m (CslJson a)) -> CslJson a -> m (CslJson a) Source #
Biplate (CslJson a) (CslJson a) Source # |
Instance details Defined in Citeproc.CslJson Methods biplate :: CslJson a -> (Str (CslJson a), Str (CslJson a) -> CslJson a) Source # descendBi :: (CslJson a -> CslJson a) -> CslJson a -> CslJson a Source # descendBiM :: Applicative m => (CslJson a -> m (CslJson a)) -> CslJson a -> m (CslJson a) Source #

cslJsonToJson :: CslJson Text -> [Value] Source #

renderCslJson Source #

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 Source #