@@ -126,8 +126,8 @@ block = do
126 tr <- getOption readerTrace
126 tr <- getOption readerTrace
127 pos <- getPosition
127 pos <- getPosition
128 res <- choice
128 res <- choice
129− [ eSwitch
129+ [ eSection
130− , eSection
130+ , eSwitch B.para block
131 , mempty <$ eFootnote
131 , mempty <$ eFootnote
132 , mempty <$ eTOC
132 , mempty <$ eTOC
@@ -147,26 +147,26 @@ block = do
147 (take 60 $ show $ B.toList res)) (return ())
147 (take 60 $ show $ B.toList res)) (return ())
148 return res
148 return res
150−namespaces :: [(String, TagParser Blocks)]
150+namespaces :: [(String, TagParser Inlines)]
151−namespaces = [(mathMLNamespace, B.para <$> pMath True)]
151+namespaces = [(mathMLNamespace, pMath True)]
153mathMLNamespace :: String
153mathMLNamespace :: String
154mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
154mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
156−eSwitch :: TagParser Blocks
156+eSwitch :: Monoid a => (Inlines -> a) -> TagParser a -> TagParser a
157−eSwitch = try $ do
157+eSwitch constructor parser = try $ do
158 guardEnabled Ext_epub_html_exts
158 guardEnabled Ext_epub_html_exts
159 pSatisfy (~== TagOpen "switch" [])
159 pSatisfy (~== TagOpen "switch" [])
160 cases <- getFirst . mconcat <$>
160 cases <- getFirst . mconcat <$>
161 manyTill (First <$> (eCase <* skipMany pBlank) )
161 manyTill (First <$> (eCase <* skipMany pBlank) )
162 (lookAhead $ try $ pSatisfy (~== TagOpen "default" []))
162 (lookAhead $ try $ pSatisfy (~== TagOpen "default" []))
163 skipMany pBlank
163 skipMany pBlank
164− fallback <- pInTags "default" ( skipMany pBlank *> block <* skipMany pBlank )
164+ fallback <- pInTags "default" (skipMany pBlank *> parser <* skipMany pBlank)
165 skipMany pBlank
165 skipMany pBlank
166 pSatisfy (~== TagClose "switch")
166 pSatisfy (~== TagClose "switch")
167− return (fromMaybe fallback cases)
167+ return $ maybe fallback constructor cases
169−eCase :: TagParser (Maybe Blocks)
169+eCase :: TagParser (Maybe Inlines)
170eCase = do
170eCase = do
171 skipMany pBlank
171 skipMany pBlank
172 TagOpen _ attr <- lookAhead $ pSatisfy $ (~== TagOpen "case" [])
172 TagOpen _ attr <- lookAhead $ pSatisfy $ (~== TagOpen "case" [])
@@ -443,6 +443,7 @@ pCodeBlock = try $ do
443inline :: TagParser Inlines
443inline :: TagParser Inlines
444inline = choice
444inline = choice
445 [ eNoteref
445 [ eNoteref
446 , pTagText
447 , pTagText