pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

Error when generating PDF with academic author syntax (scholarly-metadata.lua & author-info-blocks.lua) #64

Closed RichardJActon closed 5 years ago

RichardJActon commented 5 years ago

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

Version information:

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
tarleb commented 5 years ago

This is a pandoc version issue: the filter assumes an up-to-date pandoc. In case you can't update right now, please try reverting the changes from commit 4b5018486dd7e6c3161d2da819b8455503d0d5c8 in your local repo. See also #59.

RichardJActon commented 5 years ago

Thanks - fixed the path in .Renviron to point to my system pandoc which is 2.7.3 rather than the one that seems to bundled with Rstudio that is was using and that fixed it. Do you know what the minimum pandoc version is that this works on?

tarleb commented 5 years ago

According to the release log, the relevant change was done in pandoc 2.4. I didn't test it though.

RichardJActon commented 5 years ago

Thanks for the help