ogmarkup-3.0.0: A lightweight markup language for story writers

Copyright(c) Ogma Project, 2016
LicenseMIT
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Text.Ogmarkup.Private.Typography

Contents

Description

This module provides the Typography datatype along with two default instances for French and English.

Synopsis

Inner spaces representation

data Space Source #

Deal with typographic spaces, especially when it comes to separating two texts. Because Space derives Ord, it is possible to use min and max to determine which one to use in case of a conflict.

Constructors

Normal

A normal space that can be turned into a newline for displaying.

Nbsp

A non breakable space, it cannot be turned into a newline.

None

No space at all.

Instances

Eq Space Source # 

Methods

(==) :: Space -> Space -> Bool #

(/=) :: Space -> Space -> Bool #

Ord Space Source # 

Methods

compare :: Space -> Space -> Ordering #

(<) :: Space -> Space -> Bool #

(<=) :: Space -> Space -> Bool #

(>) :: Space -> Space -> Bool #

(>=) :: Space -> Space -> Bool #

max :: Space -> Space -> Space #

min :: Space -> Space -> Space #

Typography definition

data Typography a Source #

A Typography is a data type that tells the caller what space should be privileged before and after a text.

Constructors

Typography 

Fields

  • decide :: Mark -> (Space, Space, a)

    For a given Mark, returns a tuple with the spaces to use before and after the punctuation mark and its output value.

  • openDialogue :: Bool -> Maybe Mark

    Which mark to use to open a dialogue. If the parameter is True, there were another dialogue just before.

  • closeDialogue :: Bool -> Maybe Mark

    Which mark to use to close a dialogue. If the parameter is True, there is another dialogue just after.

Instances

Functor Typography Source #

Apply the function to each Mark output value

Methods

fmap :: (a -> b) -> Typography a -> Typography b #

(<$) :: a -> Typography b -> Typography a #

beforeAtom :: Typography a -> Atom a -> Space Source #

From a Typography, it gives the space to privilege before the input Text.

afterAtom :: Typography a -> Atom a -> Space Source #

From a Typography, it gives the space to privilege after the input Text.

normalizeAtom :: Typography a -> Atom a -> a Source #

Normalize the input in order to add it to a generated Text.

Ready-to-use Typography

frenchTypo :: IsString a => Typography a Source #

A proposal for the French typography. It can be used with several generation approaches, as it remains very generic. Requires the output type to be an instance of IsString.

englishTypo :: IsString a => Typography a Source #

A proposal for the English typography. It can be used with several generation approaches, as it remains very generic. Requires the output type to be an instance of IsString.