meta_get_sources (meta) |
Collect sources from the document's metadata block. |
@@ -645,8 +681,8 @@ Or
nil
nil
if the file could not be found.
- An
- error message.
+ string
+ An error message.
@@ -762,7 +798,7 @@ Parameters:
string
A template for the filename.
'X's are replaced with random alphanumeric characters.
- Cannot be the empty string ('').
+ Must contain at least six 'X's.
(default 'tmp_XXXXXX')
@@ -840,7 +876,8 @@ Usage:
do
local tmp, ok, err
- tmp, err = tmp_file()
+ tmp, err = tmp_file()
if tmp then
ok, err = tmp.file:write(data)
if ok then ok, err = tmp.file:close() end
@@ -855,7 +892,10 @@ Usage:
else
print(err)
end
-end
+end
+
@@ -870,7 +910,7 @@
Print a message to STDERR.
- Prefixes the message with PRINTF_PREFIX' and appends
EOL`.
+
Prefixes the message with PRINTF_PREFIX
and appends EOL.
Parameters:
@@ -892,7 +932,7 @@ Parameters:
- warnf ([msg], ...)
+ warnf (...)
Print a warning to STDERR.
@@ -903,13 +943,8 @@ Parameters:
Parameters:
- - msg
- string
- The message.
- (optional)
-
- ...
- Arguments to that message (think string.format).
+ Takes the same arguments as printf.
@@ -922,6 +957,41 @@ Parameters:
+ -
+
+ rmap (func, data)
+
+ -
+ Recursively apply a function to every value of a tree.
+
+
The function is applied to every node of the data tree.
+ If a node is a table, the function is applied after recursion.
+
+
+
Parameters:
+
+ - func
+ func
+ A function that takes a value and returns a new one.
+ Receives the value's key as second argument, if applicable.
+
+ - data
+ A data tree.
+
+
+
+ Returns:
+
+
+ data
with func
applied.
+
+
+ Raises:
+ An error if the data is nested too deeply.
+
+
+
+
-
keys (tab)
@@ -957,7 +1027,7 @@
Returns:
lower_keys (tab)
-
- Convert table keys to lowercase recursively.
+ Recursively convert table keys to lowercase.
Parameters:
@@ -974,6 +1044,8 @@ Returns:
A copy of tab
with keys in lowercase.
+ Raises:
+ An error if the data is nested too deeply.
@@ -1049,248 +1121,98 @@ Raises:
-
+
-
-
- rconv_nums_to_strs (data)
+
+ CSL_KEYS_FORMATTABLE
-
- Convert numbers to strings recursively.
-
-
Also converts floating point numbers to integers. This is needed
- because all numbers are floating point numbers in JSON, but some
- versions of Pandoc expect integers.
-
-
-
Parameters:
-
- - data
- tab
- The data.
-
-
-
- Returns:
-
-
- A copy of data
with numbers converted to strings.
-
+ The list of CSL fields that can be formatted.
- Raises:
- An error if the data is nested too deeply.
-
-
-
-
- -
-
- yamlify (data[, ind=4[, sort_f]])
-
- -
- Generate a YAML representation of some data.
+
This list is a guess!
- Uses EOL to end lines.
+
Appendix IV
+ of the CSL specification lists all field names.
-
Parameters:
+ Fields:
- - data
- The data.
+
- abstract
+ The abstract.
- - ind
- int
- How many spaces to indent blocks.
- (default 4)
+
- collection-title
+ E.g., a series.
- - sort_f
- func
- A function to sort keys of mappings.
- Defaults to sorting them lexically.
- (optional)
+
- collection-title-short
+ A short version of the title.
+
+ - container-title
+ Publication the item was published in.
+
+ - container-title-short
+ A short version of that title.
+
+ - original-publisher
+ Original publisher.
+
+ - original-publisher-place
+ Place the item was originally published in.
+
+ - original-title
+ Original title.
+
+ - publisher
+ Publisher.
+
+ - publisher-place
+ The city/cities the item was published in.
+
+ - reviewed-title
+ Title reviewed in the item.
+
+ - title
+ The title.
+
+ - title-short
+ A short version of the title.
+
+ - short-title
+ Ditto.
- Returns:
-
-
- string
- A YAML string.
-
- Or
-
- -
- nil
-
nil
if the data cannot be represented in YAML.
- -
- An
- error message.
-
-
- Raises:
- An error if if the data is nested too deeply.
-
-
-
-
-
-
-
-
- -
-
- ZOTXT_BASE_URL
-
- -
- The URL to lookup citation data.
-
-
See https://github.com/egh/zotxt for details.
-
-
-
+
See also:
+
-
-
- ZOTXT_KEYTYPES
+
+ CSL_KEY_ORDER
-
- Types of citation keys.
+ The preferred order of keys in YAML bibliography files.
-
See https://github.com/egh/zotxt for details.
+
Appendix IV
+ of the CSL specification lists all field names.
Fields:
- - key
- Zotero item ID
+
- id
+ Item ID.
- - betterbibtexkey
- Better BibTeX citation key
+
- type
+ For example, 'paper', 'book'.
- - easykey
- zotxt easy citekey
-
-
-
-
-
-
-
-
- -
-
- zotxt_get_item_csl (id)
-
- -
- Retrieve a CSL item (for use in bibliography files).
-
-
Returns bibliographic data as a Lua table. The retrieved item can be
- passed to biblio_write; it should not be used in the references
- metadata field (unless you are using Pandoc prior to v2.11).
-
-
-
Parameters:
-
- - id
- string
- An item ID, e.g., 'name:2019word', 'name2019TwoWords'.
-
-
-
- Returns:
-
-
- table
- A CSL item.
-
- Or
-
- -
- nil
-
nil
if an error occurred.
- -
- string
- An error message.
-
-
- Raises:
- See zotxt_get_item.
-
-
-
-
- -
-
- zotxt_get_item (id)
-
- -
- Retrieve a CSL item (for use in the
references
metadata field).
-
- Returns bibliographic data as Pandoc metadata. That retrieved item
- can be used in the references
metadata field; it should not be
- passed to biblio_write.
-
-
-
Parameters:
-
- - id
- string
- An item ID, e.g., 'name:2019word', 'name2019TwoWords'.
-
-
-
- Returns:
-
-
- pandoc.MetaMap
- A CSL item.
-
- Or
-
- -
- nil
-
nil
if an error occurred.
- -
- string
- An error message.
-
-
- Raises:
- See zotxt_get_item.
-
-
-
-
-
-
-
-
- -
-
- CSL_KEY_ORDER
-
- -
- The preferred order of keys in YAML bibliography files.
-
-
See appendix IV
- of the CSL specification and csl_keys_sort for details.
-
-
-
Fields:
-
- - id
- Item ID.
-
- - type
- For example, 'paper', 'book'.
-
- - author
- Author(s).
+
- author
+ Author(s).
- recipient
Recipient of the document.
@@ -1304,16 +1226,19 @@
Fields:
- title
The title.
- - short-title
+
- title-short
A short version of the title.
- - abstract
- The abstract.
+
- short-title
+ Ditto.
+
+ - original-title
+ Original title.
- translator
Translator(s).
- - collection-editor
+
- editor
Editor(s).
- container-title
@@ -1322,6 +1247,15 @@
Fields:
- container-title-short
A short version of that title.
+ - collection-editor
+ E.g., series editor(s).
+
+ - collection-title
+ E.g., a series.
+
+ - collection-title-short
+ A short version of the title.
+
- edition
Container's edition.
@@ -1341,7 +1275,13 @@ Fields:
Publisher.
- publisher-place
- The city/cities the item was published in.
+ City/cities the item was published in.
+
+ - original-publisher
+ Original publisher.
+
+ - original-publisher-place
+ Place the item was originally published in.
- doi
The DOI.
@@ -1370,10 +1310,17 @@
Fields:
- language
Language the item is in.
+ - abstract
+ The abstract.
+
+ See also:
+
@@ -1398,7 +1345,7 @@ Fields:
BIBLIO_TYPES.bib
-
- Read BibTeX/BibLaTeX files.
+ Parse BibLaTeX.
@@ -1412,22 +1359,30 @@
Fields:
BIBLIO_TYPES.bib.decode (str)
-
- Collect item IDs from the content of a BibTeX/BibLaTeX file.
+ Parse the content of a BibLaTeX file.
Parameters:
- str
string
- The content of a BibTeX/BibLaTeX file.
+ The content of a BibLaTeX file.
Returns:
+ {table,...}
+ A list of CSL items
+ if you use Pandoc v2.11 or later.
+
+ Or
+
+
{{id=string},...}
- A list of item IDs.
+ A list of item IDs
+ if you use an earlier version of Pandoc.
@@ -1439,10 +1394,45 @@ Returns:
BIBLIO_TYPES.bibtex
-
- Alternative suffix for BibTeX/BibLaTeX files.
+ Parse BibTeX.
+
+
+
+
+
+
+
+
+ -
+
+ BIBLIO_TYPES.bibtex.decode (str)
+
+ -
+ Parse the content of a BibTeX file
+
+
+
Parameters:
+
+ - str
+ string
+ The content of a BibTeX file.
+
+
+ Returns:
+
+ {table,...}
+ A list of CSL items
+ if you use Pandoc v2.11 or later.
+
+ Or
+
+ {{id=string},...}
+ A list of item IDs
+ if you use an earlier version of Pandoc.
+
@@ -1787,35 +1777,34 @@ Raises:
-
+
-
-
- meta_get_sources (meta)
+
+ esc_md (str)
-
- Collect sources from the document's metadata block.
+ Escape Markdown.
-
Reads the references
metafata field and every bibliography file
- referenced by the bibliography
metadata field.
+ Only escapes Markdown that Pandoc recognises in bibliographic data.
- Prints errors to STDERR if it cannot parse a bibliography file.
+
See https://pandoc.org/MANUAL.html#specifying-bibliographic-data.
Parameters:
- - meta
- tab
- A metadata block.
+
- str
+ string
+ A string.
Returns:
- pandoc.List
- A list of CSL items.
+ string
+ str
with Markdown escaped.
@@ -1823,26 +1812,60 @@ Returns:
-
-
- doc_get_ckeys (doc[, flags])
+
+ markdownify (elem)
-
- Collect the citation keys used in a document.
+ Convert a Pandoc element to Markdown text.
-
Prints errors to STDERR if it cannot parse a bibliography file.
+
Only recognises elements that are permitted in bibliographic data.
+
+ See https://pandoc.org/MANUAL.html#specifying-bibliographic-data.
Parameters:
- - doc
- tab
- A document.
+
- elem
+ pandoc.AstElement
+ A Pandoc AST element.
- - flags
- string
- If the flag 'u' is given, collects only citation keys
- of sources that are neither defined in the
references
metadata field
- nor in any bibliography file.
+
+
+ Returns:
+
+
+ string
+ Markdown text.
+
+
+
+
+
+
+ -
+
+ yamlify (data[, ind=4[, sort_f]])
+
+ -
+ Generate a YAML representation of some data.
+
+
Uses EOL to end lines.
+
+
+
Parameters:
+
+ - data
+ The data.
+
+ - ind
+ int
+ How many spaces to indent blocks.
+ (default 4)
+
+ - sort_f
+ func
+ A function to sort keys of mappings.
+ Defaults to sorting them lexically.
(optional)
@@ -1850,52 +1873,444 @@ Parameters:
Returns:
- {string,...}
- A list of citation keys.
+ string
+ A YAML string.
+
+ Or
+
+ -
+ nil
+
nil
if the data cannot be represented in YAML.
+ -
+ string
+ An error message.
Raises:
- An error if an item ID is of an illegal data type.
+ An error if the data is nested too deeply.
-
-
-
-
-
-
- add_biblio (meta, ckeys)
+
+ conv_html_to_md (html)
-
- Add sources to a bibliography file and the file to the document's metadata.
+ Convert pseudo-HTML to Markdown.
-
Updates the bibliography file as needed and adds it to the bibliography
- metadata field. Interpretes a relative filename as relative to the
- directory of the first input file passed to pandoc, not as relative
- to the current working directory (unless no input files are given).
+
Only supports the HTML tags that Zotero and Pandoc support.
+
+ See https://pandoc.org/MANUAL.html#specifying-bibliographic-data
+ and https://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields.
Parameters:
- - meta
- tab
- A metadata block, with the field
-
zotero-bibliography
set to the filename of the bibliography file.
-
- - ckeys
- tab
- The citaton keys of the items that should be added,
- e.g.,
{'name:2019word', 'name2019WordWordWord'}
.
- Citation keys are just item IDs.
+ - html
+ string
+ Text that contains pseudo-HTML tags.
Returns:
- table
+ string
+ Text formatted in Markdown.
+
+
+
+
+
+
+ -
+
+ rconv_html_to_md (item)
+
+ -
+ Recursively convert pseudo-HTML to Markdown.
+
+
Only changes fields listed in CSL_KEYS_FORMATTABLE.
+
+
+
Parameters:
+
+ - item
+ tab
+ A CSL item.
+
+
+
+ Returns:
+
+
+ tab
+ The CSL item, with pseudo-HTML replaced with Markdown.
+
+
+
+ See also:
+
+
+
+
+ -
+
+ rconv_nums_to_strs (data)
+
+ -
+ Recursively convert numbers to strings.
+
+
Also converts floating point numbers to integers. This is needed
+ because all numbers are floating point numbers in JSON, but some
+ versions of Pandoc expect integers.
+
+
+
Parameters:
+
+ - data
+ tab
+ The data.
+
+
+
+ Returns:
+
+
+ A copy of data
with numbers converted to strings.
+
+
+ Raises:
+ An error if the data is nested too deeply.
+
+
+
+
+
+
+
+
+ -
+
+ ZOTXT_BASE_URL
+
+ -
+ The URL to lookup citation data.
+
+
See https://github.com/egh/zotxt for details.
+
+
+
+
+
+
+
+
+ -
+
+ ZOTXT_KEYTYPES
+
+ -
+ Types of citation keys.
+
+
See https://github.com/egh/zotxt for details.
+
+
+
Fields:
+
+ - key
+ Zotero item ID
+
+ - betterbibtexkey
+ Better BibTeX citation key
+
+ - easykey
+ zotxt easy citekey
+
+
+
+
+
+
+
+
+ -
+
+ zotxt_get_item_csl (id)
+
+ -
+ Retrieve a CSL item (for use in bibliography files).
+
+
Returns bibliographic data as a Lua table. The retrieved item can be
+ passed to biblio_write; it should not be used in the references
+ metadata field (unless you are using Pandoc prior to v2.11).
+
+
+
Parameters:
+
+ - id
+ string
+ An item ID, e.g., 'name:2019word', 'name2019TwoWords'.
+
+
+
+ Returns:
+
+
+ table
+ A CSL item.
+
+ Or
+
+ -
+ nil
+
nil
if an error occurred.
+ -
+ string
+ An error message.
+
+
+ Raises:
+ See zotxt_get_item.
+
+
+
+
+ -
+
+ zotxt_get_item (id)
+
+ -
+ Retrieve a CSL item (for use in the
references
metadata field).
+
+ Returns bibliographic data as Pandoc metadata. That retrieved item
+ can be used in the references
metadata field; it should not be
+ passed to biblio_write.
+
+
+
Parameters:
+
+ - id
+ string
+ An item ID, e.g., 'name:2019word', 'name2019TwoWords'.
+
+
+
+ Returns:
+
+
+ pandoc.MetaMap
+ A CSL item.
+
+ Or
+
+ -
+ nil
+
nil
if an error occurred.
+ -
+ string
+ An error message.
+
+
+ Raises:
+ See zotxt_get_item.
+
+
+
+
+
+
+
+
+ -
+
+ elem_type (elem)
+
+ -
+ The type of a Pandoc AST element.
+
+
+
Parameters:
+
+ - elem
+ pandoc.AstElement
+ A Pandoc AST element.
+
+
+
+ Returns:
+
+ -
+ string
+ The type
+ (e.g., 'MetaMap', 'Plain').
+ -
+ string
+ The high-order kind
+ (i.e., 'Block', 'Inline', or 'MetaValue').
+ -
+ string
+ The literal 'AstElement'.
+
+ Or
+
+
+ nil
+ nil
if elem
is not a Pandoc AST element.
+
+
+
+
+
+
+ -
+
+ walk (elem, filter)
+
+ -
+ Walk the AST and apply functions to matching elements.
+
+
Differs from pandoc.walk_block
and pandoc.walk_inline
by accepting
+ AST elements of any type (i.e., including documents as a whole, the
+ metadata block, and metadata fields), by applying the filter to the
+ given element itself, by walking the AST bottom-up (which implies that
+ the filter is applied to every node, regardless of whether any of that
+ node's ancestors matches it), and by allowing the functions in the
+ filter to return arbitrary data (as opposed to either a Pandoc AST
+ element type or nil
). Use with caution.
+
+
+
Parameters:
+
+ - elem
+ pandoc.AstElement
+ A Pandoc AST element.
+
+ - filter
+ {string=func,...}
+ A filter.
+
+
+
+ Returns:
+
+
+ The element, with the filter applied.
+
+
+
+
+
+
+ -
+
+ meta_get_sources (meta)
+
+ -
+ Collect sources from the document's metadata block.
+
+
Reads the references
metafata field and every bibliography file
+ referenced by the bibliography
metadata field.
+
+ Prints errors to STDERR if it cannot parse a bibliography file.
+
+
+
Parameters:
+
+ - meta
+ tab
+ A metadata block.
+
+
+
+ Returns:
+
+
+ pandoc.List
+ A list of CSL items.
+
+
+
+
+
+
+ -
+
+ doc_get_ckeys (doc[, flags])
+
+ -
+ Collect the citation keys used in a document.
+
+
Prints errors to STDERR if it cannot parse a bibliography file.
+
+
+
Parameters:
+
+ - doc
+ tab
+ A document.
+
+ - flags
+ string
+ If the flag 'u' is given, collects only citation keys
+ of sources that are neither defined in the
references
metadata field
+ nor in any bibliography file.
+ (optional)
+
+
+
+ Returns:
+
+
+ {string,...}
+ A list of citation keys.
+
+
+ Raises:
+ An error if an item ID is of an illegal data type.
+
+
+
+
+
+
+
+
+ -
+
+ add_biblio (meta, ckeys)
+
+ -
+ Add sources to a bibliography file and the file to the document's metadata.
+
+
Updates the bibliography file as needed and adds it to the bibliography
+ metadata field. Interpretes a relative filename as relative to the
+ directory of the first input file passed to pandoc, not as relative
+ to the current working directory (unless no input files are given).
+
+
+
Parameters:
+
+ - meta
+ tab
+ A metadata block, with the field
+
zotero-bibliography
set to the filename of the bibliography file.
+
+ - ckeys
+ tab
+ The citaton keys of the items that should be added,
+ e.g.,
{'name:2019word', 'name2019WordWordWord'}
.
+ Citation keys are just item IDs.
+
+
+
+ Returns:
+
+
+ tab
An updated metadata block, with the field
bibliography
added if needed.
@@ -2009,7 +2424,7 @@ Raises:
generated by LDoc 1.4.6
-
Last updated 2021-05-15 22:05:07
+
Last updated 2021-05-30 13:19:10