| citeproc-hs-0.2: A Citation Style Language implementation in Haskell | Source code | Contents | Index

Text.CSL.Style

Portability | unportable
Stability | unstable
Maintainer | Andrea 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 |

Instances

Data Style
Show Style
Typeable Style

type TermMap = ((String, Form), (String, String)) | Source

type MacroMap = (String, [Element]) | Source

data Citation | Source

Constructors

Citation |

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

Instances

Data Citation
Show Citation
Typeable Citation

data Bibliography | Source

Constructors

Bibliography |

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

Instances

Data Bibliography
Show Bibliography
Typeable Bibliography

type Option = (String, String) | Source

data Layout | Source

Constructors

Layout |

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

Instances

Data Layout
Show Layout
Typeable Layout
XmlPickler Layout

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] |

Instances

Eq Element
Data Element
Show Element
Typeable Element
XmlPickler Element

data IfThen | Source

Constructors

IfThen Condition Match [Element] |

Instances

Eq IfThen
Data IfThen
Show IfThen
Typeable IfThen
XmlPickler IfThen

data Condition | Source

Constructors

Condition |

isType :: [String] |
isSet :: [String] |
isNumeric :: [String] |
isDate :: [String] |
isPosition :: [String] |
disambiguation :: [String] |
isLocator :: [String] |

Instances

Eq Condition
Data Condition
Show Condition
Typeable Condition
XmlPickler Condition

type Delimiter = String | Source

data Match | Source

Constructors

Any |
All |
None |

Instances

Eq Match
Data Match
Read Match
Show Match
Typeable Match
XmlPickler Match

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

data DatePart | Source

Constructors

DatePart String String Formatting |

Instances

Eq DatePart
Data DatePart
Show DatePart
Typeable DatePart
XmlPickler DatePart

defaultDate :: [DatePart] | Source

data Sort | Source

Constructors

SortVariable String Sorting |
SortMacro String Sorting |

Instances

Eq Sort
Data Sort
Show Sort
Typeable Sort
XmlPickler Sort

data Sorting | Source

Constructors

Ascending String |
Descending String |

Instances

Eq Sorting
Data Sorting
Ord Sorting
Read Sorting
Show Sorting
Typeable Sorting

data Form | Source

Constructors

Long |
Verb |
Short |
VerbShort |
Symbol |

Instances

Eq Form
Data Form
Read Form
Show Form
Typeable Form
XmlPickler Form

data NumericForm | Source

Constructors

Numeric |
Ordinal |
Roman |

Instances

Eq NumericForm
Data NumericForm
Read NumericForm
Show NumericForm
Typeable NumericForm
XmlPickler NumericForm

data Name | Source

Constructors

Name Form Formatting NameFormatting Delimiter |
NameLabel Form Formatting Bool Bool |

Instances

Eq Name
Data Name
Show Name
Typeable Name
XmlPickler Name

isName :: Name -> Bool | Source

data NameFormatting | Source

Constructors

NameFormatting |

andConnector :: String |
delimiterPrecedesLast :: String |
nameAsSortOrder :: String |
sortSeparator :: String |
initializeWith :: String |

Instances

Eq NameFormatting
Data NameFormatting
Show NameFormatting
Typeable NameFormatting
XmlPickler NameFormatting

defaultNameFormatting :: NameFormatting | Source

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 |

Instances

Eq Formatting
Data Formatting
Ord Formatting
Read Formatting
Show Formatting
Typeable Formatting
XmlPickler Formatting

emptyFormatting :: Formatting | Source

data CSInfo | Source

Constructors

CSInfo |

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

Instances

Data CSInfo
Read CSInfo
Show CSInfo
Typeable CSInfo
XmlPickler CSInfo

data CSAuthor | Source

Constructors

CSAuthor String String String |

Instances

Eq CSAuthor
Data CSAuthor
Read CSAuthor
Show CSAuthor
Typeable CSAuthor
XmlPickler CSAuthor

data CSCategory | Source

Constructors

CSCategory String String String |

Instances

Eq CSCategory
Data CSCategory
Read CSCategory
Show CSCategory
Typeable CSCategory
XmlPickler CSCategory

data FormattedOutput | Source

The formatted output, produced after post-processing the evaluated citations.
Constructors

FO String Formatting [FormattedOutput] |
Delimiter String |

Instances

Eq FormattedOutput
Show FormattedOutput

data Output | Source

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

OStr String Formatting | A simple `String`
OName String [String] Formatting | A (family) name with the list of given names.
OYear String String Formatting | The year and a suffix if needed
OCitNum Int Formatting | The citation number
Output [Output] Formatting | Some nested `Output`
OContrib String [Output] [[Output]] | The citation key with the contributor(s), and everything used for disambiguation.
ODel String | A delimiter string.

Instances

Eq Output
Data Output
Ord Output
Show Output
Typeable Output

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] |

Instances

Eq CitationGroup
Data CitationGroup
Show CitationGroup
Typeable CitationGroup

data BiblioData | Source

Constructors

BD |

citations :: [[FormattedOutput]] |
bibliography :: [[FormattedOutput]] |

Instances

Show BiblioData

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 |

Instances

Eq CiteData
Data CiteData
Show CiteData
Typeable CiteData

formatOutput :: Output -> FormattedOutput | Source

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

A generic processing function.

query :: (Typeable a, Data b) => (a -> [c]) -> b -> [c] | Source

A generic query function.

rmGivenNames :: Output -> Output | Source

Removes all given names form a `OName` element with `proc`.

rmContribs :: Output -> Output | Source

Removes all contributors' names.

addGivenNames :: [Output] -> [Output] | Source

Add, with `proc`, a give name to the family name. Needed for disambiguation.

addYearSuffix :: Output -> Output | Source

Add the year suffix to the year. Needed for disambiguation.
Produced by Haddock version 2.4.2