aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-11-23 09:57:09 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-11-23 09:57:09 -0800
commitb72ba3ed6dbf6de7ee23c8f5148648b599b49964 (patch)
treef538e11e6ea3f2e5e1f4c2bbfac8fae20f16c276
parentbffd74323cfd91f5c44ca34e09633247d1d28954 (diff)
downloadpandoc-b72ba3ed6dbf6de7ee23c8f5148648b599b49964.tar.gz
Simplify sample ris reader in doc/custom-readers.md.
Made possible by #7712.
-rw-r--r--doc/custom-readers.md31
1 files changed, 9 insertions, 22 deletions
diff --git a/doc/custom-readers.md b/doc/custom-readers.md
index fe032d4b3..c85b43ae4 100644
--- a/doc/custom-readers.md
+++ b/doc/custom-readers.md
@@ -208,19 +208,6 @@ local types =
VIDEO = "graphic"
}
-local function inlines(s)
- local ils = {}
- for t in string.gmatch(s, "%S+") do
- if #ils == 0 then
- ils = {pandoc.Str(t)}
- else
- table.insert(ils, pandoc.Space())
- table.insert(ils, pandoc.Str(t))
- end
- end
- return pandoc.MetaInlines(ils)
-end
-
local function clean(refpairs)
local ref = {}
for i = 1, #refpairs do
@@ -249,28 +236,28 @@ local function clean(refpairs)
end
elseif k == "AU" or k == "A1" or k == "A2" or k == "A3" then
if ref.author then
- table.insert(ref.author, inlines(v))
+ table.insert(ref.author, v)
else
- ref.author = {inlines(v)}
+ ref.author = {v}
end
elseif k == "TI" or k == "T1" or k == "CT" or
(k == "BT" and ref.type == "book") then
- ref.title = inlines(v)
+ ref.title = v
elseif k == "ET" then
- ref.edition = inlines(v)
+ ref.edition = v
elseif k == "NV" then
- ref["number-of-volumes"] = inlines(v)
+ ref["number-of-volumes"] = v
elseif k == "AB" then
- ref.abstract = inlines(v)
+ ref.abstract = v
elseif k == "ED" then
if ref.editor then
- table.insert(ref.editor, inlines(v))
+ table.insert(ref.editor, v)
else
- ref.editor = {inlines(v)}
+ ref.editor = {v}
end
elseif k == "JO" or k == "JF" or k == "T2" or
(k == "BT" and ref.type ~= "book") then
- ref["container-title"] = inlines(v)
+ ref["container-title"] = v
elseif k == "PY" or k == "Y1" then
ref.issued = v
elseif k == "IS" then