Copyright | Copyright (C) 2022-2023 John MacFarlane |
---|---|
License | GNU GPL, version 2 or above |
Maintainer | John MacFarlane <jgm@berkeley.edu> |
Stability | alpha |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Functions and types for splitting a Pandoc into subdocuments, e.g. for conversion into a set of HTML pages.
Synopsis
- data Chunk = Chunk {
- chunkHeading :: [Inline]
- chunkId :: Text
- chunkLevel :: Int
- chunkNumber :: Int
- chunkSectionNumber :: Maybe Text
- chunkPath :: FilePath
- chunkUp :: Maybe Chunk
- chunkPrev :: Maybe Chunk
- chunkNext :: Maybe Chunk
- chunkUnlisted :: Bool
- chunkContents :: [Block]
- data ChunkedDoc = ChunkedDoc {
- chunkedMeta :: Meta
- chunkedTOC :: Tree SecInfo
- chunkedChunks :: [Chunk]
- newtype PathTemplate = PathTemplate {}
- splitIntoChunks :: PathTemplate -> Bool -> Maybe Int -> Int -> Pandoc -> ChunkedDoc
- toTOCTree :: [Block] -> Tree SecInfo
- tocToList :: Bool -> Int -> Tree SecInfo -> Block
- data SecInfo = SecInfo {}
Documentation
A part of a document (typically a chapter or section, or the part of a section before its subsections).
Chunk | |
|
Instances
data ChunkedDoc Source #
A Pandoc
broken into Chunk
s for writing to separate files.
ChunkedDoc | |
|
Instances
newtype PathTemplate Source #
A PathTemplate
is a FilePath in which certain codes
will be substituted with information from a Chunk
.
%n
will be replaced with the chunk number
(padded with leading 0s to 3 digits),
%s
with the section number of the heading,
%h
with the (stringified) heading text,
%i
with the section identifier.
For example, "section-%s-%i.html"
might be resolved to
"section-1.2-introduction.html"
.
Instances
:: PathTemplate | Template for filepath |
-> Bool | Number sections |
-> Maybe Int | Base heading level |
-> Int | Chunk level -- level of section to split at |
-> Pandoc | |
-> ChunkedDoc |
Split Pandoc
into Chunk
s, e.g. for conversion into
a set of HTML pages or EPUB chapters.
toTOCTree :: [Block] -> Tree SecInfo Source #
Create tree of sections with titles, links, and numbers,
in a form that can be turned into a table of contents.
Presupposes that the '[Block]' is the output of makeSections
.
tocToList :: Bool -> Int -> Tree SecInfo -> Block Source #
Generate a table of contents of the given depth.
Data for a section in a hierarchical document.
Instances
Generic SecInfo Source # | |
Show SecInfo Source # | |
Eq SecInfo Source # | |
Walkable Inline SecInfo Source # | |
type Rep SecInfo Source # | |
Defined in Text.Pandoc.Chunks type Rep SecInfo = D1 ('MetaData "SecInfo" "Text.Pandoc.Chunks" "pandoc-3.1.1-inplace" 'False) (C1 ('MetaCons "SecInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "secTitle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Inline]) :*: S1 ('MetaSel ('Just "secNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "secId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "secPath") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "secLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))) |