pandoc document conversion failed with error 83 - lua Meta function issue

Hello,

Since updating R to 4.2.1 (and RStudio, and all my packages), my bookdown that was compiling just fine before these updates won't build and I get this error message:

Error running filter C:\Users\elise\AppData\Local\R\win-library\4.2\bookdown\rmarkdown\lua\custom-environment.lua:
...ibrary\4.2\bookdown\rmarkdown\lua\custom-environment.lua:74: bad argument #1 to 'for iterator' (table expected, got string)
stack traceback:
	...ibrary\4.2\bookdown\rmarkdown\lua\custom-environment.lua:74: in function 'Meta'
Error: pandoc document conversion failed with error 83

I reinstalled Pandoc. And also tinytex.
Here is my session Info:

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rmarkdown_2.14.3  bookdown_0.27.3   ncdf4_1.19        rosm_0.2.6        lubridate_1.8.0  
 [6] leaflet_2.1.1     units_0.8-0       tmap_3.3-3        raster_3.5-21     spData_2.0.1     
[11] colorspace_2.0-3  munsell_0.5.0     viridis_0.6.2     viridisLite_0.4.0 leafsync_0.1.0   
[16] mapview_2.11.0    rgdal_1.5-32      sp_1.5-0          sf_1.0-7          knitr_1.39       
[21] bibtex_0.4.2.3    kableExtra_1.3.4 

loaded via a namespace (and not attached):
 [1] satellite_1.0.4         webshot_0.5.3           RColorBrewer_1.1-3      httr_1.4.3             
 [5] tools_4.2.1             bslib_0.3.1             utf8_1.2.2              R6_2.5.1               
 [9] KernSmooth_2.23-20      DBI_1.1.3               tidyselect_1.1.2        gridExtra_2.3          
[13] compiler_4.2.1          leafem_0.2.0            cli_3.3.0               rvest_1.0.2            
[17] xml2_1.3.3              sass_0.4.1              scales_1.2.0            classInt_0.4-7         
[21] proxy_0.4-27            systemfonts_1.0.4       stringr_1.4.0           digest_0.6.29          
[25] svglite_2.1.0           base64enc_0.1-3         dichromat_2.0-0.1       pkgconfig_2.0.3        
[29] htmltools_0.5.2         fastmap_1.1.0           highr_0.9               htmlwidgets_1.5.4      
[33] rlang_1.0.3             rstudioapi_0.13         jquerylib_0.1.4         farver_2.1.0           
[37] generics_0.1.3          jsonlite_1.8.0          crosstalk_1.2.0         dplyr_1.0.9            
[41] magrittr_2.0.3          s2_1.0.7                Rcpp_1.0.8.3            fansi_1.0.3            
[45] abind_1.4-5             lifecycle_1.0.1         terra_1.5-34            stringi_1.7.6          
[49] yaml_2.3.5              tmaptools_3.1-1         plyr_1.8.7              parallel_4.2.1         
[53] crayon_1.5.1            lattice_0.20-45         stars_0.5-5             leafpop_0.1.0          
[57] pillar_1.7.0            uuid_1.1-0              codetools_0.2-18        stats4_4.2.1           
[61] wk_0.6.0                XML_3.99-0.10           glue_1.6.2              evaluate_0.15          
[65] leaflet.providers_1.9.0 png_0.1-7               vctrs_0.4.1             gtable_0.3.0           
[69] purrr_0.3.4             ggplot2_3.3.6           xfun_0.31               lwgeom_0.2-8           
[73] e1071_1.7-11            class_7.3-20            tibble_3.1.7            ellipsis_0.3.2         
[77] brew_1.0-7

The function Meta in the lua file has something to do with language. I was wondering whether the error is related with the fact that my book is written in French ??
Here is the Meta function:

-- Get metadata specific to bookdown for this filter
Meta = function(m)
    bookdownmeta = m.bookdown
    if (bookdownmeta and bookdownmeta.language and bookdownmeta.language.label) then
        -- For internationalization feature of bookdown
        for k,v in pairs(bookdownmeta.language.label) do
            if (pandoc_type(v) == 'Inlines' and proof_label[k] ~= nil) then
                -- remove any undesired space (3 or less)
                proof_label[k] = pandoc.utils.stringify(v):gsub("%.?%s?%s?%s?$", "")
                print_debug("Translation-> "..k..":", proof_label[k])
            end
        end
    end
end

Any help would be appreciated.

I would like to provide a reproducible example, but not sure how to do it for a bookdown issue.

I solved my problem and posting here in case it is useful to anyone else.

I realized that my bookdown ylm file was missing a tab space in the language section.

language:
  label:
    fig: "FIGURE "
    tab: "TABLEAU "
    eq: "EQUATION "

fig was incorrectly aligned with label, and idem for tab and eq.

For some reason, the missing tab spaces were not a problem under until I updated R and my packages. I assume it is linked to the most recent markdown package (2.14.3), but not sure.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.