git.iko.soy/typeable/pandoc
on master help sign in
+ Introduced writerIgnoreNotes option in WriterOptions. This is needed
f2b16c2fiddlosopher
src/Main.hs+1
@@ -482,6 +482,7 @@ main = do
482 writerTableOfContents = toc &&
482 writerTableOfContents = toc &&
483 (not strict),
483 (not strict),
484 writerS5 = (writerName=="s5"),
484 writerS5 = (writerName=="s5"),
485+ writerIgnoreNotes = False,
485 writerIncremental = incremental,
486 writerIncremental = incremental,
486 writerNumberSections = numberSections,
487 writerNumberSections = numberSections,
487 writerIncludeBefore = includeBefore,
488 writerIncludeBefore = includeBefore,
src/Text/Pandoc/Shared.hs+25
@@ -61,6 +61,8 @@ module Text.Pandoc.Shared (
61 -- * Pandoc block and inline list processing
61 -- * Pandoc block and inline list processing
62 normalizeSpaces,
62 normalizeSpaces,
63 compactify,
63 compactify,
64+ Element (..),
65+ hierarchicalize,
64 -- * Writer options
66 -- * Writer options
65 WriterOptions (..),
67 WriterOptions (..),
66 defaultWriterOptions,
68 defaultWriterOptions,
@@ -368,6 +370,26 @@ containsPara ((OrderedList items):rest) = (any containsPara items) ||
368 (containsPara rest)
370 (containsPara rest)
369containsPara (x:rest) = containsPara rest
371containsPara (x:rest) = containsPara rest
370
372
373+-- | Data structure for defining hierarchical Pandoc documents
374+data Element = Blk Block
375+ | Sec [Inline] [Element] deriving (Eq, Read, Show)
376+
377+-- | Returns true on Header block with level at least 'level'
378+headerAtLeast :: Int -> Block -> Bool
379+headerAtLeast level (Header x _) = x <= level
380+headerAtLeast level _ = False
381+
382+-- | Convert list of Pandoc blocks into list of Elements (hierarchical)
383+hierarchicalize :: [Block] -> [Element]
384+hierarchicalize [] = []
385+hierarchicalize (block:rest) =
386+ case block of
387+ (Header level title) -> let (thisSection, rest') = break (headerAtLeast
388+ level) rest in
389+ (Sec title (hierarchicalize thisSection)):
390+ (hierarchicalize rest')
391+ x -> (Blk x):(hierarchicalize rest)
392+
371-- | Options for writers
393-- | Options for writers
372data WriterOptions = WriterOptions
394data WriterOptions = WriterOptions
373 { writerStandalone :: Bool -- ^ Include header and footer
395 { writerStandalone :: Bool -- ^ Include header and footer
@@ -377,6 +399,7 @@ data WriterOptions = WriterOptions
377 , writerIncludeAfter :: String -- ^ String to include after the body
399 , writerIncludeAfter :: String -- ^ String to include after the body
378 , writerTableOfContents :: Bool -- ^ Include table of contents
400 , writerTableOfContents :: Bool -- ^ Include table of contents
379 , writerS5 :: Bool -- ^ We're writing S5
401 , writerS5 :: Bool -- ^ We're writing S5
402+ , writerIgnoreNotes :: Bool -- ^ Ignore footnotes (used in making toc)
380 , writerIncremental :: Bool -- ^ Incremental S5 lists
403 , writerIncremental :: Bool -- ^ Incremental S5 lists
381 , writerNumberSections :: Bool -- ^ Number sections in LaTeX
404 , writerNumberSections :: Bool -- ^ Number sections in LaTeX
382 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
405 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
@@ -393,6 +416,7 @@ defaultWriterOptions =
393 writerTabStop = 4,
416 writerTabStop = 4,
394 writerTableOfContents = False,
417 writerTableOfContents = False,
395 writerS5 = False,
418 writerS5 = False,
419+ writerIgnoreNotes = False,
396 writerIncremental = False,
420 writerIncremental = False,
397 writerNumberSections = False,
421 writerNumberSections = False,
398 writerIncludeBefore = "",
422 writerIncludeBefore = "",
@@ -434,3 +458,4 @@ refsMatch (x:restx) (y:resty) = (x == y) && refsMatch restx resty
434refsMatch [] x = null x
458refsMatch [] x = null x
435refsMatch x [] = null x
459refsMatch x [] = null x
436
460
461+
src/Text/Pandoc/Writers/Docbook.hs−20
@@ -74,26 +74,6 @@ inTagsIndented tagType = inTags True tagType []
74-- Docbook writer
74-- Docbook writer
75--
75--
76
76
77−-- | Data structure for defining hierarchical Pandoc documents
78−data Element = Blk Block
79− | Sec [Inline] [Element] deriving (Eq, Read, Show)
80−
81−-- | Returns true on Header block with level at least 'level'
82−headerAtLeast :: Int -> Block -> Bool
83−headerAtLeast level (Header x _) = x <= level
84−headerAtLeast level _ = False
85−
86−-- | Convert list of Pandoc blocks into list of Elements (hierarchical)
87−hierarchicalize :: [Block] -> [Element]
88−hierarchicalize [] = []
89−hierarchicalize (block:rest) =
90− case block of
91− (Header level title) -> let (thisSection, rest') = break (headerAtLeast
92− level) rest in
93− (Sec title (hierarchicalize thisSection)):
94− (hierarchicalize rest')
95− x -> (Blk x):(hierarchicalize rest)
96−
97-- | Convert list of authors to a docbook <author> section
77-- | Convert list of authors to a docbook <author> section
98authorToDocbook :: [Char] -> Doc
78authorToDocbook :: [Char] -> Doc
99authorToDocbook name = inTagsIndented "author" $
79authorToDocbook name = inTagsIndented "author" $