diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-12-12 23:42:13 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-12-12 23:42:13 -0800 |
commit | 0679620f92ea880702cd46e680e837d6841dc3ec (patch) | |
tree | 9e3a77e6c8a5c8790a3dd582d7f744036f72d52b /src/Text/Pandoc/Writers | |
parent | a9a9a2c62a811d0e64062b0be628f55ba541dad7 (diff) | |
download | pandoc-0679620f92ea880702cd46e680e837d6841dc3ec.tar.gz |
Org writer: preliminary support for new org-cite syntax.
See #7329.
This could use some tests.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Org.hs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 24e664ae4..bf7c3f551 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -396,7 +396,27 @@ inlineToOrg (Quoted SingleQuote lst) = do inlineToOrg (Quoted DoubleQuote lst) = do contents <- inlineListToOrg lst return $ "\"" <> contents <> "\"" -inlineToOrg (Cite _ lst) = inlineListToOrg lst +inlineToOrg (Cite cs lst) = do + opts <- gets stOptions + if isEnabled Ext_citations opts + then do + let renderCiteItem c = do + citePref <- inlineListToOrg (citationPrefix c) + citeSuff <- inlineListToOrg (citationSuffix c) + return $ hsep [ citePref + , ("@" <> literal (citationId c)) + , citeSuff ] + citeItems <- mconcat . intersperse "; " <$> mapM renderCiteItem cs + let sty = case cs of + (d:_) + | citationMode d == AuthorInText + -> literal "/t" + [d] + | citationMode d == SuppressAuthor + -> literal "/na" + _ -> mempty + return $ "[cite" <> sty <> ":" <> citeItems <> "]" + else inlineListToOrg lst inlineToOrg (Code _ str) = return $ "=" <> literal str <> "=" inlineToOrg (Str str) = return . literal $ escapeString str inlineToOrg (Math t str) = do |