Text.CSL.Style

pandoc-citeproc-0.9.1.1: Supports using pandoc with citeproc

Copyright | (c) Andrea Rossato
License | BSD-style (see LICENSE)
Maintainer | Andrea Rossato <andrea.rossato@unitn.it>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

Text.CSL.Style

Description

The Style types

Synopsis

- readCSLString :: String -> [Inline]
- writeCSLString :: [Inline] -> String
- newtype Formatted = Formatted {
  - unFormatted :: [Inline]
  }
- data Style = Style {
  - styleVersion :: String
  - styleClass :: String
  - styleInfo :: Maybe CSInfo
  - styleDefaultLocale :: String
  - styleLocale :: [Locale]
  - styleAbbrevs :: Abbreviations
  - csOptions :: [Option]
  - csMacros :: [MacroMap]
  - citation :: Citation
  - biblio :: Maybe Bibliography
  }
- data Locale = Locale {
  - localeVersion :: String
  - localeLang :: String
  - localeOptions :: [Option]
  - localeTerms :: [CslTerm]
  - localeDate :: [Element]
  }
- mergeLocales :: String -> Locale -> [Locale] -> [Locale]
- data CslTerm = CT {
  - cslTerm :: String
  - termForm :: Form
  - termGender :: Gender
  - termGenderForm :: Gender
  - termSingular :: String
  - termPlural :: String
  - termMatch :: String
  }
- newTerm :: CslTerm
- findTerm :: String -> Form -> [CslTerm] -> Maybe CslTerm
- findTerm' :: String -> Form -> Gender -> [CslTerm] -> Maybe CslTerm
- newtype Abbreviations = Abbreviations {
  - unAbbreviations :: Map String (Map String (Map String String))
  }
- type MacroMap = (String, [Element])
- data Citation = Citation {
  - citOptions :: [Option]
  - citSort :: [Sort]
  - citLayout :: Layout
  }
- data Bibliography = Bibliography {
  - bibOptions :: [Option]
  - bibSort :: [Sort]
  - bibLayout :: Layout
  }
- type Option = (String, String)
- mergeOptions :: [Option] -> [Option] -> [Option]
- data Layout = Layout {
  - layFormat :: Formatting
  - layDelim :: Delimiter
  - elements :: [Element]
  }
- data Element
  - = Choose IfThen [IfThen] [Element]
  - | Macro String Formatting
  - | Const String Formatting
  - | Variable [String] Form Formatting Delimiter
  - | Term String Form Formatting Bool
  - | Label String Form Formatting Plural
  - | Number String NumericForm Formatting
  - | Names [String] [Name] Formatting Delimiter [Element]
  - | Substitute [Element]
  - | Group Formatting Delimiter [Element]
  - | Date [String] DateForm Formatting Delimiter [DatePart] String
- data IfThen = IfThen Condition Match [Element]
- data Condition = Condition {
  - isType :: [String]
  - isSet :: [String]
  - isNumeric :: [String]
  - isUncertainDate :: [String]
  - isPosition :: [String]
  - disambiguation :: [String]
  - isLocator :: [String]
  }
- type Delimiter = String
- data Match
  - = Any
  - | All
  - | None
- match :: Match -> [Bool] -> Bool
- data DatePart = DatePart {
  - dpName :: String
  - dpForm :: String
  - dpRangeDelim :: String
  - dpFormatting :: Formatting
  }
- defaultDate :: [DatePart]
- data Sort
  - = SortVariable String Sorting
  - | SortMacro String Sorting Int Int String
- data Sorting
  - = Ascending String
  - | Descending String
- compare' :: String -> String -> Ordering
- data Form
  - = Long
  - | Short
  - | Count
  - | Verb
  - | VerbShort
  - | Symbol
  - | NotSet
- data Gender
  - = Feminine
  - | Masculine
  - | Neuter
- data NumericForm
  - = Numeric
  - | Ordinal
  - | Roman
  - | LongOrdinal
- data DateForm
  - = TextDate
  - | NumericDate
  - | NoFormDate
- data Plural
  - = Contextual
  - | Always
  - | Never
