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

pandoc version 3 issue: Null contrstuctor removed #380

Closed
zkamvar opened this issue Jan 17, 2023 · 1 comment · Fixed by #385
Closed

pandoc version 3 issue: Null contrstuctor removed #380

zkamvar opened this issue Jan 17, 2023 · 1 comment · Fixed by #385
Assignees
Labels
bug Something isn't working pandoc: future An issue that is affected by the upcoming changes in pandoc

Comments

@zkamvar
Copy link
Contributor

zkamvar commented Jan 17, 2023

Windows tests were failing last week due to {rlang} not being available, but they failed yesterday's check, which flagged an error in the build_lesson() example using the nightly build for pandoc:

Pandoc details

pandoc.exe 3.0-nightly-2023-01-16
Features: +server +lua
Scripting engine: Lua 5.4

Error

Error running filter Error: 
  ! in callr subprocess.
  Caused by error: 
  ! pandoc document conversion failed with error 83
  ---
  Standard error:
  Error running filter D:\a\sandpaper\sandpaper\check\sandpaper.Rcheck\sandpaper\rmarkdown\lua\lesson.lua:
  ...heck\sandpaper.Rcheck\sandpaper\rmarkdown\lua\lesson.lua:343: attempt to call a nil value (field 'Null')
  stack traceback:
  ---
  Backtrace:
   1. base::(if (getRversion() >= "3.4") withAutoprint else force)({ …
   2. base::source(exprs = exprs, local = local, print.eval = print., echo = echo, …
   3. | base::withVisible(eval(ei, envir))
   4. | base::eval(ei, envir)
   5. | base::eval(ei, envir)
   6. sandpaper::build_lesson(tmp)
   7. sandpaper:::build_site(path = path, quiet = quiet, preview = preview, override = overr… at build_lesson.R:100:3
   8. sandpaper::build_episode_html(path_md = abs_md[i], path_src = abs_src[i], … at build_site.R:91:5
   9. sandpaper:::render_html(path_md, quiet = quiet) at build_episode.R:80:3
  10. callr::r(function(...) rmarkdown::pandoc_convert(...), args = args, … at render_html.R:59:3
  11. callr:::get_result(output = out, options)
  12. callr:::throw(callr_remote_error(remerr, output), parent = fix_msg(remerr[[3]]))
  ---
  Subprocess backtrace:
  1. rmarkdown::pandoc_convert(...)
  2. rmarkdown:::stop2("pandoc document conversion failed with error ", result)
  3. base::stop(..., call. = FALSE)
  4. | base::.handleSimpleError(function (e) …
  5. global h(simpleError(msg, call))
  Execution halted

Source

The specific message (Error running filter [path]\lesson.lua: [path]\lesson.lua:343: attempt to call a nil value (field 'Null')) points to an error in line 343 of lesson.lua, which returns a null object to replace a questions block so that questions and objectives are grouped into the same block:

handle_our_divs = function(el)
-- Questions and Objectives should be grouped
v,i = el.classes:find("questions")
if i ~= nil then
questions = el
if objectives ~= nil then
return overview_card()
else
return pandoc.Null()
end
end

@zkamvar
Copy link
Contributor Author

zkamvar commented Jan 17, 2023

Doing some digging, it appears that the Null() block type has been removed in pandoc types 1.23: jgm/pandoc-types#91.

The author suggests this replacement/workaround:

Note also that one can always write a filter that is capable of removing Blocks by making the type of the underlying transformation [Block] -> [Block]; in fact I often use a Block -> [Block] and promote it to [Block] -> [Block] using concatMap.

--- jgm/pandoc-types#91 (comment)

@zkamvar zkamvar changed the title pandoc issue pandoc version 3 issue: Null contrstuctor removed Jan 17, 2023
@zkamvar zkamvar self-assigned this Jan 17, 2023
@zkamvar zkamvar added bug Something isn't working pandoc: future An issue that is affected by the upcoming changes in pandoc labels Jan 17, 2023
zkamvar added a commit that referenced this issue Jan 24, 2023
I do not know if this is the correct way to do this, but this will
produce HTML that does the thing I want it to do.

This will fix #380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pandoc: future An issue that is affected by the upcoming changes in pandoc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant