summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-09-09 18:12:29 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-09-09 18:12:29 -0700
commit579cdac64139e8decc67172c0cb384de6f1bfc3b (patch)
treed2abe1a5d53180cfda08bbff2d63082e94eaa11b
parent7fc804ed22b3dad2e7f5c365a1d9a1beceb0c983 (diff)
HTML reader: Handle nested `<q>` tags properly.
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs10
1 files changed, 9 insertions, 1 deletions
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