git.iko.soy/typeable/pandoc
on master help sign in
Use isHeaderBlock from Shared rather than defining it anew...
b2db697John MacFarlane
src/Text/Pandoc/Writers/FB2.hs+2−4
@@ -44,7 +44,7 @@ import qualified Text.XML.Light.Cursor as XC
44
44
45import Text.Pandoc.Definition
45import Text.Pandoc.Definition
46import Text.Pandoc.Options (WriterOptions(..), HTMLMathMethod(..), def)
46import Text.Pandoc.Options (WriterOptions(..), HTMLMathMethod(..), def)
47−import Text.Pandoc.Shared (orderedListMarkers)
47+import Text.Pandoc.Shared (orderedListMarkers, isHeaderBlock)
48import Text.Pandoc.Walk
48import Text.Pandoc.Walk
49
49
50-- | Data to be written at the end of the document:
50-- | Data to be written at the end of the document:
@@ -157,9 +157,7 @@ renderSection level (ttl, body) = do
157 else cMapM blockToXml body
157 else cMapM blockToXml body
158 return $ el "section" (title ++ content)
158 return $ el "section" (title ++ content)
159 where
159 where
160− hasSubsections = any isHeader
160+ hasSubsections = any isHeaderBlock
161− isHeader (Header _ _ _) = True
162− isHeader _ = False
163
161
164-- | Only <p> and <empty-line> are allowed within <title> in FB2.
162-- | Only <p> and <empty-line> are allowed within <title> in FB2.
165formatTitle :: [Inline] -> [Content]
163formatTitle :: [Inline] -> [Content]
src/Text/Pandoc/Writers/Texinfo.hs+1−5
@@ -293,7 +293,7 @@ blockListToTexinfo (x:xs) = do
293 case x of
293 case x of
294 Header level _ _ -> do
294 Header level _ _ -> do
295 -- We need need to insert a menu for this node.
295 -- We need need to insert a menu for this node.
296− let (before, after) = break isHeader xs
296+ let (before, after) = break isHeaderBlock xs
297 before' <- blockListToTexinfo before
297 before' <- blockListToTexinfo before
298 let menu = if level < 4
298 let menu = if level < 4
299 then collectNodes (level + 1) after
299 then collectNodes (level + 1) after
@@ -315,10 +315,6 @@ blockListToTexinfo (x:xs) = do
315 xs' <- blockListToTexinfo xs
315 xs' <- blockListToTexinfo xs
316 return $ x' $$ xs'
316 return $ x' $$ xs'
317
317
318−isHeader :: Block -> Bool
319−isHeader (Header _ _ _) = True
320−isHeader _ = False
321−
322collectNodes :: Int -> [Block] -> [Block]
318collectNodes :: Int -> [Block] -> [Block]
323collectNodes _ [] = []
319collectNodes _ [] = []
324collectNodes level (x:xs) =
320collectNodes level (x:xs) =