Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html-to-markdown.lua error: attempt to call a nil value #555

Closed
renkun-ken opened this issue May 29, 2022 · 5 comments · Fixed by #556
Closed

html-to-markdown.lua error: attempt to call a nil value #555

renkun-ken opened this issue May 29, 2022 · 5 comments · Fixed by #556

Comments

@renkun-ken
Copy link
Member

renkun-ken commented May 29, 2022

The html-to-markdown.lua introduced in #534 does not seem to work with R 4.2 under Ubuntu 20.04.

Error running filter 
/home/ken/R/x86_64-pc-linux-gnu-library/4.2/languageserver/lua/html-to-markdown.lua:
...-gnu-library/4.2/
languageserver/lua/html-to-markdown.lua:9: attempt to call a nil value (field 'to_simple_table')

stack traceback:
	...-gnu-library/4.2/
languageserver/lua/html-to-markdown.lua:9: in function 'Table'
> rmarkdown::pandoc_version()
[1] '2.5'
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.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_4.2.0 cli_3.3.0      jsonlite_1.8.0 rlang_1.0.2
@renkun-ken
Copy link
Member Author

renkun-ken commented May 29, 2022

@atusy any idea?

@eitsupi
Copy link
Contributor

eitsupi commented May 29, 2022

REditorSupport/vscode-R#927 seems to be resolved in my environment on R 4.2.0 on Ubuntu 20.04, could it be due to the version of pandoc?

image

> rmarkdown::pandoc_version()
[1] ‘2.17.1.1> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.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_4.2.0  fastmap_1.1.0   cli_3.3.0       tools_4.2.0     htmltools_0.5.2 rmarkdown_2.14 
 [7] knitr_1.39      xfun_0.31       digest_0.6.29   jsonlite_1.8.0  rlang_1.0.2     evaluate_0.15

@renkun-ken
Copy link
Member Author

renkun-ken commented May 29, 2022

My pandoc is installed from the ubuntu official repo. Maybe it is still too old for the lua script to run properly.

I installed the latest pandoc (2.18.1) and everything works well now. Maybe we should only run the lua script when pandoc is newer than a specific version?

@eitsupi
Copy link
Contributor

eitsupi commented May 29, 2022

It appears that the pandoc.utils.to_simple_table function was added in pandoc 2.11 by jgm/pandoc#6575.
So it would be a good idea to change it to run only on this version or later.

local tb = pandoc.utils.to_simple_table(el)

@atusy
Copy link
Contributor

atusy commented May 30, 2022

Thank you for the inspections and the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants