pandoc / lua-filters Goto Github PK
View Code? Open in Web Editor NEWA collection of lua filters for pandoc
License: MIT License
A collection of lua filters for pandoc
License: MIT License
This is a feature request and suggestion for highlighting an author name.
Thanks to @tarleb's multiple-bibliographies.lua
filter, I have been able to easily create my academic CV with multiple BibTeX files according to each section (e.g., journal publication, proceedings, and software development).
I was wondering if there would be any way to highlight a specific author's name in printing bib-entries using Lua filter as I have to bold my name in the printed bib-entries.
Conventionally, people in my field use bold formatting for their own publication in their CVs. This Stack Overflow question aligns with my such need.
It would be greatly appreciated if someone could develop that functionality. I believe many scholars would be able to benefit from the filter.
Many thanks.
I'm trying to write a file transclusion filter for markdown documents and I ended up with one that works
pretty well.
But, I have no idea how to make it work recursively.
I tried mapping a function to the pandoc.List
object, but that doesn't work because the function returns a list of blocks inside a block.
I thought of using walk_block
but that only works inside blocks.
I know that one can just use the m4 preprocessor for this task (and that is what I'm currently using)
but I wanted to make a fully portable filter just for fun.
Is there any way of doing this?
I'm running Windows 10 and updated RStudio, pandoc, Rmarkdown, and the latest version of the .lua files in the following YAML.
Trying to knit a .rmd with just the following in it, and scholarly-metadata.lua and author-info-blocks.lua in its directory,
---
title: "My title"
author:
- Katherine Lauck:
email: [email protected]
institute: [davis, pi]
correspondence: true
- name: Sarah L. Carroll
institute: colorado
- name: Elly Mufliati
institute: [untan, pi]
- name: Sadtata Noor Adirahmanta
institute: bksda
- name: Novia Sagita
institute: pi
- name: Siti Kartikawati
institute: [untan, pi]
- name: Adam Miller
institute: pi
institute:
- davis: Graduate Group in Ecology, University of California, Davis
- pi: Planet Indonesia
- untan: Fakultas Kehutanan, Universitas Tanjungpura
- bksda: Balai Konservasi Sumber Daya Alam
- colorado: Graduate Degree Program in Ecology, Colorado State University
output:
word_document:
pandoc_args:
- '--lua-filter=scholarly-metadata.lua'
- '--lua-filter=author-info-blocks.lua'
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
\```
## Abstract
blah blah
note: delete the escape slash after the r setup block before running - sorry, I'm new to github formatting and couldn't figure out how to properly escape that triple tick without the slash remaining in the code block.
Gives me:
Error running filter scholarly-metadata.lua: [string "scholarly-metadata.lua"]:7: unexpected symbol near '<' Error: pandoc document conversion failed with error 83
My interpretation of this error message is that pandoc is successfully opening and reading the .lua files but is expecting a different format. Commenting out the first filter gives the same error for the second filter.
I'm having trouble getting started with Lua filters. I have extensive
experience with Lua and with Haskell, but little experience with
Pandoc's data types and APIs.
Here are two points that illustrate my difficulty:
The parameters to the functions listed in https://pandoc.org/lua-filters.html#inline
(for example) don't seem to match the parameters to the functions that
I write. For example, the Span
function is listed to take two
parameters, "inline content" and "attributes", but as far as I can
tell, both content and attributes are in the single parameter.
The Span
function that I write has to look in a .c
field, then
pull things out of there. I don't see where the existence of the
.c
field is documented.
I've managed to make some progress by looking carefully at the Haskell
API for Pandoc's main data types, and by reverse engineering the Lua
code with print statements. I am not having much fun.
Where would I find the following?
Some sort of Rosetta stone that would tell me
how the Haskell types are represented in Lua?
An API specification for the functions I write---not just the ones
I can call?
(Apologies if this is the wrong place. I have not found a good place to ask beginner's questions about pandoc.)
There's some filters added in https://github.com/pandoc-extras/luapandoc-filters before this repo existed. Look at the dir. in https://github.com/pandoc-extras/luapandoc-filters/tree/master/filters and see if anything salvageable and after that pandoc-extras/luapandoc-filter should be gone for good.
The change in 8fc5add broke the previous behaviour where the filter could also be run on a document which did not have an Abstract header without effect. What happens now in that case is that an Abstract is created with the contents of true
.
The use case is having a pandoc defaults file for report/article type documents with the filters
key as follows:
filters:
- abstract-to-meta.lua
- pandoc-crossref
- pandoc-citeproc
This enables a generic build system to be able to compile various report/article documents, some of which require an abstract and others that don't. This change prevents that from being possible.
Consider the following text:
C uses `{` and `}` to delimit scopes.
which converts to the following LaTeX:
C uses \mintinline[]{text}{{} and \mintinline[]{text}{}} to delimit scopes.
For \mintinline
, if using braces for the final parameter, it extends to balanced braces. The resulting PDF looks something like:
C uses
{} and \mintinline[]{text}{}
to delimit scopes.
For these cases, \mintinline
works like \verb
in that it can accept almost any other character as a delimiter, e.g., \mintinline[]{text}|{| and \mintinline[]{text}|}|
would work in this case. I opened a PR to the Python version of this filter nick-ulle/pandoc-minted#8 just before I found this one. Unfortunately, I'm not as familiar with Lua so I can't do the same here.
cc @svenevs
Coming from the discussion over at pandoc discuss, I'd like to record that erroneous notifications such as
pandoc-citeproc: reference XY not found
have been reduced by the uploaded multiple-bibliographies
filter, but not yet eradicated completely: There's still one error per citation.
While this is a minor issue - after all the functionality is not affected -, in a document with hundreds of citations, this may still lead to oneself missing warranted error notifications in case a cited work is really not included in the bibliography.
Don't want to be pedantic, but I thought noting the issue here couldn't hurt. Again, thanks for uploading the filter in the first place!
Many tests use golden files to check correctness of the produced output. This is fragile and breaks whenever the pandoc template changes for the given format. Tests should rather check for the existence of certain keywords in the output.
Filters with fragile tests:
I am writing a thesis, for which I use pandocomatic and standard pandoc filters to convert multiple markdown files (chapters) to pdf. Using the section-ref filter, I was able to have a reference section for each chapter. However, the numbering doesn't reset for that chapter. If I repeat a citation in chapter 2, I would get the same numbering as the filter specified for chapter 1. The following is my header.md
file which I use with pandocomatic.
---
pandocomatic:
# use-templates: custom-cambria # uncomment when converting to docx
pandoc:
from: markdown
to: pdf
standalone: true
toc: true
number-sections: true
template: ./templates/phdthesis # comment when converting to docx
pdf-engine: xelatex
include-in-header: ./templates/phdthesis_preamble.latex
bibliography: ./library.bib
# natbib: true
csl: ./acs-nano.csl
papersize: letter
mathjax: true
filter:
- pandoc-citeproc
# - pandoc-crossref
# - filters/pandoc-unicode-math
# - filters/pandoc-unicode-math-from-latex
top-level-division: chapter
lua-filter:
- ./section-refs.lua
# - pagebreak/pagebreak.lua
# - multiple-bibliographies/multiple-bibliographies.lua
link-citations: true
# reference-section-title: "References"
metadata:
author: Huy Nguyen
mainfont: STIX
sansfont: Noto Sans
monofont: Noto Mono
mathfont: XITS Math
fontsize: 12 pt
figPrefix: ['Fig.', 'Figs.']
eqnPrefix: ['Eq.', 'Eqs.']
tblePrefix: ['Table', 'Tables']
geometry:
- top=1in
- bottom=1in
- left=1in
- right=1in
header-includes:
- \usepackage{siunitx}
- \usepackage{unicode-math}
- \usepackage{lmodern}
- \usepackage{MnSymbol}
# - \usepackage{physics}
---
<!-- Here I define some latex command to shorten my math -->
\newcommand{\bra}[1]{\left\langle#1\right|}
\newcommand{\ket}[1]{\left|#1\right\rangle}
\newcommand{\braket}[2]{\left\langle#1\right|\left.#2\right\rangle}
\newcommand{\mel}[3]{\left\langle#1\right|#2\left|#3\right\rangle}
Could I have some hint as to how to remedy this problem? I have tried to change the section-refs-level from the default of 1, but that didn't seem to do anything.
When I use the diagram-generator.lua filter for an output like sample.docx it works great.
But if I try to generate html output, it seems that the resulting images are not saved to the local disk.
A command such as
pandoc.exe sample.md -f markdown -t html --lua-filter=filters\diagram-generator.lua -o sample.html
produces html with refrence to svg file, but it is not to be found in the local directory.
<img src="d035718761b975cd37a9e2c839b3e3db27f6e8ab.svg" alt="" /><figcaption>This is an image, created by <strong>PlantUML</strong>.</figcaption>
How do I ensure images are saved?
If cito.lua is applied, it throws the following error, if a citation does not have a cito property:
Error running filter cito.lua:
Could not read list: Could not get Inline value: Expected a string but got a nil
It should work anyway and should default to citation
or cites
.
I am using Atom with Pandoc for Markdown Preivew Plus. I'm using the --lua-filter=task-list.lua
option to convert my task lists. When I type a * or - at the beginning of a line (empty list item) I immediately get the following error.
Command failed: /usr/local/bin/pandoc --from=markdown-raw_tex+tex_math_single_backslash --to=html --lua-filter=task-list.lua Error running filter task-list.lua: Error while running filter function: /Users/xxxxxx/.pandoc/filters/task-list.lua:90: attempt to index a nil value (local 'blk')
If I continue to type, it begins to correctly render again however it leaves the error overlay in the editor.
I have a functional workaround by inserting a quick check at the top of the function to return if blk is nil. Although this works for my purposes, I am not a lua programmer and I have no earthly idea what other ramifications this might have.
function M.replace_todo_markers (blk, format)
+ if blk == nil then
+ return
+ end
https://mermaid-js.github.io/mermaid/#/
There is a cli app https://github.com/mermaid-js/mermaid-cli available. You just need to npm install @mermaid-js/mermaid-cli
and run it using npx
. As an example, to process all the files once extracted:
for i in *.mmd; do npx mmdc -i "$i" -o "${i%.*}.png" -b transparent -t forest; done
Would be great to get that included!
For someone new to pandoc, could someone explain the advantages of using a lua-filter instead of a template for scrlttr2 such as https://github.com/JensErat/pandoc-scrlttr2 ?
Currently it does not seem like bibexport
simply finds and exports cited bib entries.
For example, @online
is one of the entries that bibexport does not export in an appropriate form.
My guess is that bibexport
just only does a good job for BibTeX
entries, not for other newly added types in BibLaTeX
.
Would there be any way to simply parse multiple bib file entries and export them into one bib file regardless of their entry types?
bibexport
does not feel universal.
What is the recommended method to install?
As I understand it, you have to put the complete path after --lua-filter
.
(I tried to modify my $PATH$
)
should work with listings and list of listings also
I'm trying to write multiple articles in rmarkdown. Here is my YAML setting:
---
bibliography_article1: article1.bib
bibliography_article2: article2.bib
bibliography_article3: article1.bib
bibliography_article4: article1.bib
csl: sage-vancouver.csl
output:
html_document:
pandoc_args: --lua-filter=multiple-bibliographies.lua
---
Note that vancouver style makes numbers for in-text citation as in this link
Now if I started writing my articles. like
# Article 1
Some text[@authorx_refy]
## References
::: {#refs_article1}
:::
# Article 2
Another text[@authory_refx]
## References
::: {#refs_article2}
:::
Now the results will look like
Some text. 1
Another text. 2
Is there is a way to reset numbering after article 1, so article 2 starts counting from 1?
I'm getting an error when trying to generate a pdf using the lua scripts for a sensible academic author/affiliation syntax. I've tried several of the allowed variants on the author/institute syntax such as not using 'name:' explicitly and using numbers to identify the institute(s) but always get the same error
I'm I missing something or is there a bug?
my example YAML header:
---
title: "R Notebook"
author:
- name: R. Acton
institute: soton
institute:
- soton: Biological Sciences, University of Southampton, Southampton, U.K.
output:
pdf_document:
number_sections: yes
pandoc_args:
- '--lua-filter=scholarly-metadata.lua'
- '--lua-filter=author-info-blocks.lua'
---
This header gives me this error:
Error running filter author-info-blocks.lua:
Error while running filter function:
[string "author-info-blocks.lua"]:168: attempt to call a nil value (method 'map')
Error: pandoc document conversion failed with error 83
Execution halted
rmarkdown::pandoc_version()
#> [1] ‘2.3.1’
rstudioapi::versionInfo()$version
#> [1] ‘1.2.1335’
sessionInfo()
# R version 3.6.1 (2019-07-05)
# Platform: x86_64-pc-linux-gnu (64-bit)
# Running under: Ubuntu 18.04.3 LTS
#
# Matrix products: default
# BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
# LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
#
# Random number generation:
# RNG: Mersenne-Twister
# Normal: Inversion
# Sample: Rounding
#
# locale:
# [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
# [4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
# [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
# [10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# loaded via a namespace (and not attached):
# [1] compiler_3.6.1 bookdown_0.11 magrittr_1.5 htmltools_0.3.6 tools_3.6.1 base64enc_0.1-3
# [7] rstudioapi_0.10 yaml_2.2.0 Rcpp_1.0.2 stringi_1.4.3 rmarkdown_1.13 knitr_1.23
# [13] jsonlite_1.6 stringr_1.4.0 xfun_0.8 digest_0.6.20 evaluate_0.14
The prerequisites mention a bibexport
excecutable. Please create a hyperlink to this tool. I've tried it with bibexport.sh and also with bibtool. None of them produced a valid bib file.
Trying to compile the provided sample file into a PDF gives an error due to \undef
being an undefined control sequence.
% pandoc -s --lua-filter table-short-captions.lua -F pandoc-crossref sample.md -o sample.pdf
Error producing PDF.
! Undefined control sequence.
l.163 \undef
@blake-riley, can you take a look?
Hi,
I am having the issue of author names extending beyond the bounds of the respective pdf output. This is the command I use: pandoc --lua-filter=./lua/scholarly-metadata.lua --lua-filter=./lua/author-info-blocks.lua --filter pandoc-citeproc title.md studyarea.md references.md -s -o manuscript.pdf
Output to docx and html work just fine. Is there any easy solution to this? Or is it related to the default.latex template?
Sorry, wrong project
I think there is some missing piece to make pagebreak filter work with ODT document, even following the readme.
pagebreak.odt
is not used and format odt
is not known by lua filter.
Probably I should migrate https://github.com/pandoc-extras/luapandoc-filters to this one. Currently, the makefile I setup in pandoc-extras/luapandoc-filters is a plain makefile (that does not use recursion). But the makefile in pandoc/lua-filters by @jgm uses recursive makefile.
Recursive makefile will
while a "plain" makefile will
I planned to setup a Travis CI to auto-check this, and requires pull requests should have a corresponding example for both a test and as an example. This example will not only be used as a test in CI, but also as a rendered example in an automated "gallery" for filters.
When there is a footnote in a figure's (long) caption, adding a short-caption to the figure breaks the footnote (the footnote text vanishes).
The new documentation from #31 is very helpful. But I am having trouble getting pandoc.read
to return something that contains a list of blocks. There is a Lua table there, but the keys look like large negative integers, and ipairs
does not produce the blocks. Also indexing blocks[1]
returns nil.
Here is a minimal working example filter that demonstrates the issue:
local function block_issues()
local results = { } -- supposed to include every block read
local loaded = pandoc.read 'I rejected a *thing*.\n\nSecond block.\n'
local outcome = 'Never found a block'
for _, b in ipairs(loaded.blocks) do
outcome = 'Found a block'
table.insert(results, b)
io.stderr:write('inserted', tostring(b), '\n')
end
io.stderr:write(outcome, '\n')
io.stderr:write('returning ', tostring(#results), ' blocks\n')
return results
end
block_issues()
return { }
I ran this by pandoc --lua-filter=./read-trouble < /dev/null
, getting this output:
nr@yorkie ~/tmp> pandoc --lua-filter=./read-trouble < /dev/null
Never found a block
returning 0 blocks
Pandoc has this to say about its version:
pandoc 2.2.1
Compiled with pandoc-types 1.17.4.2, texmath 0.11.0.1, skylighting 0.7.1
Default user data directory: /home/nr/.pandoc
I am using pandoc 2.10 together with the current version of lua-filters/diagram-generator. I try to create diagrams using graphviz. But for one page I need the neato
-binary from graphviz instead of dot
. According to the documentation I should be able to set metadata dotPath
to affect this. This works cool from the command line via --metadata dotPath=/usr/bin/neato
. But if I try to add the information inside the file as follows
---
dotPath: /usr/bin/neato
---
# Test a graphviz image.
~~~graphviz
graph test {
A -- B;
C -- B;
D -- B;
B -- E;
C -- E;
}
~~~
I just get an error message: PandocLuaError "Error during function call: expected string, got 'table: 0x5e11780' (table)"
. It seems that pandoc returns a table with the string inside a text
key. I am not sure if I am doing something wrong, or if maybe in pandoc the structure of metadata was changed somewhere to 2.10. I tried to work around the problem, but I am either incompatible to the structure coming from the yaml-meta or coming from the commandline metadata parameter. Can anybody help?
When writing articles, sometimes there is a character limit instead of a word limit. Thus, it would be nice to have the wordcount filter additionally output the character count (probably with and without spaces).
Currently, if a document is converted directly to a non-markdown format like pdf, no citos can be obtained. Writing the yaml cito collection to a separate file could be useful for other programs than lua filters.
The task-list.lua
filter currently eats up any header-includes
defined via in YAML headers.
I'm invoking pandoc v2.1.1
via the following batch script:
pandoc --no-highlight ^
--from markdown_github+smart+yaml_metadata_block+auto_identifiers ^
--to html5 ^
--template ./architect.template ^
--output ./index.html ^
--lua-filter=task-list.lua ^
../README.md ./configuration.yaml
where the ./configuration.yaml
file contains some header-includes
entries:
header-includes:
- |
<!-- anything you put here will go verbatim in the header section
Useful for adding javascripts, custom metadata, and so on... -->
- |
<!-- another -->
these entries don't show up in the final HTML doc; but if I remove the --lua-filter=task-list.lua
option from the script, they show up as intended.
I've looked at the source of the Task List filter, and it looks like it does check if elements are present in the list of header-includes
, but apparently it fails when YAML headers are involved:
--- Add task-list CSS styles to the header.
function M.add_task_list_css(meta)
local header_includes
if meta['header-includes'] and meta['header-includes'].t ~= 'MetaList' then
header_includes = meta['header-includes']
else
header_includes = pandoc.MetaList{meta.header_includes}
end
header_includes[#header_includes + 1] =
pandoc.MetaBlocks{pandoc.RawBlock('html', M.css_styles)}
meta['header-includes'] = header_includes
return meta
end
When you have subfigures like this (and using pandoc-crossref
)
<div id="fig:figureRef">
![subfigure 1 caption](example-image-a){#fig:figureRefA short-caption="short subfigure caption A" width=45%}
![subfigure 2 caption](example-image-b){#fig:figureRefB short-caption="short subfigure caption B" width=45%}
Caption of figure
</div>
the filter won’t work, since it adds another figure
environment.
\begin{figure}
\centering
\begin{figure}
\centering
\subfloat[subfigure 1
caption]{\includegraphics[width=0.45\textwidth,height=\textheight]{example-image-a}\label{fig:figureRefA}}
\caption[{short subfigure caption A}]{subfigure 1 caption}
\label{fig:figureRefA}
\end{figure}
\begin{figure}
\centering
\subfloat[subfigure 2
caption]{\includegraphics[width=0.45\textwidth,height=\textheight]{example-image-b}\label{fig:figureRefB}}
\caption[{short subfigure caption B}]{subfigure 2 caption}
\label{fig:figureRefB}
\end{figure}
\caption{Caption of figure}
\label{fig:figureRef}
\end{figure}
it would be awesome if somebody could enhance the include_files filter to be recursive (aborting with an error if already found paths are to be included -> cycles)
It should be documented that the order of pandoc filters is important. If for instance pandoc-crossref or pandoc-fignos is used but cito.lua executed before these filters, it throws an error:
Error running filter cito.lua:
Could not read list: Could not get Inline value: Expected a string but got a nil
That is because of references to figures, tables, etc. which typically look like @fig:img01
but cito does not now of an ontology like fig, tbl, sec, etc.
Hence, it --lua-filter=cito.lua
must be written after these filters (-F pandoc-crossref.exe
) at the command line.
The diff in the Makefile
s should ignore different line endings. Even if it is a rare case, it should be considered. I've checked out the filters on Windows using Git. This defaults to check out using CRLF as line endings. Running the test (make) works fine but running the test on the same folder with Linux (either Windows Subsystem of Linux or a mounted network share on a Linux machine) fails the test.
I recommend using the parameter --strip-trailing-cr
with diff
.
When aspell is run on a raw Markdown file that contains a possessive such as pandoc's
, the entire string pandoc's
is returned as a misspelled word. When the pandoc spellcheck filter is run on that Markdown file, only the suffix s
is returned. The behavior is similar for other words with apostrophes.
I noticed the spellcheck filter uses the following pattern to capture text from the aspell output
lua-filters/spellcheck/spellcheck.lua
Line 33 in 3c870cb
I'm not confident that is causing this behavior, but the behavior is unexpected. It causes the spellcheck filter to always return the string suffixes that follow an apostrophe, even if those suffixes are in the aspell custom dictionary.
should work with tables and List of tables also
Trying to compile sample.md to PDF via pandoc -M trackChanges:all --track-changes=all --lua-filter=track-changes.lua --pdf-engine=xelatex --output sample.pdf sample.md
leads to the following error:
Error producing PDF.
! LaTeX Error: Option clash for package todonotes.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.61 \setlength
Compiling with track-changes=reject
or track-changes=accept
seems to work ok.
@tolot27, could you take a look?
I find that truncating the long caption after the first sentence often suffices for my needs, i.e. truncate the caption after the first period which is not followed by a space. A somewhat more general variant could also use a (lookahead?) regex given as a further attribute. I just tried to add this myself, but unfortunately, my knowledge of Lua and Pandoc AST internals is not yet up to the task...
When I open up a filter folder, it takes a bit for my eye to find the filter itself. I think it might be off-putting for users pointed from pandoc-discuss or elsewhere.
What about
|-- bibexport
| |-- README.md
| |-- bibexport.lua
| +-- tests
| |-- Makefile
| |-- coffee.bib
| |-- expected.bibexport.aux
| +-- ...
|
|-- section-refs
| |-- README.md
| |-- section-refs.lua
| +-- tests
| |-- Makefile
| |-- bibliography.bib
| +-- ...
...
and then just change FILTERS
in the top Makefile to point accordingly?
When using a CSL style where subsequent-author-substitute
is active (such as chicago-author-date.csl
), in some contexts the substitute (“———”) appears though the item in question is not preceded by an earlier item that starts with the same author’s name.
In the example below, e.g., it appears as if “Doe’s Second Book” were written by “Abel”.
MWE:
pandoc -s -F pandoc-citeproc --lua-filter ~/.pandoc/section-refs.lua -t plain << EOT
# Section One
Foo [@abel; @doe2].
## References {-}
# Section Two
Foo [@doe1; @doe2].
## References {-}
---
references:
- id: doe1
type: book
author:
- family: Doe
given: Jane
issued:
- year: 2017
title: Doe’s first book
- id: doe2
type: book
author:
- family: Doe
given: Jane
issued:
- year: 2018
title: Doe’s second book
- id: abel
type: book
author:
- family: Abel
given: Niels
issued:
- year: 2018
title: Abel’s Book
...
EOT
Expected output:
SECTION ONE
Foo (Abel 2018; Doe 2018).
References
Abel, Niels. 2018. _Abel’s Book_.
Doe, Jane. 2018. _Doe’s Second Book_.
SECTION TWO
Foo (Doe 2017, 2018).
References
Doe, Jane. 2017. _Doe’s First Book_.
———. 2018. _Doe’s Second Book_.
Actual output:
SECTION ONE
Foo (Abel 2018; Doe 2018).
References
Abel, Niels. 2018. _Abel’s Book_.
———. 2018. _Doe’s Second Book_.
SECTION TWO
Foo (Doe 2017, 2018).
References
Doe, Jane. 2017. _Doe’s First Book_.
———. 2018. _Doe’s Second Book_.
I do realize this might be difficult to fix given the general approach of this filter – but at the very least it seems to merit a note warning users not to expect correct results when using “subsequent-author-substitute” styles.
Dear all,
Thank you very much for the filter collection. They can simplify our input files. I noticed though that the filter abstract-to-meta
does not copy over lists.
Best,
Robert
Command for testing: pandoc --atx-header -L abstract-to-meta.lua -s -t markdown input.md > output.md
# Abstract
Abstract text.
- one
- two
# Next Section
Other text.
---
abstract: |
Abstract text.
one
two
-
-
---
# Next Section
Other text.
I would love to use a filter similar to short-captions
to add a short title to my titles. For instance like
# very long title {short="short title"} {#mylink}
should become
\hypertarget{mylink}{%
\section[short title]{very long title}%
\label{mylink}}
A python filter suggested in a pandoc issue handles that case as long as there is no pandoc-crossref link anchor.
I'm running
pandoc file.md --filter ./task-list.lua -o file.pdf
to test task lists in GitHub-flavored Markdown, but i get
pandoc: Error running filter ./task-list.lua fd:4: hClose: resource vanished (Broken pipe)
What's wrong?
If #25 is fixed, it would be great to enable/disable the yaml output of simple citations with the property citation
or cites
.
It would be nice to add the licence information to abstract-to-meta.lua
file similar to the other lua files in the repository.
I was attempting to put my logo (png file) in my cover letter using scrlttr2.lua
filter.
According to the instruction, it seems like I can pass my logo image file_name to either fromlogo
or logo
field in YAML.
However, it does not put my image for my letter; instead, it prints the file name string of the logo image in the pdf output.
Would you mind taking a look at this issue?
Many thanks.
I've been using the scholarly-metadata and author-info-blocks lua filters to generate docx files from markdown without issue.
When I tried to do the same for pdf, I received the following error:
Error running filter author-info-blocks.lua:
Error while running filter function: author-info-blocks.lua:168: attempt to call a nil value (method 'map')
A minimal-working-example that reproduces it is
---
title: A title
author:
- author1:
institute: [somewhere]
- author2:
institute: [somewhere]
correspondence: "yes"
email: [email protected]
institute:
- somewhere: Somewhereville, USA
---
# Header 1
aaaa
# Header 2
aaaa
## Subheader 2.1
ddddd
I tried to invoke pandoc as
pandoc -s temp.md -t latex -o temp.pdf --filter pandoc-citeproc --filter pandoc-crossref --lua-filter scholarly-metadata.lua --lua-filter author-info-blocks.lua
I am aware that there are other ways of inserting this type of metadata into pdf output, but I was curious if it was possible to do so in such a way that allows outputting both to docx and pdf without changing the yaml header.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.