summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-01-19 10:31:00 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2022-01-19 10:31:00 -0800
commitd5818413ff404d6fcb8fc9778b78912a28228074 (patch)
tree478b8fd0d9b718aa285dc5c0b0fe8a73f11f7370 /src
parent73fe7c129e065bb5852def89a83bf8a6e474dc7e (diff)
Docx reader: parse both zotero citation and bibliography...
as FieldInfo.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Fields.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Fields.hs b/src/Text/Pandoc/Readers/Docx/Fields.hs
index 4d7bc3757..5707197c0 100644
--- a/src/Text/Pandoc/Readers/Docx/Fields.hs
+++ b/src/Text/Pandoc/Readers/Docx/Fields.hs
@@ -26,7 +26,8 @@ type Anchor = T.Text
data FieldInfo = HyperlinkField URL
-- The boolean indicates whether the field is a hyperlink.
| PagerefField Anchor Bool
- | ZoteroField T.Text
+ | ZoteroItem T.Text
+ | ZoteroBibliography
| UnknownField
deriving (Show)
@@ -39,20 +40,29 @@ fieldInfo =
<|>
try ((uncurry PagerefField) <$> pageref)
<|>
- try (ZoteroField <$> zotero)
+ try addIn
<|>
return UnknownField
-zotero :: Parser T.Text
-zotero = do
+addIn :: Parser FieldInfo
+addIn = do
spaces
string "ADDIN"
spaces
+ try zoteroItem <|> zoteroBibliography
+
+zoteroItem :: Parser FieldInfo
+zoteroItem = do
string "ZOTERO_ITEM"
spaces
string "CSL_CITATION"
spaces
- getInput
+ ZoteroItem <$> getInput
+
+zoteroBibliography :: Parser FieldInfo
+zoteroBibliography = do
+ string "ZOTERO_BIBL"
+ return ZoteroBibliography
escapedQuote :: Parser T.Text
escapedQuote = string "\\\"" $> "\\\""