git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: support blockcquote, foreignblockquote from csquotes.

Also foreigncblockquote, hyphenblockquote, hyphencblockquote. Closes #4848. But note: currently foreignquote will be parsed as a regular Quoted inline (not using the quotes appropriate to the foreign language).

commit3b5949e8f278a8d407777f567fdaf8e421323ced authorJohn MacFarlane <jgm@berkeley.edu> dateTue 21 Aug 2018, 21:01 (8 years ago) parent5823031
2 files changed+23−8
src/Text/Pandoc/Readers/LaTeX.hs+19−5 test/command/4848.md+4−3
src/Text/Pandoc/Readers/LaTeX.hs+19−5
@@ -987,10 +987,19 @@ enquote starred mblang = do
987987 then singleQuoted . langspan <$> withQuoteContext InSingleQuote tok
988988 else doubleQuoted . langspan <$> withQuoteContext InDoubleQuote tok
989989
990−blockquote :: PandocMonad m => LP m Blocks
991−blockquote = do
990+blockquote :: PandocMonad m => Bool -> Maybe Text -> LP m Blocks
991+blockquote citations mblang = do
992+ citePar <- if citations
993+ then do
994+ cs <- cites NormalCitation False
995+ return $ para (cite cs mempty)
996+ else return mempty
997+ let lang = (T.unpack <$> mblang) >>= babelLangToBCP47
998+ let langdiv = case lang of
999+ Nothing -> id
1000+ Just l -> divWith ("",[],[("lang", renderLang l)])
9921001 bs <- grouped block
993− return $ blockQuote bs
1002+ return $ blockQuote . langdiv $ (bs <> citePar)
9941003
9951004doAcronym :: PandocMonad m => String -> LP m Inlines
9961005doAcronym form = do
@@ -2540,8 +2549,13 @@ blockCommands = M.fromList
25402549 -- LaTeX colors
25412550 , ("textcolor", coloredBlock "color")
25422551 , ("colorbox", coloredBlock "background-color")
2543− -- csquotse
2544− , ("blockquote", blockquote)
2552+ -- csquotes
2553+ , ("blockquote", blockquote False Nothing)
2554+ , ("blockcquote", blockquote True Nothing)
2555+ , ("foreignblockquote", braced >>= blockquote False . Just . untokenize)
2556+ , ("foreignblockcquote", braced >>= blockquote True . Just . untokenize)
2557+ , ("hyphenblockquote", braced >>= blockquote False . Just . untokenize)
2558+ , ("hyphenblockcquote", braced >>= blockquote True . Just . untokenize)
25452559 -- include
25462560 , ("include", include "include")
25472561 , ("input", include "input")
test/command/4848.md+4−3
@@ -39,7 +39,8 @@ consectetuer.
3939^D
4040[Para [Str "Lorem",Space,Str "ipsum"]
4141,BlockQuote
42− [Para [Str "dolor",Space,Str "sit",Space,Str "amet",Space,Cite [Citation {citationId = "Knu86", citationPrefix = [], citationSuffix = [Str "198"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite[198]{Knu86}"]]]
42+ [Para [Str "dolor",Space,Str "sit",Space,Str "amet"]
43+ ,Para [Cite [Citation {citationId = "Knu86", citationPrefix = [], citationSuffix = [Str "198"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] []]]
4344,Para [Str "consectetuer."]]
4445```
4546
@@ -50,8 +51,8 @@ Lorem ipsum
5051consectetuer.
5152^D
5253[Para [Str "Lorem",Space,Str "ipsum"]
53−,Div ("",[],[("lang","it")])
54− [BlockQuote
54+,BlockQuote
55+ [Div ("",[],[("lang","it")])
5556 [Para [Str "dolor",Space,Str "sit",Space,Str "amet"]]]
5657,Para [Str "consectetuer."]]
5758```