citeproc-hs-0.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 {
styleClass :: String
styleInfo :: Maybe CSInfo
styleLang :: String
styleLocale :: String
csTerms :: [TermMap]
csMacros :: [MacroMap]
citation :: Citation
biblio :: Maybe Bibliography
}
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)
data Layout = Layout {
layFormat :: Formatting
layDelim :: Delimiter
elements :: [Element]
}
data Element
= Choose IfThen [IfThen] [Element]
| Macro String Form Formatting
| Const String Formatting
| PointLocator String Form Formatting
| Variable [String] Form Formatting Delimiter
| Term String Form Formatting Bool Bool
| Label String Form Formatting Bool Bool
| Number String NumericForm Formatting
| ShortNames [String] Formatting Delimiter
| Names [String] [Name] Formatting Delimiter [Element]
| Substitute [Element]
| Group Formatting Delimiter String [Element]
| Date [String] Formatting Delimiter [DatePart]
data IfThen = IfThen Condition Match [Element]
data Condition = Condition {
isType :: [String]
isSet :: [String]
isNumeric :: [String]
isDate :: [String]
isPosition :: [String]
disambiguation :: [String]
isLocator :: [String]
}
type Delimiter = String
data Match
= Any
| All
| None
match :: Match -> [Bool] -> Bool
data DatePart = DatePart String String Formatting
defaultDate :: [DatePart]
data Sort
= SortVariable String Sorting
| SortMacro String Sorting
data Sorting
= Ascending String
| Descending String
data Form
= Long
| Verb
| Short
| VerbShort
| Symbol
data NumericForm
= Numeric
| Ordinal
| Roman
data Name
= Name Form Formatting NameFormatting Delimiter
| NameLabel Form Formatting Bool Bool
isName :: Name -> Bool
data NameFormatting = NameFormatting {
andConnector :: String
delimiterPrecedesLast :: String
nameAsSortOrder :: String
sortSeparator :: String
initializeWith :: String
}
defaultNameFormatting :: NameFormatting
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
}
emptyFormatting :: 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 String Formatting [FormattedOutput]
| Delimiter String
data Output
= OStr String Formatting
| OName String [String] Formatting
| OYear String String Formatting
| OCitNum Int Formatting
| Output [Output] Formatting
| OContrib String [Output] [[Output]]
| ODel String
data CitationGroup = CG Formatting String [Output]
data BiblioData = BD {
citations :: [[FormattedOutput]]
bibliography :: [[FormattedOutput]]
}
data CiteData = CD {
key :: String
collision :: [Output]
disambData :: [[Output]]
disambed :: [Output]
citYear :: String
}
formatOutput :: Output -> FormattedOutput
mapGroupOutput :: (Output -> [a]) -> CitationGroup -> [a]
proc :: (Typeable a, Data b) => (a -> a) -> b -> b
query :: (Typeable a, Data b) => (a -> [c]) -> b -> [c]
rmGivenNames :: Output -> Output
rmContribs :: Output -> Output
addGivenNames :: [Output] -> [Output]
addYearSuffix :: Output -> Output
Documentation
data Style Source
The representation of a parsed CSL style.
Constructors
Style
styleClass :: String
styleInfo :: Maybe CSInfo
styleLang :: String
styleLocale :: String
csTerms :: [TermMap]
csMacros :: [MacroMap]
citation :: Citation
biblio :: Maybe Bibliography
show/hide Instances
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
data Layout Source
Constructors
Layout
layFormat :: Formatting
layDelim :: Delimiter
elements :: [Element]
show/hide Instances
data Element Source
Constructors
Choose IfThen [IfThen] [Element]
Macro String Form Formatting
Const String Formatting
PointLocator String Form Formatting
Variable [String] Form Formatting Delimiter
Term String Form Formatting Bool Bool
Label String Form Formatting Bool Bool
Number String NumericForm Formatting
ShortNames [String] Formatting Delimiter
Names [String] [Name] Formatting Delimiter [Element]
Substitute [Element]
Group Formatting Delimiter String [Element]
Date [String] Formatting Delimiter [DatePart]
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]
isDate :: [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 String String Formatting
show/hide Instances
defaultDate :: [DatePart]Source
data Sort Source
Constructors
SortVariable String Sorting
SortMacro String Sorting
show/hide Instances
data Sorting Source
Constructors
Ascending String
Descending String
show/hide Instances
data Form Source
Constructors
Long
Verb
Short
VerbShort
Symbol
show/hide Instances
data NumericForm Source
Constructors
Numeric
Ordinal
Roman
show/hide Instances
data Name Source
Constructors
Name Form Formatting NameFormatting Delimiter
NameLabel Form Formatting Bool Bool
show/hide Instances
isName :: Name -> BoolSource
data NameFormatting Source
Constructors
NameFormatting
andConnector :: String
delimiterPrecedesLast :: String
nameAsSortOrder :: String
sortSeparator :: String
initializeWith :: String
show/hide Instances
defaultNameFormatting :: NameFormattingSource
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
show/hide Instances
emptyFormatting :: 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 String Formatting [FormattedOutput]
Delimiter String
show/hide Instances
data Output Source
The Output generated by the evaluation of a style. Must be further processed for disambiguation and collapsing.
Constructors
OStr String FormattingA simple String
OName String [String] FormattingA (family) name with the list of given names.
OYear String String FormattingThe year and a suffix if needed
OCitNum Int FormattingThe citation number
Output [Output] FormattingSome nested Output
OContrib String [Output] [[Output]]The citation key with the contributor(s), and everything used for disambiguation.
ODel StringA delimiter string.
show/hide Instances
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 Formatting String [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]
disambData :: [[Output]]
disambed :: [Output]
citYear :: String
show/hide Instances
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.
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.
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.
Produced by Haddock version 2.4.2