From 579cdac64139e8decc67172c0cb384de6f1bfc3b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 9 Sep 2012 18:12:29 -0700 Subject: HTML reader: Handle nested `` tags properly. --- src/Text/Pandoc/Readers/HTML.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 182a144b3..90887bfae 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -308,7 +308,15 @@ pSelfClosing f g = do return open pQ :: TagParser [Inline] -pQ = pInlinesInTags "q" (Quoted DoubleQuote) +pQ = do + quoteContext <- stateQuoteContext `fmap` getState + let quoteType = case quoteContext of + InDoubleQuote -> SingleQuote + _ -> DoubleQuote + let innerQuoteContext = if quoteType == SingleQuote + then InSingleQuote + else InDoubleQuote + withQuoteContext innerQuoteContext $ pInlinesInTags "q" (Quoted quoteType) pEmph :: TagParser [Inline] pEmph = pInlinesInTags "em" Emph <|> pInlinesInTags "i" Emph -- cgit v1.2.3