diff --git a/MANUAL.txt b/MANUAL.txt index ba2335714..f56702899 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -3472,10 +3472,11 @@ native pandoc citations. [org-cite]: https://orgmode.org/manual/Citations.html [org-ref]: https://github.com/jkitchin/org-ref -When `citations` is enabled in `docx`, Zotero-inserted -citations will be parsed as native pandoc citations. -(Otherwise, the Zotero-generated citation text and -bibliography will be parsed as regular text.) +When `citations` is enabled in `docx`, citations inserted +by Zotero or Mendeley plugins will be parsed as native pandoc +citations. (Otherwise, the Zotero- or Mendeley-generated +citation text and bibliography will be parsed as regular +text.) #### Extension: `fancy_lists` {#org-fancy-lists} diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index d01bec5ce..005f3e437 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -457,7 +457,7 @@ parPartToInlines' (Field info children) = case info of HyperlinkField url -> parPartToInlines' $ ExternalHyperLink url children PagerefField fieldAnchor True -> parPartToInlines' $ InternalHyperLink fieldAnchor children - ZoteroItem t -> do + CslCitation t -> do formattedCite <- smushInlines <$> mapM parPartToInlines' children opts <- asks docxOptions if isEnabled Ext_citations opts @@ -490,7 +490,7 @@ parPartToInlines' (Field info children) = refs } return $ cite cs formattedCite else return formattedCite - ZoteroBibliography -> do + CslBibliography -> do opts <- asks docxOptions if isEnabled Ext_citations opts then return mempty -- omit Zotero-generated bibliography diff --git a/src/Text/Pandoc/Readers/Docx/Fields.hs b/src/Text/Pandoc/Readers/Docx/Fields.hs index 5707197c0..a53ef35ea 100644 --- a/src/Text/Pandoc/Readers/Docx/Fields.hs +++ b/src/Text/Pandoc/Readers/Docx/Fields.hs @@ -26,8 +26,8 @@ type Anchor = T.Text data FieldInfo = HyperlinkField URL -- The boolean indicates whether the field is a hyperlink. | PagerefField Anchor Bool - | ZoteroItem T.Text - | ZoteroBibliography + | CslCitation T.Text + | CslBibliography | UnknownField deriving (Show) @@ -49,20 +49,20 @@ addIn = do spaces string "ADDIN" spaces - try zoteroItem <|> zoteroBibliography + try cslCitation <|> cslBibliography -zoteroItem :: Parser FieldInfo -zoteroItem = do - string "ZOTERO_ITEM" +cslCitation :: Parser FieldInfo +cslCitation = do + optional (string "ZOTERO_ITEM") spaces string "CSL_CITATION" spaces - ZoteroItem <$> getInput + CslCitation <$> getInput -zoteroBibliography :: Parser FieldInfo -zoteroBibliography = do - string "ZOTERO_BIBL" - return ZoteroBibliography +cslBibliography :: Parser FieldInfo +cslBibliography = do + string "ZOTERO_BIBL" <|> string "Mendeley Bibliography CSL_BIBLIOGRAPHY" + return CslBibliography escapedQuote :: Parser T.Text escapedQuote = string "\\\"" $> "\\\""