- data Name
  - = Name Form Formatting NameAttrs Delimiter [NamePart]
  - | NameLabel Form Formatting Plural
  - | EtAl Formatting String
- type NameAttrs = [(String, String)]
- data NamePart = NamePart String Formatting
- isPlural :: Plural -> Int -> Bool
- isName :: Name -> Bool
- isNames :: Element -> Bool
- hasEtAl :: [Name] -> Bool
- data Formatting = Formatting {
  - prefix :: String
  - suffix :: String
  - fontFamily :: String
  - fontStyle :: String
  - fontVariant :: String
  - fontWeight :: String
  - textDecoration :: String
  - verticalAlign :: String
  - textCase :: String
  - display :: String
  - quotes :: Quote
  - stripPeriods :: Bool
  - noCase :: Bool
  - noDecor :: Bool
  - hyperlink :: String
  }
- emptyFormatting :: Formatting
- rmTitleCase :: Formatting -> Formatting
- data Quote
  - = NativeQuote
  - | ParsedQuote
  - | NoQuote
- mergeFM :: Formatting -> Formatting -> Formatting
- data CSInfo = CSInfo {
  - csiTitle :: String
  - csiAuthor :: CSAuthor
  - csiCategories :: [CSCategory]
  - csiId :: String
  - csiUpdated :: String
  }
- data CSAuthor = CSAuthor String String String
- data CSCategory = CSCategory String String String
- data CiteprocError
  - = NoOutput
  - | ReferenceNotFound String
- data Output
  - = ONull
  - | OSpace
  - | OPan [Inline]
  - | ODel String
  - | OStr String Formatting
  - | OErr CiteprocError
  - | OLabel String Formatting
  - | ONum Int Formatting
  - | OCitNum Int Formatting
  - | ODate [Output]
  - | OYear String String Formatting
  - | OYearSuf String String [Output] Formatting
  - | OName Agent [Output] [[Output]] Formatting
  - | OContrib String String [Output] [Output] [[Output]]
  - | OLoc [Output] Formatting
  - | Output [Output] Formatting
- type Citations = [[Cite]]
- data Cite = Cite {
  - citeId :: String
  - citePrefix :: Formatted
  - citeSuffix :: Formatted
  - citeLabel :: String
  - citeLocator :: String
  - citeNoteNumber :: String
  - citePosition :: String
  - nearNote :: Bool
  - authorInText :: Bool
  - suppressAuthor :: Bool
  - citeHash :: Int
  }
- emptyCite :: Cite
- data CitationGroup = CG [(Cite, Output)] Formatting Delimiter [(Cite, Output)]
- data BiblioData = BD {
  - citations :: [Formatted]
  - bibliography :: [Formatted]
  - citationIds :: [String]
  }
- data CiteData = CD {
  - key :: String
  - collision :: [Output]
  - disambYS :: [Output]
  - disambData :: [[Output]]
  - disambed :: [Output]
  - sameAs :: [String]
  - citYear :: String
  }
- data NameData = ND {
  - nameKey :: Agent
  - nameCollision :: [Output]
  - nameDisambData :: [[Output]]
  - nameDataSolved :: [Output]
  }
- isPunctuationInQuote :: Style -> Bool
- object' :: [Pair] -> Value
- data Agent = Agent {
  - givenName :: [Formatted]
  - droppingPart :: Formatted
  - nonDroppingPart :: Formatted
  - familyName :: Formatted
  - nameSuffix :: Formatted
  - literal :: Formatted
  - commaSuffix :: Bool
  - parseNames :: Bool
  }
- emptyAgent :: Agent

# Documentation

readCSLString :: String -> [Inline]

writeCSLString :: [Inline] -> String

newtype Formatted

Constructors

Formatted |
Fields unFormatted :: [Inline]

Instances

Eq Formatted |
Data Formatted |
Ord Formatted |
Read Formatted |
Show Formatted |
IsString Formatted |
Generic Formatted |
ToJSON Formatted |
FromJSON Formatted |
Monoid Formatted |
ToYaml Formatted |
Walkable Inline Formatted |
Walkable Formatted Formatted |
type Rep Formatted |

