@@ -126,8 +126,8 @@ block = do
126126 tr <- getOption readerTrace
127127 pos <- getPosition
128128 res <- choice
129− [ eSwitch
130− , eSection
129+ [ eSection
130+ , eSwitch B.para block
131131 , mempty <$ eFootnote
132132 , mempty <$ eTOC
133133 , pPara
@@ -147,26 +147,26 @@ block = do
147147 (take 60 $ show $ B.toList res)) (return ())
148148 return res
149149
150−namespaces :: [(String, TagParser Blocks)]
151−namespaces = [(mathMLNamespace, B.para <$> pMath True)]
150+namespaces :: [(String, TagParser Inlines)]
151+namespaces = [(mathMLNamespace, pMath True)]
152152
153153mathMLNamespace :: String
154154mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
155155
156−eSwitch :: TagParser Blocks
157−eSwitch = try $ do
156+eSwitch :: Monoid a => (Inlines -> a) -> TagParser a -> TagParser a
157+eSwitch constructor parser = try $ do
158158 guardEnabled Ext_epub_html_exts
159159 pSatisfy (~== TagOpen "switch" [])
160160 cases <- getFirst . mconcat <$>
161161 manyTill (First <$> (eCase <* skipMany pBlank) )
162162 (lookAhead $ try $ pSatisfy (~== TagOpen "default" []))
163163 skipMany pBlank
164− fallback <- pInTags "default" ( skipMany pBlank *> block <* skipMany pBlank )
164+ fallback <- pInTags "default" (skipMany pBlank *> parser <* skipMany pBlank)
165165 skipMany pBlank
166166 pSatisfy (~== TagClose "switch")
167− return (fromMaybe fallback cases)
167+ return $ maybe fallback constructor cases
168168
169−eCase :: TagParser (Maybe Blocks)
169+eCase :: TagParser (Maybe Inlines)
170170eCase = do
171171 skipMany pBlank
172172 TagOpen _ attr <- lookAhead $ pSatisfy $ (~== TagOpen "case" [])
@@ -443,6 +443,7 @@ pCodeBlock = try $ do
443443inline :: TagParser Inlines
444444inline = choice
445445 [ eNoteref
446+ , eSwitch id inline
446447 , pTagText
447448 , pQ
448449 , pEmph