citeproc-hs-0.3.2: A Citation Style Language implementation in HaskellSource codeContentsIndex
Text.CSL.Style
Portabilityunportable
Stabilityunstable
MaintainerAndrea Rossato <andrea.rossato@unitn.it>
Description
The Style types
Synopsis
data Style = Style {
styleVersion :: String
styleClass :: String
styleInfo :: Maybe CSInfo
styleDefaultLocale :: String
styleLocale :: [Locale]
csOptions :: [Option]
csMacros :: [MacroMap]
citation :: Citation
biblio :: Maybe Bibliography
}
data Locale = Locale {
localeVersion :: String
localeLang :: String
localeOptions :: [Option]
localeTermMap :: [TermMap]
localeDate :: [Element]
}
mergeLocales :: String -> Locale -> [Locale] -> [Locale]
type TermMap = ((String, Form), (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
| ShortNames [String] Formatting Delimiter
| 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 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
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 :: Bool
stripPeriods :: Bool
noCase :: Bool
noDecor :: Bool
}
emptyFormatting :: Formatting
unsetAffixes :: Formatting -> Formatting
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 FormattedOutput
= FO Formatting [FormattedOutput]
| FN String Formatting
| FS String Formatting
| FDel String
| FPan [Inline]
| FNull
data Output
= ONull
| OSpace
| OPan [Inline]
| ODel String
| OStr String Formatting
| ONum Int Formatting
| OCitNum Int Formatting
| OYear String String Formatting
| OYearSuf String String [Output] Formatting
| OName String [Output] [[Output]] Formatting
| OContrib String String [Output] [Output] [[Output]]
| Output [Output] Formatting
data Affix
= PlainText String
| PandocText [Inline]
type Citations = [[Cite]]
data Cite = Cite {
citeId :: String
citePrefix :: Affix
citeSuffix :: Affix
citeLabel :: String
citeLocator :: String
citeNoteNumber :: String
citePosition :: String
nearNote :: Bool
authorInText :: Bool
suppressAuthor :: Bool
citeHash :: Int
}
emptyAffix :: Affix
emptyCite :: Cite
data CitationGroup = CG [(Cite, Output)] Formatting Delimiter [(Cite, Output)]
data BiblioData = BD {
citations :: [[FormattedOutput]]
bibliography :: [[FormattedOutput]]
}
data CiteData = CD {
key :: String
collision :: [Output]
disambYS :: [Output]
disambData :: [[Output]]
disambed :: [Output]
citYear :: String
}
data NameData = ND {
nameKey :: String
nameCollision :: [Output]
nameDisambData :: [[Output]]
nameDataSolved :: [Output]
}
formatOutputList :: [Output] -> [FormattedOutput]
formatOutput :: Output -> FormattedOutput
mapGroupOutput :: (Output -> [a]) -> CitationGroup -> [a]
proc :: (Typeable a, Data b) => (a -> a) -> b -> b
proc' :: (Typeable a, Data b) => (a -> a) -> b -> b
query :: (Typeable a, Data b) => (a -> [c]) -> b -> [c]
rmGivenNames :: Output -> Output
rmNameHash :: Output -> Output
rmContribs :: Output -> Output
addGivenNames :: [Output] -> [Output]
addYearSuffix :: Output -> Output
hasYear :: Output -> Bool
hasYearSuf :: Output -> Bool
betterThen :: Eq a => [a] -> [a] -> [a]
Documentation
data Style Source
The representation of a parsed CSL style.
Constructors
Style
styleVersion :: String
styleClass :: String
styleInfo :: Maybe CSInfo
styleDefaultLocale :: String
styleLocale :: [Locale]
csOptions :: [Option]
csMacros :: [MacroMap]
citation :: Citation
biblio :: Maybe Bibliography
show/hide Instances
data Locale Source
Constructors
Locale
localeVersion :: String
localeLang :: String
localeOptions :: [Option]
localeTermMap :: [TermMap]
localeDate :: [Element]
show/hide Instances
mergeLocales :: String -> Locale -> [Locale] -> [Locale]Source
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.
type TermMap = ((String, Form), (String, String))Source
type MacroMap = (String, [Element])Source
data Citation Source
Constructors
Citation
citOptions :: [Option]
citSort :: [Sort]
citLayout :: Layout
show/hide Instances
data Bibliography Source
Constructors
Bibliography
bibOptions :: [Option]
bibSort :: [Sort]
bibLayout :: Layout
show/hide Instances
type Option = (String, String)Source
mergeOptions :: [Option] -> [Option] -> [Option]Source
data Layout Source
Constructors
Layout
layFormat :: Formatting
layDelim :: Delimiter
elements :: [Element]
show/hide Instances
data Element Source
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
ShortNames [String] Formatting Delimiter
Names [String] [Name] Formatting Delimiter [Element]
Substitute [Element]
Group Formatting Delimiter [Element]
Date [String] DateForm Formatting Delimiter [DatePart] String
show/hide Instances
data IfThen Source
Constructors
IfThen Condition Match [Element]
show/hide Instances
data Condition Source
Constructors
Condition
isType :: [String]
isSet :: [String]
isNumeric :: [String]
isUncertainDate :: [String]
isPosition :: [String]
disambiguation :: [String]
isLocator :: [String]
show/hide Instances
type Delimiter = StringSource
data Match Source
Constructors
Any
All
None
show/hide Instances
match :: Match -> [Bool] -> BoolSource
data DatePart Source
Constructors
DatePart
dpName :: String
dpForm :: String
dpRangeDelim :: String
dpFormatting :: Formatting
show/hide Instances
defaultDate :: [DatePart]Source
data Sort Source
Constructors
SortVariable String Sorting
SortMacro String Sorting Int Int String
show/hide Instances
data Sorting Source
Constructors
Ascending String
Descending String
show/hide Instances
compare' :: String -> String -> OrderingSource
data Form Source
Constructors
Long
Short
Count
Verb
VerbShort
Symbol
NotSet
show/hide Instances
data NumericForm Source
Constructors
Numeric
Ordinal
Roman
LongOrdinal
show/hide Instances
data DateForm Source
Constructors
TextDate
NumericDate
NoFormDate
show/hide Instances
data Plural Source
Constructors
Contextual
Always
Never
show/hide Instances
data Name Source
Constructors
Name Form Formatting NameAttrs Delimiter [NamePart]
NameLabel Form Formatting Plural
EtAl Formatting String
show/hide Instances
type NameAttrs = [(String, String)]Source
data NamePart Source
Constructors
NamePart String Formatting
show/hide Instances
isName :: Name -> BoolSource
isNames :: Element -> BoolSource
hasEtAl :: [Name] -> BoolSource
data Formatting Source
Constructors
Formatting
prefix :: String
suffix :: String
fontFamily :: String
fontStyle :: String
fontVariant :: String
fontWeight :: String
textDecoration :: String
verticalAlign :: String
textCase :: String
display :: String
quotes :: Bool
stripPeriods :: Bool
noCase :: Bool
noDecor :: Bool
show/hide Instances
emptyFormatting :: FormattingSource
unsetAffixes :: Formatting -> FormattingSource
mergeFM :: Formatting -> Formatting -> FormattingSource
data CSInfo Source
Constructors
CSInfo
csiTitle :: String
csiAuthor :: CSAuthor
csiCategories :: [CSCategory]
csiId :: String
csiUpdated :: String
show/hide Instances
data CSAuthor Source
Constructors
CSAuthor String String String
show/hide Instances
data CSCategory Source
Constructors
CSCategory String String String
show/hide Instances
data FormattedOutput Source
The formatted output, produced after post-processing the evaluated citations.
Constructors
FO Formatting [FormattedOutput]
FN String Formatting
FS String Formatting
FDel String
FPan [Inline]
FNull
show/hide Instances
data Output Source
The Output generated by the evaluation of a style. Must be further processed for disambiguation and collapsing.
Constructors
ONull
OSpace
OPan [Inline]
ODel StringA delimiter string.
OStr String FormattingA simple String
ONum Int FormattingA number (used to count contributors)
OCitNum Int FormattingThe citation number
OYear String String FormattingThe year and the citeId
OYearSuf String String [Output] FormattingThe year suffix, the citeId and a holder for collision data
OName String [Output] [[Output]] FormattingA (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.
Output [Output] FormattingSome nested Output
show/hide Instances
data Affix Source
Constructors
PlainText String
PandocText [Inline]
show/hide Instances
type Citations = [[Cite]]Source
data Cite Source
Constructors
Cite
citeId :: String
citePrefix :: Affix
citeSuffix :: Affix
citeLabel :: String
citeLocator :: String
citeNoteNumber :: String
citePosition :: String
nearNote :: Bool
authorInText :: Bool
suppressAuthor :: Bool
citeHash :: Int
show/hide Instances
emptyAffix :: AffixSource
emptyCite :: CiteSource
data CitationGroup Source
A citation group: a list of evaluated citations, the Formatting to be applied to them, and the Delimiter between individual citations.
Constructors
CG [(Cite, Output)] Formatting Delimiter [(Cite, Output)]
show/hide Instances
data BiblioData Source
Constructors
BD
citations :: [[FormattedOutput]]
bibliography :: [[FormattedOutput]]
show/hide Instances
data CiteData Source
A record with all the data to produce the FormattedOutput of a citation: the citation key, the part of the citation that may be colliding with other citations (the list of contributors for the same year), the data to disambiguate it (all possible contributors and all possible given names), and the disambiguated citation and its year.
Constructors
CD
key :: String
collision :: [Output]
disambYS :: [Output]
disambData :: [[Output]]
disambed :: [Output]
citYear :: String
show/hide Instances
data NameData Source
Constructors
ND
nameKey :: String
nameCollision :: [Output]
nameDisambData :: [[Output]]
nameDataSolved :: [Output]
show/hide Instances
formatOutputList :: [Output] -> [FormattedOutput]Source
formatOutput :: Output -> FormattedOutputSource
Convert evaluated Output into FormattedOutput, ready for the output filters.
mapGroupOutput :: (Output -> [a]) -> CitationGroup -> [a]Source
Map the evaluated output of a citation group.
proc :: (Typeable a, Data b) => (a -> a) -> b -> bSource
A generic processing function.
proc' :: (Typeable a, Data b) => (a -> a) -> b -> bSource
A generic processing function: process a data structure in top-down manner.
query :: (Typeable a, Data b) => (a -> [c]) -> b -> [c]Source
A generic query function.
rmGivenNames :: Output -> OutputSource
Removes all given names form a OName element with proc.
rmNameHash :: Output -> OutputSource
rmContribs :: Output -> OutputSource
Removes all contributors' names.
addGivenNames :: [Output] -> [Output]Source
Add, with proc, a give name to the family name. Needed for disambiguation.
addYearSuffix :: Output -> OutputSource
Add the year suffix to the year. Needed for disambiguation.
hasYear :: Output -> BoolSource
hasYearSuf :: Output -> BoolSource
betterThen :: Eq a => [a] -> [a] -> [a]Source
Produced by Haddock version 2.6.1