Support embedded Mendeley citations in docx.
These are supported in the same way as Zotero citations, using the same code. As with Zotero, enable the `citations` extension on `docx` to parse these as native citations. Closes #7840.
This commit is contained in:
parent
d40236805d
commit
e07c0e74ce
3 changed files with 18 additions and 17 deletions
|
@ -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}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 "\\\"" $> "\\\""
|
||||
|
|
Loading…
Reference in a new issue