data Style

The representation of a parsed CSL style.

Constructors

Style |
Fields styleVersion :: String styleClass :: String styleInfo :: Maybe CSInfo styleDefaultLocale :: String styleLocale :: [Locale] styleAbbrevs :: Abbreviations csOptions :: [Option] csMacros :: [MacroMap] citation :: Citation biblio :: Maybe Bibliography

Instances

Data Style |
Read Style |
Show Style |
Generic Style |
type Rep Style |

data Locale

Constructors

Locale |
Fields localeVersion :: String localeLang :: String localeOptions :: [Option] localeTerms :: [CslTerm] localeDate :: [Element]

Instances

Eq Locale |
Data Locale |
Read Locale |
Show Locale |
Generic Locale |
type Rep Locale |

mergeLocales :: String -> Locale -> [Locale] -> [Locale]

With the `defaultLocale`, the locales-xx-XX.xml loaded file and the parsed `Style` cs:locale elements, produce the final `Locale` as the only element of a list, taking into account CSL locale prioritization.

data CslTerm

Constructors

CT |
Fields cslTerm :: String termForm :: Form termGender :: Gender termGenderForm :: Gender termSingular :: String termPlural :: String termMatch :: String

Instances

Eq CslTerm |
Data CslTerm |
Read CslTerm |
Show CslTerm |
Generic CslTerm |
type Rep CslTerm |

newTerm :: CslTerm

findTerm :: String -> Form -> [CslTerm] -> Maybe CslTerm

findTerm' :: String -> Form -> Gender -> [CslTerm] -> Maybe CslTerm

newtype Abbreviations

Constructors

Abbreviations |
Fields unAbbreviations :: Map String (Map String (Map String String))

Instances

Data Abbreviations |
Read Abbreviations |
Show Abbreviations |
Generic Abbreviations |
FromJSON Abbreviations |
type Rep Abbreviations |

type MacroMap = (String, [Element])

data Citation

Constructors

Citation |
Fields citOptions :: [Option] citSort :: [Sort] citLayout :: Layout

Instances

Data Citation |
Read Citation |
Show Citation |
Generic Citation |
type Rep Citation |

data Bibliography

Constructors

Bibliography |
Fields bibOptions :: [Option] bibSort :: [Sort] bibLayout :: Layout

Instances

Data Bibliography |
Read Bibliography |
Show Bibliography |
Generic Bibliography |
type Rep Bibliography |

type Option = (String, String)

mergeOptions :: [Option] -> [Option] -> [Option]

data Layout

Constructors

Layout |
Fields layFormat :: Formatting layDelim :: Delimiter elements :: [Element]

Instances

Data Layout |
Read Layout |
Show Layout |
Generic Layout |
type Rep Layout |

data Element

Constructors

Choose IfThen [IfThen] [Element] |
Macro String Formatting |
Const String Formatting |
Variable [String] Form Formatting Delimiter |
Term String Form Formatting Bool |
Label String Form Formatting Plural |
Number String NumericForm Formatting |
Names [String] [Name] Formatting Delimiter [Element] |
Substitute [Element] |
Group Formatting Delimiter [Element] |
Date [String] DateForm Formatting Delimiter [DatePart] String |

Instances

Eq Element |
Data Element |
Read Element |
Show Element |
Generic Element |
type Rep Element |

data IfThen

Constructors

IfThen Condition Match [Element] |

Instances

Eq IfThen |
Data IfThen |
Read IfThen |
Show IfThen |
Generic IfThen |
type Rep IfThen |

data Condition

Constructors

Condition |
Fields isType :: [String] isSet :: [String] isNumeric :: [String] isUncertainDate :: [String] isPosition :: [String] disambiguation :: [String] isLocator :: [String]

Instances

Eq Condition |
Data Condition |
Read Condition |
Show Condition |
Generic Condition |
type Rep Condition |

type Delimiter = String

data Match

Constructors

Any |
All |
None |

Instances

Eq Match |
Data Match |
Read Match |
Show Match |
Generic Match |
type Rep Match |

match :: Match -> [Bool] -> Bool

data DatePart

