-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
OrderedList and BulletList break when empty in lua scripts #8916
Comments
Pandoc 3.1.4 output:
|
This is indeed very counterintuitive behavior, but I don't consider it a bug. When pandoc retrieves the list from Lua, it expects a list of items as the Using the correct types will ensure that pandoc won't interpret the input differently to what's intended, e.g. local item = {pandoc.Plain "x"}
local list = pandoc.BulletList{item}
list.content:insert{pandoc.Plain "a"} Note the use of curly braces instead of parentheses. |
Thank you for the great explanation! It makes sense and I agree that it's not a bug at all, the problem clearly is in my code that abuses Pandoc's generic fault tolerance. |
On second thought, maybe pandoc should do better, and maybe we can adjust the behavior to match your expectations. Let me look into that. |
More arguments to change this: local content = {pandoc.Plain "one", pandoc.Plain "two"}
local bl1 = pandoc.BulletList(content)
local bl2 = pandoc.BulletList{}
bl2.content = content
print(bl1)
print(bl2) The lists are different, but should probably be equal. I'll make the change. |
Explain the problem.
OrderedList
s andBulletList
s break internally when empty, they start collapsing their content into one entry.Example
The example consists of 5 examples,
list1
tolist5
.list3
andlist4
present the bug.list5
would be very convenient if it worked. It behaves the same for bothBulletList
andOrderedList
.Tested using a dummy command:
bug.lua
has the following content:The output is:
Pandoc version?
pandoc 3.1.3
Features: +server +lua
Scripting engine: Lua 5.4
OS: Linux
The text was updated successfully, but these errors were encountered: