{-# LANGUAGE OverloadedStrings #-}

-- | Definition of the FPO LSD.
--
--   This only exists because we cannot yet parse LSD.
module Language.Lsd.Example.Fpo
    ( fpoT
    , superSectionT
    , sectionT
    , paragraphT
    , footnoteT
    )
where

import Data.Char (toLower)
import Data.List.NonEmpty (NonEmpty (..))
import Data.Typography
import Data.Void (Void)
import Language.Lsd.AST.Common
import Language.Lsd.AST.Format
import Language.Lsd.AST.SimpleRegex
import Language.Lsd.AST.Type
import Language.Lsd.AST.Type.AppendixSection
import Language.Lsd.AST.Type.Document
import Language.Lsd.AST.Type.DocumentContainer
import Language.Lsd.AST.Type.Enum
import Language.Lsd.AST.Type.Footnote
import Language.Lsd.AST.Type.Module
import Language.Lsd.AST.Type.Paragraph
import Language.Lsd.AST.Type.Section
import Language.Lsd.AST.Type.SimpleBlock
import Language.Lsd.AST.Type.SimpleParagraph
import Language.Lsd.AST.Type.SimpleSection
import Language.Lsd.AST.Type.Table
import Language.Lsd.AST.Type.Text

fpoT :: NamedType DocumentContainerType
fpoT :: NamedType DocumentContainerType
fpoT =
    TypeName
-> DisplayTypeName
-> DocumentContainerType
-> NamedType DocumentContainerType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"fpo-container" DisplayTypeName
"Fachprüfungsordnung" (DocumentContainerType -> NamedType DocumentContainerType)
-> DocumentContainerType -> NamedType DocumentContainerType
forall a b. (a -> b) -> a -> b
$
        DocumentContainerFormat
-> NavTocHeading
-> NamedType DocumentType
-> Sequence (NamedType AppendixSectionType)
-> DocumentContainerType
DocumentContainerType
            ( HeaderFooterFormat
-> HeaderFooterFormat
-> MainDocumentFormat
-> DocumentContainerFormat
DocumentContainerFormat
                HeaderFooterFormat
headerFormat
                HeaderFooterFormat
footerFormat
                MainDocumentFormat
mainDocFormat
            )
            (Text -> NavTocHeading
NavTocHeading Text
"Header")
            NamedType DocumentType
mainDocT
            ([NamedType AppendixSectionType]
-> Sequence (NamedType AppendixSectionType)
forall a. [a] -> Sequence a
Sequence [NamedType AppendixSectionType
appendixT, NamedType AppendixSectionType
attachmentT])
  where
    mainDocFormat :: MainDocumentFormat
mainDocFormat =
        Fallback NavTocHeading -> MainHeadingFormat -> MainDocumentFormat
MainDocumentFormat
            (NavTocHeading -> Fallback NavTocHeading
forall a. a -> Fallback a
Fallback (NavTocHeading -> Fallback NavTocHeading)
-> NavTocHeading -> Fallback NavTocHeading
forall a b. (a -> b) -> a -> b
$ Text -> NavTocHeading
NavTocHeading Text
"(Dokument-Titel)")
            ( Typography
-> FormatString (HeadingPlaceholderAtom 'False)
-> MainHeadingFormat
forall (permitIdentifier :: Bool).
Typography
-> FormatString (HeadingPlaceholderAtom permitIdentifier)
-> HeadingFormat permitIdentifier
HeadingFormat
                (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
Centered FontSize
LargeFontSize [FontStyle
Bold])
                ([FormatAtom (HeadingPlaceholderAtom 'False)]
-> FormatString (HeadingPlaceholderAtom 'False)
forall a. [FormatAtom a] -> FormatString a
FormatString [HeadingPlaceholderAtom 'False
-> FormatAtom (HeadingPlaceholderAtom 'False)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'False
forall (permitIdentifier :: Bool).
HeadingPlaceholderAtom permitIdentifier
HeadingTextPlaceholder])
            )

    headerFormat :: HeaderFooterFormat
headerFormat =
        [HeaderFooterItemFormat]
-> [HeaderFooterItemFormat]
-> [HeaderFooterItemFormat]
-> HeaderFooterFormat
HeaderFooterFormat
            [ FontSize
-> [FontStyle]
-> FormatString HeaderFooterFormatAtom
-> HeaderFooterItemFormat
HeaderFooterItemFormat
                FontSize
MediumFontSize
                [FontStyle
Bold]
                ( [FormatAtom HeaderFooterFormatAtom]
-> FormatString HeaderFooterFormatAtom
forall a. [FormatAtom a] -> FormatString a
FormatString
                    [ HeaderFooterFormatAtom -> FormatAtom HeaderFooterFormatAtom
forall a. a -> FormatAtom a
PlaceholderAtom HeaderFooterFormatAtom
HeaderFooterSuperTitleAtom
                    , String -> FormatAtom HeaderFooterFormatAtom
forall a. String -> FormatAtom a
StringAtom String
"\n"
                    ]
                )
            , FontSize
-> [FontStyle]
-> FormatString HeaderFooterFormatAtom
-> HeaderFooterItemFormat
HeaderFooterItemFormat
                FontSize
MediumFontSize
                []
                ([FormatAtom HeaderFooterFormatAtom]
-> FormatString HeaderFooterFormatAtom
forall a. [FormatAtom a] -> FormatString a
FormatString [HeaderFooterFormatAtom -> FormatAtom HeaderFooterFormatAtom
forall a. a -> FormatAtom a
PlaceholderAtom HeaderFooterFormatAtom
HeaderFooterTitleAtom])
            ]
            []
            [ FontSize
-> [FontStyle]
-> FormatString HeaderFooterFormatAtom
-> HeaderFooterItemFormat
HeaderFooterItemFormat
                FontSize
SmallFontSize
                []
                ( [FormatAtom HeaderFooterFormatAtom]
-> FormatString HeaderFooterFormatAtom
forall a. [FormatAtom a] -> FormatString a
FormatString
                    [String -> FormatAtom HeaderFooterFormatAtom
forall a. String -> FormatAtom a
StringAtom String
"(Keine amtliche Bekanntmachung)"]
                )
            ]

    footerFormat :: HeaderFooterFormat
footerFormat =
        [HeaderFooterItemFormat]
-> [HeaderFooterItemFormat]
-> [HeaderFooterItemFormat]
-> HeaderFooterFormat
HeaderFooterFormat
            [ FontSize
-> [FontStyle]
-> FormatString HeaderFooterFormatAtom
-> HeaderFooterItemFormat
HeaderFooterItemFormat
                FontSize
SmallFontSize
                []
                ( [FormatAtom HeaderFooterFormatAtom]
-> FormatString HeaderFooterFormatAtom
forall a. [FormatAtom a] -> FormatString a
FormatString
                    [ String -> FormatAtom HeaderFooterFormatAtom
forall a. String -> FormatAtom a
StringAtom String
"Stand: "
                    , HeaderFooterFormatAtom -> FormatAtom HeaderFooterFormatAtom
forall a. a -> FormatAtom a
PlaceholderAtom HeaderFooterFormatAtom
HeaderFooterDateAtom
                    ]
                )
            ]
            []
            [ FontSize
-> [FontStyle]
-> FormatString HeaderFooterFormatAtom
-> HeaderFooterItemFormat
HeaderFooterItemFormat
                FontSize
SmallFontSize
                []
                ( [FormatAtom HeaderFooterFormatAtom]
-> FormatString HeaderFooterFormatAtom
forall a. [FormatAtom a] -> FormatString a
FormatString
                    [ String -> FormatAtom HeaderFooterFormatAtom
forall a. String -> FormatAtom a
StringAtom String
"Seite "
                    , HeaderFooterFormatAtom -> FormatAtom HeaderFooterFormatAtom
forall a. a -> FormatAtom a
PlaceholderAtom HeaderFooterFormatAtom
HeaderFooterCurPageNumAtom
                    , String -> FormatAtom HeaderFooterFormatAtom
forall a. String -> FormatAtom a
StringAtom String
" / "
                    , HeaderFooterFormatAtom -> FormatAtom HeaderFooterFormatAtom
forall a. a -> FormatAtom a
PlaceholderAtom HeaderFooterFormatAtom
HeaderFooterLastPageNumAtom
                    ]
                )
            ]

appendixT :: NamedType AppendixSectionType
appendixT :: NamedType AppendixSectionType
appendixT =
    TypeName
-> DisplayTypeName
-> AppendixSectionType
-> NamedType AppendixSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"appendix" DisplayTypeName
"Anlagen" (AppendixSectionType -> NamedType AppendixSectionType)
-> AppendixSectionType -> NamedType AppendixSectionType
forall a b. (a -> b) -> a -> b
$
        AppendixSectionFormat
-> Star (Disjunction (NamedType DocumentType))
-> AppendixSectionType
AppendixSectionType
            ( AppendixSectionTitle
-> AppendixElementFormat -> AppendixSectionFormat
AppendixSectionFormat
                (Text -> AppendixSectionTitle
AppendixSectionTitle Text
"Anlagen")
                ( IdentifierFormat
-> TocKeyFormat -> InnerHeadingFormat -> AppendixElementFormat
AppendixElementFormat
                    ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                    ( KeyFormat -> TocKeyFormat
TocKeyFormat (KeyFormat -> TocKeyFormat) -> KeyFormat -> TocKeyFormat
forall a b. (a -> b) -> a -> b
$
                        [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"Anlage "
                            , KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                            ]
                    )
                    ( Typography
-> FormatString (HeadingPlaceholderAtom 'True)
-> InnerHeadingFormat
forall (permitIdentifier :: Bool).
Typography
-> FormatString (HeadingPlaceholderAtom permitIdentifier)
-> HeadingFormat permitIdentifier
HeadingFormat
                        (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
LargeFontSize [FontStyle
Bold])
                        ( [FormatAtom (HeadingPlaceholderAtom 'True)]
-> FormatString (HeadingPlaceholderAtom 'True)
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"Anlage "
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
IdentifierPlaceholder
                            , String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"\n"
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
forall (permitIdentifier :: Bool).
HeadingPlaceholderAtom permitIdentifier
HeadingTextPlaceholder
                            ]
                        )
                    )
                )
            )
            (Disjunction (NamedType DocumentType)
-> Star (Disjunction (NamedType DocumentType))
forall a. a -> Star a
Star (Disjunction (NamedType DocumentType)
 -> Star (Disjunction (NamedType DocumentType)))
-> Disjunction (NamedType DocumentType)
-> Star (Disjunction (NamedType DocumentType))
forall a b. (a -> b) -> a -> b
$ [NamedType DocumentType] -> Disjunction (NamedType DocumentType)
forall a. [a] -> Disjunction a
Disjunction [NamedType DocumentType
simpleDocT])

attachmentT :: NamedType AppendixSectionType
attachmentT :: NamedType AppendixSectionType
attachmentT =
    TypeName
-> DisplayTypeName
-> AppendixSectionType
-> NamedType AppendixSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"attachments" DisplayTypeName
"Anhänge" (AppendixSectionType -> NamedType AppendixSectionType)
-> AppendixSectionType -> NamedType AppendixSectionType
forall a b. (a -> b) -> a -> b
$
        AppendixSectionFormat
-> Star (Disjunction (NamedType DocumentType))
-> AppendixSectionType
AppendixSectionType
            ( AppendixSectionTitle
-> AppendixElementFormat -> AppendixSectionFormat
AppendixSectionFormat
                (Text -> AppendixSectionTitle
AppendixSectionTitle Text
"Anhänge")
                ( IdentifierFormat
-> TocKeyFormat -> InnerHeadingFormat -> AppendixElementFormat
AppendixElementFormat
                    ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                    ( KeyFormat -> TocKeyFormat
TocKeyFormat (KeyFormat -> TocKeyFormat) -> KeyFormat -> TocKeyFormat
forall a b. (a -> b) -> a -> b
$
                        [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"Anhang "
                            , KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                            ]
                    )
                    ( Typography
-> FormatString (HeadingPlaceholderAtom 'True)
-> InnerHeadingFormat
forall (permitIdentifier :: Bool).
Typography
-> FormatString (HeadingPlaceholderAtom permitIdentifier)
-> HeadingFormat permitIdentifier
HeadingFormat
                        (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
LargeFontSize [FontStyle
Bold])
                        ( [FormatAtom (HeadingPlaceholderAtom 'True)]
-> FormatString (HeadingPlaceholderAtom 'True)
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"Anhang "
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
IdentifierPlaceholder
                            , String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"\n"
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
forall (permitIdentifier :: Bool).
HeadingPlaceholderAtom permitIdentifier
HeadingTextPlaceholder
                            ]
                        )
                    )
                )
            )
            (Disjunction (NamedType DocumentType)
-> Star (Disjunction (NamedType DocumentType))
forall a. a -> Star a
Star (Disjunction (NamedType DocumentType)
 -> Star (Disjunction (NamedType DocumentType)))
-> Disjunction (NamedType DocumentType)
-> Star (Disjunction (NamedType DocumentType))
forall a b. (a -> b) -> a -> b
$ [NamedType DocumentType] -> Disjunction (NamedType DocumentType)
forall a. [a] -> Disjunction a
Disjunction [NamedType DocumentType
simpleDocT])

mainDocT :: NamedType DocumentType
mainDocT :: NamedType DocumentType
mainDocT =
    TypeName
-> DisplayTypeName -> DocumentType -> NamedType DocumentType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"fpo-maindoc" DisplayTypeName
"Fachprüfungsordnung (Hauptdokument)" (DocumentType -> NamedType DocumentType)
-> DocumentType -> NamedType DocumentType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> DocumentFormat
-> DocumentHeadingType
-> DocumentBodyType
-> Disjunction (NamedType FootnoteType)
-> DocumentType
DocumentType
            (Text -> Keyword
Keyword Text
"!")
            (Maybe TocFormat -> DocumentFormat
DocumentFormat (Maybe TocFormat -> DocumentFormat)
-> Maybe TocFormat -> DocumentFormat
forall a b. (a -> b) -> a -> b
$ TocFormat -> Maybe TocFormat
forall a. a -> Maybe a
Just (TocFormat -> Maybe TocFormat) -> TocFormat -> Maybe TocFormat
forall a b. (a -> b) -> a -> b
$ TocHeading -> TocFormat
TocFormat (TocHeading -> TocFormat) -> TocHeading -> TocFormat
forall a b. (a -> b) -> a -> b
$ Text -> TocHeading
TocHeading Text
"Inhaltsübersicht")
            (TextType Void -> DocumentHeadingType
DocumentHeadingType TextType Void
plainTextT)
            ( Maybe DocumentIntroType
-> Disjunction (NamedType DocumentMainBodyType)
-> Maybe DocumentExtroType
-> DocumentBodyType
DocumentBodyType
                ( DocumentIntroType -> Maybe DocumentIntroType
forall a. a -> Maybe a
Just (DocumentIntroType -> Maybe DocumentIntroType)
-> DocumentIntroType -> Maybe DocumentIntroType
forall a b. (a -> b) -> a -> b
$
                    Sequence (NamedType SimpleSectionType) -> DocumentIntroType
docIntroTF (Sequence (NamedType SimpleSectionType) -> DocumentIntroType)
-> Sequence (NamedType SimpleSectionType) -> DocumentIntroType
forall a b. (a -> b) -> a -> b
$
                        [NamedType SimpleSectionType]
-> Sequence (NamedType SimpleSectionType)
forall a. [a] -> Sequence a
Sequence
                            [ NamedType SimpleSectionType
dateSSecT
                            , NamedType SimpleSectionType
publLogSSecT
                            , NamedType SimpleSectionType
introSSecT
                            ]
                )
                ( [NamedType DocumentMainBodyType]
-> Disjunction (NamedType DocumentMainBodyType)
forall a. [a] -> Disjunction a
Disjunction
                    [ TypeName
-> DisplayTypeName
-> DocumentMainBodyType
-> NamedType DocumentMainBodyType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"fpo-mainbody-simple" DisplayTypeName
"Hauptteil (einfach)" (DocumentMainBodyType -> NamedType DocumentMainBodyType)
-> DocumentMainBodyType -> NamedType DocumentMainBodyType
forall a b. (a -> b) -> a -> b
$
                        SectionBodyType -> DocumentMainBodyType
docMainBodyTF (SectionBodyType -> DocumentMainBodyType)
-> SectionBodyType -> DocumentMainBodyType
forall a b. (a -> b) -> a -> b
$
                            Star (NamedType FormattedSectionType) -> SectionBodyType
InnerSectionBodyType (NamedType FormattedSectionType
-> Star (NamedType FormattedSectionType)
forall a. a -> Star a
Star NamedType FormattedSectionType
sectionT)
                    , TypeName
-> DisplayTypeName
-> DocumentMainBodyType
-> NamedType DocumentMainBodyType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType
                        TypeName
"fpo-mainbody-structured"
                        DisplayTypeName
"Hauptteil (mit Abschnitten)"
                        (DocumentMainBodyType -> NamedType DocumentMainBodyType)
-> DocumentMainBodyType -> NamedType DocumentMainBodyType
forall a b. (a -> b) -> a -> b
$ SectionBodyType -> DocumentMainBodyType
docMainBodyTF
                        (SectionBodyType -> DocumentMainBodyType)
-> SectionBodyType -> DocumentMainBodyType
forall a b. (a -> b) -> a -> b
$ Star (NamedType FormattedSectionType) -> SectionBodyType
InnerSectionBodyType (NamedType FormattedSectionType
-> Star (NamedType FormattedSectionType)
forall a. a -> Star a
Star NamedType FormattedSectionType
superSectionT)
                    ]
                )
                ( DocumentExtroType -> Maybe DocumentExtroType
forall a. a -> Maybe a
Just (DocumentExtroType -> Maybe DocumentExtroType)
-> DocumentExtroType -> Maybe DocumentExtroType
forall a b. (a -> b) -> a -> b
$
                    Sequence (NamedType SimpleSectionType) -> DocumentExtroType
docExtroTF (Sequence (NamedType SimpleSectionType) -> DocumentExtroType)
-> Sequence (NamedType SimpleSectionType) -> DocumentExtroType
forall a b. (a -> b) -> a -> b
$
                        [NamedType SimpleSectionType]
-> Sequence (NamedType SimpleSectionType)
forall a. [a] -> Sequence a
Sequence
                            [ NamedType SimpleSectionType
extroSSecT
                            , NamedType SimpleSectionType
legalLogSSecT
                            ]
                )
            )
            ([NamedType FootnoteType] -> Disjunction (NamedType FootnoteType)
forall a. [a] -> Disjunction a
Disjunction [NamedType FootnoteType
footnoteT])

simpleDocT :: NamedType DocumentType
simpleDocT :: NamedType DocumentType
simpleDocT =
    TypeName
-> DisplayTypeName -> DocumentType -> NamedType DocumentType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"simpledoc" DisplayTypeName
"Einfaches Textdokument" (DocumentType -> NamedType DocumentType)
-> DocumentType -> NamedType DocumentType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> DocumentFormat
-> DocumentHeadingType
-> DocumentBodyType
-> Disjunction (NamedType FootnoteType)
-> DocumentType
DocumentType
            (Text -> Keyword
Keyword Text
"!")
            (Maybe TocFormat -> DocumentFormat
DocumentFormat Maybe TocFormat
forall a. Maybe a
Nothing)
            (TextType Void -> DocumentHeadingType
DocumentHeadingType TextType Void
plainTextT)
            ( Maybe DocumentIntroType
-> Disjunction (NamedType DocumentMainBodyType)
-> Maybe DocumentExtroType
-> DocumentBodyType
DocumentBodyType
                Maybe DocumentIntroType
forall a. Maybe a
Nothing
                ( [NamedType DocumentMainBodyType]
-> Disjunction (NamedType DocumentMainBodyType)
forall a. [a] -> Disjunction a
Disjunction
                    [ TypeName
-> DisplayTypeName
-> DocumentMainBodyType
-> NamedType DocumentMainBodyType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"simpledoc-mainbody" DisplayTypeName
"Hauptteil" (DocumentMainBodyType -> NamedType DocumentMainBodyType)
-> DocumentMainBodyType -> NamedType DocumentMainBodyType
forall a b. (a -> b) -> a -> b
$
                        SectionBodyType -> DocumentMainBodyType
docMainBodyTF (SectionBodyType -> DocumentMainBodyType)
-> SectionBodyType -> DocumentMainBodyType
forall a b. (a -> b) -> a -> b
$
                            Star (NamedType SimpleBlockType) -> SectionBodyType
SimpleLeafSectionBodyType (NamedType SimpleBlockType -> Star (NamedType SimpleBlockType)
forall a. a -> Star a
Star NamedType SimpleBlockType
simpleBlockT)
                    ]
                )
                Maybe DocumentExtroType
forall a. Maybe a
Nothing
            )
            ([NamedType FootnoteType] -> Disjunction (NamedType FootnoteType)
forall a. [a] -> Disjunction a
Disjunction [NamedType FootnoteType
footnoteT])

docMainBodyTF :: SectionBodyType -> DocumentMainBodyType
docMainBodyTF :: SectionBodyType -> DocumentMainBodyType
docMainBodyTF =
    NavTocHeading -> SectionBodyType -> DocumentMainBodyType
DocumentMainBodyType
        (Text -> NavTocHeading
NavTocHeading Text
"Hauptteil")

docIntroTF :: Sequence (NamedType SimpleSectionType) -> DocumentIntroType
docIntroTF :: Sequence (NamedType SimpleSectionType) -> DocumentIntroType
docIntroTF =
    NavTocHeading
-> Sequence (NamedType SimpleSectionType) -> DocumentIntroType
DocumentIntroType
        (Text -> NavTocHeading
NavTocHeading Text
"Intro")

docExtroTF :: Sequence (NamedType SimpleSectionType) -> DocumentExtroType
docExtroTF :: Sequence (NamedType SimpleSectionType) -> DocumentExtroType
docExtroTF =
    NavTocHeading
-> Sequence (NamedType SimpleSectionType) -> DocumentExtroType
DocumentExtroType
        (Text -> NavTocHeading
NavTocHeading Text
"Extro")

dateSSecT :: NamedType SimpleSectionType
dateSSecT :: NamedType SimpleSectionType
dateSSecT =
    TypeName
-> DisplayTypeName
-> SimpleSectionType
-> NamedType SimpleSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"date" DisplayTypeName
"Datumsabschnitt" (SimpleSectionType -> NamedType SimpleSectionType)
-> SimpleSectionType -> NamedType SimpleSectionType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> SimpleSectionFormat
-> Star (NamedType SimpleParagraphType)
-> SimpleSectionType
SimpleSectionType
            (Text -> Keyword
Keyword Text
"[date]")
            SimpleSectionFormat {ssHasPrecedingHorizontalBar :: Bool
ssHasPrecedingHorizontalBar = Bool
False}
            (NamedType SimpleParagraphType
-> Star (NamedType SimpleParagraphType)
forall a. a -> Star a
Star (TextAlignment -> FontSize -> NamedType SimpleParagraphType
simpleParagraphTF TextAlignment
Centered FontSize
LargeFontSize))

publLogSSecT :: NamedType SimpleSectionType
publLogSSecT :: NamedType SimpleSectionType
publLogSSecT =
    TypeName
-> DisplayTypeName
-> SimpleSectionType
-> NamedType SimpleSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"publ_log" DisplayTypeName
"Veröffentlichungshistorie" (SimpleSectionType -> NamedType SimpleSectionType)
-> SimpleSectionType -> NamedType SimpleSectionType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> SimpleSectionFormat
-> Star (NamedType SimpleParagraphType)
-> SimpleSectionType
SimpleSectionType
            (Text -> Keyword
Keyword Text
"[publ_log]")
            SimpleSectionFormat {ssHasPrecedingHorizontalBar :: Bool
ssHasPrecedingHorizontalBar = Bool
False}
            (NamedType SimpleParagraphType
-> Star (NamedType SimpleParagraphType)
forall a. a -> Star a
Star (TextAlignment -> FontSize -> NamedType SimpleParagraphType
simpleParagraphTF TextAlignment
LeftAligned FontSize
SmallFontSize))

introSSecT :: NamedType SimpleSectionType
introSSecT :: NamedType SimpleSectionType
introSSecT =
    TypeName
-> DisplayTypeName
-> SimpleSectionType
-> NamedType SimpleSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"intro" DisplayTypeName
"Einleitung" (SimpleSectionType -> NamedType SimpleSectionType)
-> SimpleSectionType -> NamedType SimpleSectionType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> SimpleSectionFormat
-> Star (NamedType SimpleParagraphType)
-> SimpleSectionType
SimpleSectionType
            (Text -> Keyword
Keyword Text
"[intro]")
            SimpleSectionFormat {ssHasPrecedingHorizontalBar :: Bool
ssHasPrecedingHorizontalBar = Bool
False}
            (NamedType SimpleParagraphType
-> Star (NamedType SimpleParagraphType)
forall a. a -> Star a
Star NamedType SimpleParagraphType
simpleParagraphT)

extroSSecT :: NamedType SimpleSectionType
extroSSecT :: NamedType SimpleSectionType
extroSSecT =
    TypeName
-> DisplayTypeName
-> SimpleSectionType
-> NamedType SimpleSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"extro" DisplayTypeName
"Schluss" (SimpleSectionType -> NamedType SimpleSectionType)
-> SimpleSectionType -> NamedType SimpleSectionType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> SimpleSectionFormat
-> Star (NamedType SimpleParagraphType)
-> SimpleSectionType
SimpleSectionType
            (Text -> Keyword
Keyword Text
"[extro]")
            SimpleSectionFormat {ssHasPrecedingHorizontalBar :: Bool
ssHasPrecedingHorizontalBar = Bool
False}
            (NamedType SimpleParagraphType
-> Star (NamedType SimpleParagraphType)
forall a. a -> Star a
Star NamedType SimpleParagraphType
simpleParagraphT)

legalLogSSecT :: NamedType SimpleSectionType
legalLogSSecT :: NamedType SimpleSectionType
legalLogSSecT =
    TypeName
-> DisplayTypeName
-> SimpleSectionType
-> NamedType SimpleSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"legal_log" DisplayTypeName
"Rechtliche Historie" (SimpleSectionType -> NamedType SimpleSectionType)
-> SimpleSectionType -> NamedType SimpleSectionType
forall a b. (a -> b) -> a -> b
$
        Keyword
-> SimpleSectionFormat
-> Star (NamedType SimpleParagraphType)
-> SimpleSectionType
SimpleSectionType
            (Text -> Keyword
Keyword Text
"[legal_log]")
            SimpleSectionFormat {ssHasPrecedingHorizontalBar :: Bool
ssHasPrecedingHorizontalBar = Bool
True}
            (NamedType SimpleParagraphType
-> Star (NamedType SimpleParagraphType)
forall a. a -> Star a
Star NamedType SimpleParagraphType
simpleParagraphT)

superSectionT :: NamedType FormattedSectionType
superSectionT :: NamedType FormattedSectionType
superSectionT =
    TypeName
-> DisplayTypeName
-> FormattedSectionType
-> NamedType FormattedSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"supersection" DisplayTypeName
"Abschnitt" (FormattedSectionType -> NamedType FormattedSectionType)
-> FormattedSectionType -> NamedType FormattedSectionType
forall a b. (a -> b) -> a -> b
$
        SectionFormat -> SectionType -> SectionFormatted SectionType
forall a. SectionFormat -> a -> SectionFormatted a
SectionFormatted
            ( IdentifierFormat -> TocKeyFormat -> Bool -> SectionFormat
SectionFormat
                ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                ( KeyFormat -> TocKeyFormat
TocKeyFormat (KeyFormat -> TocKeyFormat) -> KeyFormat -> TocKeyFormat
forall a b. (a -> b) -> a -> b
$
                    [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                        [ String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"Abschnitt "
                        , KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                        ]
                )
                Bool
False
            )
            ( Keyword -> HeadingType -> SectionBodyType -> SectionType
SectionType
                (Text -> Keyword
Keyword Text
"=")
                ( InnerHeadingFormat -> TextType Void -> HeadingType
HeadingType
                    ( Typography
-> FormatString (HeadingPlaceholderAtom 'True)
-> InnerHeadingFormat
forall (permitIdentifier :: Bool).
Typography
-> FormatString (HeadingPlaceholderAtom permitIdentifier)
-> HeadingFormat permitIdentifier
HeadingFormat
                        (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
MediumFontSize [FontStyle
Bold])
                        ( [FormatAtom (HeadingPlaceholderAtom 'True)]
-> FormatString (HeadingPlaceholderAtom 'True)
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"Abschnitt "
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
IdentifierPlaceholder
                            , String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
" "
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
forall (permitIdentifier :: Bool).
HeadingPlaceholderAtom permitIdentifier
HeadingTextPlaceholder
                            ]
                        )
                    )
                    TextType Void
plainTextT
                )
                (Star (NamedType FormattedSectionType) -> SectionBodyType
InnerSectionBodyType (NamedType FormattedSectionType
-> Star (NamedType FormattedSectionType)
forall a. a -> Star a
Star NamedType FormattedSectionType
sectionT))
            )
            SectionFormatted SectionType
-> [SectionFormatted SectionType] -> FormattedSectionType
forall a. a -> [a] -> NonEmpty a
:| []

sectionT :: NamedType FormattedSectionType
sectionT :: NamedType FormattedSectionType
sectionT =
    TypeName
-> DisplayTypeName
-> FormattedSectionType
-> NamedType FormattedSectionType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"section" DisplayTypeName
"Paragraph" (FormattedSectionType -> NamedType FormattedSectionType)
-> FormattedSectionType -> NamedType FormattedSectionType
forall a b. (a -> b) -> a -> b
$
        SectionFormat -> SectionType -> SectionFormatted SectionType
forall a. SectionFormat -> a -> SectionFormatted a
SectionFormatted
            ( IdentifierFormat -> TocKeyFormat -> Bool -> SectionFormat
SectionFormat
                ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                ( KeyFormat -> TocKeyFormat
TocKeyFormat (KeyFormat -> TocKeyFormat) -> KeyFormat -> TocKeyFormat
forall a b. (a -> b) -> a -> b
$
                    [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                        [ String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"§ "
                        , KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                        ]
                )
                Bool
False
            )
            ( Keyword -> HeadingType -> SectionBodyType -> SectionType
SectionType
                (Text -> Keyword
Keyword Text
"§")
                ( InnerHeadingFormat -> TextType Void -> HeadingType
HeadingType
                    ( Typography
-> FormatString (HeadingPlaceholderAtom 'True)
-> InnerHeadingFormat
forall (permitIdentifier :: Bool).
Typography
-> FormatString (HeadingPlaceholderAtom permitIdentifier)
-> HeadingFormat permitIdentifier
HeadingFormat
                        (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
Centered FontSize
MediumFontSize [FontStyle
Bold])
                        ( [FormatAtom (HeadingPlaceholderAtom 'True)]
-> FormatString (HeadingPlaceholderAtom 'True)
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"§ "
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
IdentifierPlaceholder
                            , String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"\n"
                            , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
forall (permitIdentifier :: Bool).
HeadingPlaceholderAtom permitIdentifier
HeadingTextPlaceholder
                            ]
                        )
                    )
                    TextType Void
plainTextT
                )
                (Star (NamedType ParagraphType) -> SectionBodyType
LeafSectionBodyType (NamedType ParagraphType -> Star (NamedType ParagraphType)
forall a. a -> Star a
Star NamedType ParagraphType
paragraphT))
            )
            SectionFormatted SectionType
-> [SectionFormatted SectionType] -> FormattedSectionType
forall a. a -> [a] -> NonEmpty a
:| [
                 -- Alternative section format for inserted sections
                 SectionFormat -> SectionType -> SectionFormatted SectionType
forall a. SectionFormat -> a -> SectionFormatted a
SectionFormatted
                    ( IdentifierFormat -> TocKeyFormat -> Bool -> SectionFormat
SectionFormat
                        ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic, EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
InsertedPlaceholderAtom EnumStyle
AlphabeticLower])
                        ( KeyFormat -> TocKeyFormat
TocKeyFormat (KeyFormat -> TocKeyFormat) -> KeyFormat -> TocKeyFormat
forall a b. (a -> b) -> a -> b
$
                            [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                                [ String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"§ "
                                , KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                                ]
                        )
                        Bool
True
                    )
                    ( Keyword -> HeadingType -> SectionBodyType -> SectionType
SectionType
                        (Text -> Keyword
Keyword Text
"§*")
                        ( InnerHeadingFormat -> TextType Void -> HeadingType
HeadingType
                            ( Typography
-> FormatString (HeadingPlaceholderAtom 'True)
-> InnerHeadingFormat
forall (permitIdentifier :: Bool).
Typography
-> FormatString (HeadingPlaceholderAtom permitIdentifier)
-> HeadingFormat permitIdentifier
HeadingFormat
                                (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
Centered FontSize
MediumFontSize [FontStyle
Bold])
                                ( [FormatAtom (HeadingPlaceholderAtom 'True)]
-> FormatString (HeadingPlaceholderAtom 'True)
forall a. [FormatAtom a] -> FormatString a
FormatString
                                    [ String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"§ "
                                    , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
IdentifierPlaceholder
                                    , String -> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. String -> FormatAtom a
StringAtom String
"\n"
                                    , HeadingPlaceholderAtom 'True
-> FormatAtom (HeadingPlaceholderAtom 'True)
forall a. a -> FormatAtom a
PlaceholderAtom HeadingPlaceholderAtom 'True
forall (permitIdentifier :: Bool).
HeadingPlaceholderAtom permitIdentifier
HeadingTextPlaceholder
                                    ]
                                )
                            )
                            TextType Void
plainTextT
                        )
                        (Star (NamedType ParagraphType) -> SectionBodyType
LeafSectionBodyType (NamedType ParagraphType -> Star (NamedType ParagraphType)
forall a. a -> Star a
Star NamedType ParagraphType
paragraphT))
                    )
               ]

paragraphT :: NamedType ParagraphType
paragraphT :: NamedType ParagraphType
paragraphT =
    TypeName
-> DisplayTypeName -> ParagraphType -> NamedType ParagraphType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"paragraph" DisplayTypeName
"Absatz" (ParagraphType -> NamedType ParagraphType)
-> ParagraphType -> NamedType ParagraphType
forall a b. (a -> b) -> a -> b
$
        ParagraphFormat -> TextType EnumType -> ParagraphType
ParagraphType
            ( IdentifierFormat -> ParagraphKeyFormat -> ParagraphFormat
ParagraphFormat
                ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                ( KeyFormat -> ParagraphKeyFormat
ParagraphKeyFormat (KeyFormat -> ParagraphKeyFormat)
-> KeyFormat -> ParagraphKeyFormat
forall a b. (a -> b) -> a -> b
$
                    [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                        [ String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"("
                        , KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                        , String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
")"
                        ]
                )
            )
            TextType EnumType
richTextT

simpleBlockT :: NamedType SimpleBlockType
simpleBlockT :: NamedType SimpleBlockType
simpleBlockT =
    TypeName
-> DisplayTypeName -> SimpleBlockType -> NamedType SimpleBlockType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"simple_block" DisplayTypeName
"Einfacher Block" (SimpleBlockType -> NamedType SimpleBlockType)
-> SimpleBlockType -> NamedType SimpleBlockType
forall a b. (a -> b) -> a -> b
$
        NamedType SimpleParagraphType
-> NamedType TableType
-> NamedType ModuleBlockType
-> SimpleBlockType
SimpleBlockType NamedType SimpleParagraphType
simpleParagraphT NamedType TableType
tableT NamedType ModuleBlockType
moduleBlockT

simpleParagraphT :: NamedType SimpleParagraphType
simpleParagraphT :: NamedType SimpleParagraphType
simpleParagraphT = TextAlignment -> FontSize -> NamedType SimpleParagraphType
simpleParagraphTF TextAlignment
LeftAligned FontSize
MediumFontSize

simpleParagraphTF
    :: TextAlignment
    -> FontSize
    -> NamedType SimpleParagraphType
simpleParagraphTF :: TextAlignment -> FontSize -> NamedType SimpleParagraphType
simpleParagraphTF TextAlignment
alignment FontSize
fsize =
    TypeName
-> DisplayTypeName
-> SimpleParagraphType
-> NamedType SimpleParagraphType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
typeName DisplayTypeName
displayName (SimpleParagraphType -> NamedType SimpleParagraphType)
-> SimpleParagraphType -> NamedType SimpleParagraphType
forall a b. (a -> b) -> a -> b
$
        SimpleParagraphFormat -> TextType EnumType -> SimpleParagraphType
SimpleParagraphType
            (Typography -> SimpleParagraphFormat
SimpleParagraphFormat (Typography -> SimpleParagraphFormat)
-> Typography -> SimpleParagraphFormat
forall a b. (a -> b) -> a -> b
$ TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
alignment FontSize
fsize [])
            TextType EnumType
simpleTextT
  where
    typeName :: TypeName
typeName =
        String -> TypeName
TypeName (String -> TypeName) -> String -> TypeName
forall a b. (a -> b) -> a -> b
$
            String
"simple_paragraph_"
                String -> String -> String
forall a. [a] -> [a] -> [a]
++ (Char -> Char) -> String -> String
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower (TextAlignment -> String
forall a. Show a => a -> String
show TextAlignment
alignment)
                String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"_"
                String -> String -> String
forall a. [a] -> [a] -> [a]
++ (Char -> Char) -> String -> String
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower (FontSize -> String
forall a. Show a => a -> String
show FontSize
fsize)
    displayName :: DisplayTypeName
displayName =
        String -> DisplayTypeName
DisplayTypeName (String -> DisplayTypeName) -> String -> DisplayTypeName
forall a b. (a -> b) -> a -> b
$
            String
"Einfacher Absatz (" String -> String -> String
forall a. [a] -> [a] -> [a]
++ TextAlignment -> String
forall a. Show a => a -> String
show TextAlignment
alignment String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", " String -> String -> String
forall a. [a] -> [a] -> [a]
++ FontSize -> String
forall a. Show a => a -> String
show FontSize
fsize String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"

tableT :: NamedType TableType
tableT :: NamedType TableType
tableT =
    TypeName -> DisplayTypeName -> TableType -> NamedType TableType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"table" DisplayTypeName
"Tabelle" (TableType -> NamedType TableType)
-> TableType -> NamedType TableType
forall a b. (a -> b) -> a -> b
$
        Keyword -> DefaultCellType -> Star RowType -> TableType
TableType (Text -> Keyword
Keyword Text
"|") (CellType -> DefaultCellType
DefaultCellType CellType
cellTypeT) (RowType -> Star RowType
forall a. a -> Star a
Star RowType
rowTypeT)
  where
    rowTypeT :: RowType
    rowTypeT :: RowType
rowTypeT = Keyword -> Star (Disjunction CellType) -> RowType
RowType (Text -> Keyword
Keyword Text
"&") (Disjunction CellType -> Star (Disjunction CellType)
forall a. a -> Star a
Star ([CellType] -> Disjunction CellType
forall a. [a] -> Disjunction a
Disjunction [CellType
hcellTypeT]))

    cellTypeT :: CellType
    cellTypeT :: CellType
cellTypeT =
        Keyword -> CellFormat -> TextType Void -> CellType
CellType
            (Text -> Keyword
Keyword Text
"")
            ( BGColor -> Typography -> CellFormat
CellFormat
                BGColor
White
                (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
MediumFontSize [])
            )
            TextType Void
plainTextT

    hcellTypeT :: CellType
    hcellTypeT :: CellType
hcellTypeT =
        Keyword -> CellFormat -> TextType Void -> CellType
CellType
            (Text -> Keyword
Keyword Text
"*")
            ( BGColor -> Typography -> CellFormat
CellFormat
                BGColor
Gray
                (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
LargeFontSize [])
            )
            TextType Void
plainTextT

moduleBlockT :: NamedType ModuleBlockType
moduleBlockT :: NamedType ModuleBlockType
moduleBlockT =
    TypeName
-> DisplayTypeName -> ModuleBlockType -> NamedType ModuleBlockType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"module_block" DisplayTypeName
"Modulblock" (ModuleBlockType -> NamedType ModuleBlockType)
-> ModuleBlockType -> NamedType ModuleBlockType
forall a b. (a -> b) -> a -> b
$
        TextType Void
-> ModuleSchemaType -> CategoryType -> ModuleBlockType
ModuleBlockType
            (Disjunction (NamedType Void) -> TextType Void
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType Void] -> Disjunction (NamedType Void)
forall a. [a] -> Disjunction a
Disjunction []))
            (Keyword -> CellFormat -> ModuleSchemaType
ModuleSchemaType (Text -> Keyword
Keyword Text
"schema:") CellFormat
schemaCellFormat)
            ( Keyword -> CellFormat -> ModuleType -> CategoryType
CategoryType
                (Text -> Keyword
Keyword Text
"category:")
                CellFormat
categoryCellFormat
                (Keyword -> CellFormat -> ModuleType
ModuleType (Text -> Keyword
Keyword Text
"module:") CellFormat
moduleCellFormat)
            )
  where
    schemaCellFormat :: CellFormat
schemaCellFormat = BGColor -> Typography -> CellFormat
CellFormat BGColor
Gray (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
MediumFontSize [FontStyle
Bold])
    categoryCellFormat :: CellFormat
categoryCellFormat = BGColor -> Typography -> CellFormat
CellFormat BGColor
White (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
LeftAligned FontSize
MediumFontSize [FontStyle
Bold])
    moduleCellFormat :: CellFormat
moduleCellFormat = BGColor -> Typography -> CellFormat
CellFormat BGColor
White (TextAlignment -> FontSize -> [FontStyle] -> Typography
Typography TextAlignment
Centered FontSize
MediumFontSize [])

plainTextT :: TextType Void
plainTextT :: TextType Void
plainTextT = Disjunction (NamedType Void) -> TextType Void
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType Void] -> Disjunction (NamedType Void)
forall a. [a] -> Disjunction a
Disjunction [])

richTextT :: TextType EnumType
richTextT :: TextType EnumType
richTextT = Disjunction (NamedType EnumType) -> TextType EnumType
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType EnumType] -> Disjunction (NamedType EnumType)
forall a. [a] -> Disjunction a
Disjunction [NamedType EnumType
regularEnumT, NamedType EnumType
simpleEnumT])

simpleTextT :: TextType EnumType
simpleTextT :: TextType EnumType
simpleTextT = Disjunction (NamedType EnumType) -> TextType EnumType
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType EnumType] -> Disjunction (NamedType EnumType)
forall a. [a] -> Disjunction a
Disjunction [])

footnoteTextT :: TextType Void
footnoteTextT :: TextType Void
footnoteTextT = TextType Void
plainTextT

-- Enum rules:
--  - Max. 4 levels of regular enums ("1. (a) (aa) (aaa)").
--  - Simple enums ("-") may only occur as leafs.
--    - I.e., they may not contain *any* sub-enums (including simple enums).

maxRegularEnumDepth :: Int
maxRegularEnumDepth :: Int
maxRegularEnumDepth = Int
3

regularEnumT :: NamedType EnumType
regularEnumT :: NamedType EnumType
regularEnumT =
    TypeName -> DisplayTypeName -> EnumType -> NamedType EnumType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"regular_enum" DisplayTypeName
"Nummerierte Aufzählung" (EnumType -> NamedType EnumType) -> EnumType -> NamedType EnumType
forall a b. (a -> b) -> a -> b
$
        Keyword -> EnumFormat -> TextType EnumType -> EnumType
EnumType
            (Text -> Keyword
Keyword Text
"#")
            ( EnumItemFormat -> EnumFormat
EnumFormat (EnumItemFormat -> EnumFormat) -> EnumItemFormat -> EnumFormat
forall a b. (a -> b) -> a -> b
$
                IdentifierFormat -> EnumItemKeyFormat -> EnumItemFormat
EnumItemFormat
                    ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                    ( KeyFormat -> EnumItemKeyFormat
EnumItemKeyFormat (KeyFormat -> EnumItemKeyFormat) -> KeyFormat -> EnumItemKeyFormat
forall a b. (a -> b) -> a -> b
$
                        [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                            [ KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                            , String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"."
                            ]
                    )
            )
            (Disjunction (NamedType EnumType) -> TextType EnumType
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType EnumType] -> Disjunction (NamedType EnumType)
forall a. [a] -> Disjunction a
Disjunction [Int -> NamedType EnumType
enumTF Int
1, NamedType EnumType
simpleEnumT]))
  where
    enumTF :: Int -> NamedType EnumType
    enumTF :: Int -> NamedType EnumType
enumTF Int
depth =
        TypeName -> DisplayTypeName -> EnumType -> NamedType EnumType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
typeName DisplayTypeName
displayName (EnumType -> NamedType EnumType) -> EnumType -> NamedType EnumType
forall a b. (a -> b) -> a -> b
$
            Keyword -> EnumFormat -> TextType EnumType -> EnumType
EnumType
                (Text -> Keyword
Keyword Text
"#")
                ( EnumItemFormat -> EnumFormat
EnumFormat (EnumItemFormat -> EnumFormat) -> EnumItemFormat -> EnumFormat
forall a b. (a -> b) -> a -> b
$
                    IdentifierFormat -> EnumItemKeyFormat -> EnumItemFormat
EnumItemFormat
                        ( [FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString ([FormatAtom EnumStyle] -> IdentifierFormat)
-> [FormatAtom EnumStyle] -> IdentifierFormat
forall a b. (a -> b) -> a -> b
$
                            Int -> FormatAtom EnumStyle -> [FormatAtom EnumStyle]
forall a. Int -> a -> [a]
replicate Int
depth (EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
AlphabeticLower)
                        )
                        ( KeyFormat -> EnumItemKeyFormat
EnumItemKeyFormat (KeyFormat -> EnumItemKeyFormat) -> KeyFormat -> EnumItemKeyFormat
forall a b. (a -> b) -> a -> b
$
                            [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString
                                [ KeyPlaceholderAtom -> FormatAtom KeyPlaceholderAtom
forall a. a -> FormatAtom a
PlaceholderAtom KeyPlaceholderAtom
KeyIdentifierPlaceholder
                                , String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
")"
                                ]
                        )
                )
                (Disjunction (NamedType EnumType) -> TextType EnumType
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType EnumType] -> Disjunction (NamedType EnumType)
forall a. [a] -> Disjunction a
Disjunction [NamedType EnumType]
nextEnumTs))
      where
        typeName :: TypeName
typeName = String -> TypeName
TypeName (String -> TypeName) -> String -> TypeName
forall a b. (a -> b) -> a -> b
$ String
"regular_enum_" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
depth
        displayName :: DisplayTypeName
displayName =
            String -> DisplayTypeName
DisplayTypeName (String -> DisplayTypeName) -> String -> DisplayTypeName
forall a b. (a -> b) -> a -> b
$
                String
"Nummerierte Aufzählung (Tiefe " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
depth String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"

        nextEnumTs :: [NamedType EnumType]
nextEnumTs =
            if Int
depth Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
maxRegularEnumDepth
                then [Int -> NamedType EnumType
enumTF (Int
depth Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1), NamedType EnumType
simpleEnumT]
                else [NamedType EnumType
simpleEnumT]

simpleEnumT :: NamedType EnumType
simpleEnumT :: NamedType EnumType
simpleEnumT =
    TypeName -> DisplayTypeName -> EnumType -> NamedType EnumType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"simple_enum" DisplayTypeName
"Strichpunkt-Aufzählung" (EnumType -> NamedType EnumType) -> EnumType -> NamedType EnumType
forall a b. (a -> b) -> a -> b
$
        Keyword -> EnumFormat -> TextType EnumType -> EnumType
EnumType
            (Text -> Keyword
Keyword Text
"-")
            ( EnumItemFormat -> EnumFormat
EnumFormat (EnumItemFormat -> EnumFormat) -> EnumItemFormat -> EnumFormat
forall a b. (a -> b) -> a -> b
$
                IdentifierFormat -> EnumItemKeyFormat -> EnumItemFormat
EnumItemFormat
                    ([FormatAtom EnumStyle] -> IdentifierFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [EnumStyle -> FormatAtom EnumStyle
forall a. a -> FormatAtom a
PlaceholderAtom EnumStyle
Arabic])
                    (KeyFormat -> EnumItemKeyFormat
EnumItemKeyFormat (KeyFormat -> EnumItemKeyFormat) -> KeyFormat -> EnumItemKeyFormat
forall a b. (a -> b) -> a -> b
$ [FormatAtom KeyPlaceholderAtom] -> KeyFormat
forall a. [FormatAtom a] -> FormatString a
FormatString [String -> FormatAtom KeyPlaceholderAtom
forall a. String -> FormatAtom a
StringAtom String
"-"])
            )
            (Disjunction (NamedType EnumType) -> TextType EnumType
forall enumT. Disjunction (NamedType enumT) -> TextType enumT
TextType ([NamedType EnumType] -> Disjunction (NamedType EnumType)
forall a. [a] -> Disjunction a
Disjunction []))

footnoteT :: NamedType FootnoteType
footnoteT :: NamedType FootnoteType
footnoteT =
    TypeName
-> DisplayTypeName -> FootnoteType -> NamedType FootnoteType
forall t. TypeName -> DisplayTypeName -> t -> NamedType t
NamedType TypeName
"footnote" DisplayTypeName
"Fußnote" (FootnoteType -> NamedType FootnoteType)
-> FootnoteType -> NamedType FootnoteType
forall a b. (a -> b) -> a -> b
$
        Keyword -> FootnoteFormat -> TextType Void -> FootnoteType
FootnoteType (Text -> Keyword
Keyword Text
"^") FootnoteFormat
SuperscriptFootnoteFormat TextType Void
footnoteTextT