Constructors

DatePart |
Fields dpName :: String dpForm :: String dpRangeDelim :: String dpFormatting :: Formatting

Instances

Eq DatePart |
Data DatePart |
Read DatePart |
Show DatePart |
Generic DatePart |
type Rep DatePart |

defaultDate :: [DatePart]

data Sort

Constructors

SortVariable String Sorting |
SortMacro String Sorting Int Int String |

Instances

Eq Sort |
Data Sort |
Read Sort |
Show Sort |
Generic Sort |
type Rep Sort |

data Sorting

Constructors

Ascending String |
Descending String |

Instances

Eq Sorting |
Data Sorting |
Ord Sorting |
Read Sorting |
Show Sorting |
Generic Sorting |
type Rep Sorting |

compare' :: String -> String -> Ordering

data Form

Constructors

Long |
Short |
Count |
Verb |
VerbShort |
Symbol |
NotSet |

Instances

Eq Form |
Data Form |
Read Form |
Show Form |
Generic Form |
type Rep Form |

data Gender

Constructors

Feminine |
Masculine |
Neuter |

Instances

Eq Gender |
Data Gender |
Read Gender |
Show Gender |
Generic Gender |
type Rep Gender |

data NumericForm

Constructors

Numeric |
Ordinal |
Roman |
LongOrdinal |

Instances

Eq NumericForm |
Data NumericForm |
Read NumericForm |
Show NumericForm |
Generic NumericForm |
type Rep NumericForm |

data DateForm

Constructors

TextDate |
NumericDate |
NoFormDate |

Instances

Eq DateForm |
Data DateForm |
Read DateForm |
Show DateForm |
Generic DateForm |
type Rep DateForm |

data Plural

Constructors

Contextual |
Always |
Never |

Instances

Eq Plural |
Data Plural |
Read Plural |
Show Plural |
Generic Plural |
type Rep Plural |

data Name

Constructors

Name Form Formatting NameAttrs Delimiter [NamePart] |
NameLabel Form Formatting Plural |
EtAl Formatting String |

Instances

Eq Name |
Data Name |
Read Name |
Show Name |
Generic Name |
type Rep Name |

type NameAttrs = [(String, String)]

data NamePart

Constructors

NamePart String Formatting |

Instances

Eq NamePart |
Data NamePart |
Read NamePart |
Show NamePart |
Generic NamePart |
type Rep NamePart |

isPlural :: Plural -> Int -> Bool

isName :: Name -> Bool

isNames :: Element -> Bool

hasEtAl :: [Name] -> Bool

data Formatting

Constructors

Formatting |
Fields prefix :: String suffix :: String fontFamily :: String fontStyle :: String fontVariant :: String fontWeight :: String textDecoration :: String verticalAlign :: String textCase :: String display :: String quotes :: Quote stripPeriods :: Bool noCase :: Bool noDecor :: Bool hyperlink :: String

Instances

Eq Formatting |
Data Formatting |
Ord Formatting |
Read Formatting |
Show Formatting |
Generic Formatting |
type Rep Formatting |

emptyFormatting :: Formatting

rmTitleCase :: Formatting -> Formatting

data Quote

Constructors

NativeQuote |
ParsedQuote |
NoQuote |

Instances

Eq Quote |
Data Quote |
Ord Quote |
Read Quote |
Show Quote |
Generic Quote |
type Rep Quote |

mergeFM :: Formatting -> Formatting -> Formatting

data CSInfo

Constructors

CSInfo |
Fields csiTitle :: String csiAuthor :: CSAuthor csiCategories :: [CSCategory] csiId :: String csiUpdated :: String

Instances

Data CSInfo |
Read CSInfo |
Show CSInfo |
Generic CSInfo |
type Rep CSInfo |

data CSAuthor

Constructors

CSAuthor String String String |

Instances

Eq CSAuthor |
Data CSAuthor |
Read CSAuthor |
Show CSAuthor |
Generic CSAuthor |
type Rep CSAuthor |

data CSCategory

Constructors

CSCategory String String String |

Instances

Eq CSCategory |
Data CSCategory |
Read CSCategory |
Show CSCategory |
Generic CSCategory |
type Rep CSCategory |

