git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: Handle nested `<q>` tags properly.
579cdacJohn MacFarlane
src/Text/Pandoc/Readers/HTML.hs+9−1
@@ -308,7 +308,15 @@ pSelfClosing f g = do
308 return open
308 return open
309
309
310pQ :: TagParser [Inline]
310pQ :: TagParser [Inline]
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
311−pQ = pInlinesInTags "q" (Quoted DoubleQuote)
319+ withQuoteContext innerQuoteContext $ pInlinesInTags "q" (Quoted quoteType)
312
320
313pEmph :: TagParser [Inline]
321pEmph :: TagParser [Inline]
314pEmph = pInlinesInTags "em" Emph <|> pInlinesInTags "i" Emph
322pEmph = pInlinesInTags "em" Emph <|> pInlinesInTags "i" Emph