git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Handle nested `<q>` tags properly.
commit579cdac64139e8decc67172c0cb384de6f1bfc3b authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 9 Sep 2012, 18:12 (14 years ago) parent7fc804e
1 file changed+9−1
src/Text/Pandoc/Readers/HTML.hs+9−1
src/Text/Pandoc/Readers/HTML.hs+9−1
@@ -308,7 +308,15 @@ pSelfClosing f g = do
308308 return open
309309
310310pQ :: TagParser [Inline]
311−pQ = pInlinesInTags "q" (Quoted DoubleQuote)
311+pQ = do
312+ quoteContext <- stateQuoteContext `fmap` getState
313+ let quoteType = case quoteContext of
314+ InDoubleQuote -> SingleQuote
315+ _ -> DoubleQuote
316+ let innerQuoteContext = if quoteType == SingleQuote
317+ then InSingleQuote
318+ else InDoubleQuote
319+ withQuoteContext innerQuoteContext $ pInlinesInTags "q" (Quoted quoteType)
312320
313321pEmph :: TagParser [Inline]
314322pEmph = pInlinesInTags "em" Emph <|> pInlinesInTags "i" Emph