data CiteprocError

Constructors

NoOutput |
ReferenceNotFound String |

Instances

Eq CiteprocError |
Data CiteprocError |
Ord CiteprocError |
Show CiteprocError |
Generic CiteprocError |
type Rep CiteprocError |

data Output

The `Output` generated by the evaluation of a style. Must be further processed for disambiguation and collapsing.

Constructors

ONull |
OSpace |
OPan [Inline] |
ODel String | A delimiter string.
OStr String Formatting | A simple `String`
OErr CiteprocError | Warning message
OLabel String Formatting | A label used for roles
ONum Int Formatting | A number (used to count contributors)
OCitNum Int Formatting | The citation number
ODate [Output] | A (possibly) ranged date
OYear String String Formatting | The year and the citeId
OYearSuf String String [Output] Formatting | The year suffix, the citeId and a holder for collision data
OName Agent [Output] [[Output]] Formatting | A (family) name with the list of given names.
OContrib String String [Output] [Output] [[Output]] | The citation key, the role (author, editor, etc.), the contributor(s), the output needed for year suf. disambiguation, and everything used for name disambiguation.
OLoc [Output] Formatting | The citation's locator
Output [Output] Formatting | Some nested `Output`

Instances

Eq Output |
Data Output |
Ord Output |
Show Output |
Generic Output |
type Rep Output |

type Citations = [[Cite]]

data Cite

Constructors

Cite |
Fields citeId :: String citePrefix :: Formatted citeSuffix :: Formatted citeLabel :: String citeLocator :: String citeNoteNumber :: String citePosition :: String nearNote :: Bool authorInText :: Bool suppressAuthor :: Bool citeHash :: Int

Instances

Eq Cite |
Data Cite |
Show Cite |
Generic Cite |
FromJSON Cite |
FromJSON [[Cite]] |
type Rep Cite |

emptyCite :: Cite

data CitationGroup

A citation group: the first list has a single member when the citation group starts with an "author-in-text" cite, the `Formatting` to be applied, the `Delimiter` between individual citations and the list of evaluated citations.

Constructors

CG [(Cite, Output)] Formatting Delimiter [(Cite, Output)] |

Instances

Eq CitationGroup |
Data CitationGroup |
Show CitationGroup |
Generic CitationGroup |
type Rep CitationGroup |

data BiblioData

Constructors

BD |
Fields citations :: [Formatted] bibliography :: [Formatted] citationIds :: [String]

Instances

Data BiblioData |
Show BiblioData |
Generic BiblioData |
type Rep BiblioData |

data CiteData

A record with all the data to produce the `Formatted` of a citation: the citation key, the part of the formatted citation that may be colliding with other citations, the form of the citation when a year suffix is used for disambiguation , the data to disambiguate it (all possible contributors and all possible given names), and, after processing, the disambiguated citation and its year, initially empty.

Constructors

CD |
Fields key :: String collision :: [Output] disambYS :: [Output] disambData :: [[Output]] disambed :: [Output] sameAs :: [String] citYear :: String

Instances

Eq CiteData |
Data CiteData |
Show CiteData |
Generic CiteData |
type Rep CiteData |

data NameData

Constructors

ND |
Fields nameKey :: Agent nameCollision :: [Output] nameDisambData :: [[Output]] nameDataSolved :: [Output]

Instances

Eq NameData |
Data NameData |
Show NameData |
Generic NameData |
type Rep NameData |

isPunctuationInQuote :: Style -> Bool

object' :: [Pair] -> Value

data Agent

Constructors

Agent |
Fields givenName :: [Formatted] droppingPart :: Formatted nonDroppingPart :: Formatted familyName :: Formatted nameSuffix :: Formatted literal :: Formatted commaSuffix :: Bool parseNames :: Bool

Instances

Eq Agent |
Data Agent |
Ord Agent |
Read Agent |
Show Agent |
Generic Agent |
ToJSON Agent |
FromJSON Agent |
ToYaml Agent |
FromJSON [Agent] |
type Rep Agent |

emptyAgent :: Agent