Copyright | (c) Ogma Project, 2016 |
---|---|
License | MIT |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Documentation
class (IsString o, Monoid o) => GenConf c o | c -> o where Source #
An instance of the GenConf
typeclass can be given as a parameter to
a Generator
. In order to prevent GHC
to overabstract this typeclass, there can be only one instance of
GenConf for one datatype. In other words, one datatype can only handle
one return type c
.
For each template, we give a prefered layout and some hints about the default implementation (which is almost always the identity function, ignoring all the parameters but the generated output.
Warning: GenConf
is a multiparam typeclass (see
MultiParamTypeClasses
GHC extension). In order to make new instances,
the following extensions need to be enabled:
FlexibleInstances
MultiParamTypeClasses
Otherwise, GHC will not accept your instance statement.
typography :: c -> Typography o Source #
Returns a Typography
instance to be used by the
Generator
.
- Default implementation: returns
englishTypo
.
documentTemplate :: c -> Template o Source #
This template is used once the output has been completely generated.
- Layout: block
- Default implementation: the identity function
errorTemplate :: c -> Template o Source #
This template is used on the ill-formed portion of the ogmarkup document which have been ignored during the best-effort compilation.
- Layout: inline
- Default implementation: the identity function
storyTemplate :: c -> Template o Source #
This template is used on regular sections which focus on telling the story.
- Layout: block
- Default implementation: the identity function
asideTemplate :: c -> Maybe o -> Template o Source #
This template is used on aside sections which may comprised flashbacks, letters or songs, for instance.
- Layout: block
- Default implementation: the identity function (it ignores the class name)
paragraphTemplate :: c -> Template o Source #
This template is used on paragraphs within a section.
- Layout: block
- Default implementation: the identity function
tellerTemplate :: c -> Template o Source #
This template is used on the narrative portion of an ogmarkup document.
- Layout: inline
- Default implementation: the identity function
dialogueTemplate :: c -> o -> Template o Source #
This template is used on audible dialogue. The class name is
mandatory even if the character name is optional for dialogues and
thoughts in the ogmarkup grammar. The authorNormalize
function is
used by the generator to get a default value when no character names
are provided.
- Layout: inline
- Default implementation: the identity function
thoughtTemplate :: c -> o -> Template o Source #
This template is used on unaudible dialogue. See dialogueTemplate
to
get more information on why the class name is not
optional.
- Layout: inline
- Default implementation: the identity function
replyTemplate :: c -> Template o Source #
betweenDialogue :: c -> o Source #
Return a marker to insert between two consecutive dialogues. The default use case is to return the concatenation of the ending mark and the opening mark of a paragraph. a paragrap
- Layout: inline
- Default implementation:
mempty
emphTemplate :: c -> Template o Source #
A template to apply emphasis to an piece of text.
Default implementation: the identity function
strongEmphTemplate :: c -> Template o Source #
A template to apply stong emphasis (often bold) to a piece of text.
- Layout: inline
- Default implementation:
mempty
authorNormalize :: c -> Maybe o -> o Source #
This function is called by a Generator to derive a class name for an optional character name.
- Default implementation: simply unwrap the Maybe value, if
Nothing return
mempty
.
printSpace :: c -> Space -> o Source #
Generate an output from a Space
.