pandoc / lua-filters

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

Error when trying to use section-refs lua filter #189

Closed mattwarkentin closed 3 years ago

mattwarkentin commented 3 years ago

Hi,

I am running into an error when trying to use the section-refs lua filter.

This is the call to pandoc:

pandoc +RTS -K512m -RTS input.md --to latex 
    --from markdown+autolink_bare_uris+tex_math_single_backslash 
    --output output.tex --self-contained --table-of-contents --toc-depth 4 
    --pdf-engine lualatex --include-in-header preamble.tex --wrap preserve 
    --top-level-division=chapter --lua-filter=section-refs.lua 
    --variable tables=yes --standalone -Mhas-frontmatter=false 
    --citeproc 

This is the error:

Unknown option --citeproc.
Try pandoc --help for more information.
Error running filter section-refs.lua:
PandocFilterError "pandoc" "Filter returned error status 6"
stack traceback:
    [C]: in function 'pandoc.utils.run_json_filter'
    section-refs.lua:58: in upvalue 'run_citeproc'
    section-refs.lua:88: in function <section-refs.lua:66>
Error: pandoc document conversion failed with error 83
Execution halted

Any idea what the issue might be? I'm definitely not that familiar with lua and was hoping I could just use this out of the box.

jgm commented 3 years ago

If your pandoc doesn't recognize the --citeproc option, it's probably an old version. That may also be related to the lua filter issue, hard to say. But try upgrading.

badumont commented 3 years ago

From the README: "The pandoc-citeproc filter must either be run before this filter, or not at all. The section-refs.lua filter calls pandoc-citeproc as necessary." It applies to --citeproc as well, I guess.

Le Monday 04 October 2021 à 09:19:57PM, John MacFarlane a écrit :

If your pandoc doesn't recognize the --citeproc option, it's probably an old version. That may also be related to the lua filter issue, hard to say. But try upgrading.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, [1]view it on GitHub, or [2]unsubscribe. Triage notifications on the go with GitHub Mobile for [3]iOS or [4]Android. *

References:

[1] https://github.com/pandoc/lua-filters/issues/189#issuecomment-934046434 [2] https://github.com/notifications/unsubscribe-auth/AMTDGSXN6BJ2LQCXGFU3PCLUFJ4G3ANCNFSM5FKJ5MZQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

svenevs commented 3 years ago

Sounds like that comment on the readme should be updated once we figure out what's going on.

https://github.com/pandoc/lua-filters/blob/5d2024bac3af7c8c2cc1da384484f5e74384e000/section-refs/section-refs.lua#L55-L62

AFAICT this section of the code accounts for the version switch. It was added in

https://github.com/pandoc/lua-filters/commit/ac1d8979af62444fe16c15584aab26cde58736da#diff-30584dc7bc45c5fc5c450773175028587feb4082b4a38e562b78758ba63e5488

Most likely, @mattwarkentin needs to download the newer version of the filter :slightly_smiling_face: Otherwise that part of the code is what you should tinker with.

mattwarkentin commented 3 years ago

Thanks to all for the responses. Indeed this was a versioning issue. Pandoc 2.14.2 was shipped with my daily build of RStudio, but I had an older version of pandoc (2.10.X) installed via Brew. This was causing some friction. Once I removed the brew version and installed 2.14.2 using the most recent mac installer it now works as expected.

mattwarkentin commented 3 years ago

@svenevs I did have the most recent version of section-refs.lua, I think it just didn't like that I had two versions on either side of 2.11 floating around.

svenevs commented 3 years ago

Oh interesting! I think that kind of makes sense, I wonder if there's a PANDOC_EXECUTABLE or something... the switch in the filter calling pandoc ... --citeproc found a different one, only failing because of how old it was. Ideally it would call the same one.

Regardless, glad you got it working again! Not sure why I thought it was likely given the error messages, sorry xD