git.iko.soy/typeable/pandoc
on master help sign in
Use isHeaderBlock from Shared rather than defining it anew...
commitb2db6979fedc5f66d45596c9564a8313af90b9fa authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 2 Jan 2014, 19:32 (13 years ago) parent33955fd
2 files changed+3−9
src/Text/Pandoc/Writers/FB2.hs+2−4 src/Text/Pandoc/Writers/Texinfo.hs+1−5
src/Text/Pandoc/Writers/FB2.hs+2−4
@@ -44,7 +44,7 @@ import qualified Text.XML.Light.Cursor as XC
4444
4545import Text.Pandoc.Definition
4646import Text.Pandoc.Options (WriterOptions(..), HTMLMathMethod(..), def)
47−import Text.Pandoc.Shared (orderedListMarkers)
47+import Text.Pandoc.Shared (orderedListMarkers, isHeaderBlock)
4848import Text.Pandoc.Walk
4949
5050-- | Data to be written at the end of the document:
@@ -157,9 +157,7 @@ renderSection level (ttl, body) = do
157157 else cMapM blockToXml body
158158 return $ el "section" (title ++ content)
159159 where
160− hasSubsections = any isHeader
161− isHeader (Header _ _ _) = True
162− isHeader _ = False
160+ hasSubsections = any isHeaderBlock
163161
164162-- | Only <p> and <empty-line> are allowed within <title> in FB2.
165163formatTitle :: [Inline] -> [Content]
src/Text/Pandoc/Writers/Texinfo.hs+1−5
@@ -293,7 +293,7 @@ blockListToTexinfo (x:xs) = do
293293 case x of
294294 Header level _ _ -> do
295295 -- We need need to insert a menu for this node.
296− let (before, after) = break isHeader xs
296+ let (before, after) = break isHeaderBlock xs
297297 before' <- blockListToTexinfo before
298298 let menu = if level < 4
299299 then collectNodes (level + 1) after
@@ -315,10 +315,6 @@ blockListToTexinfo (x:xs) = do
315315 xs' <- blockListToTexinfo xs
316316 return $ x' $$ xs'
317317
318−isHeader :: Block -> Bool
319−isHeader (Header _ _ _) = True
320−isHeader _ = False
321−
322318collectNodes :: Int -> [Block] -> [Block]
323319collectNodes _ [] = []
324320collectNodes level (x:xs) =