-
Notifications
You must be signed in to change notification settings - Fork 328
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
General lua improvements #11526
base: main
Are you sure you want to change the base?
General lua improvements #11526
Conversation
fe712ce
to
2d7ef41
Compare
@@ -1,6 +1,10 @@ | |||
-- _utils.lua | |||
-- Copyright (C) 2020-2022 Posit Software, PBC | |||
|
|||
--- The pandoc module. Imported to avoid 'no such variable' | |||
--- warnings in some editors. | |||
local pandoc = require 'pandoc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be careful with require()
because of https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/pandoc/datadir/init.lua#L1403
I'm not sure I want to add it to this PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove that potentially risky local pandoc = require('pandoc')
. But, aside from it, this looks great, thanks!
2d7ef41
to
4274ec0
Compare
Great, thanks! We can talk about |
One final thing. |
Oh, in that case we might also want to redefine that function to be more robust. Also maybe it should only check whether there is any |
I'm wary of overdesigning it without a concrete reason to. "More robust" isn't as actionable as "robust with respect to xyz" - what scenario do you have in mind? |
No, you're right. The suggested alternative wouldn't even work. I think the original version is fine. |
This behaves mostly like the built-in `assert`, but respects the general Quarto scaffolding.
This also fixes unwanted behavior of `as_blocks`, which would treat a list of Inline elements as a list of singleton Plain elements, leading to bad results.
4274ec0
to
4a329c7
Compare
Description
Improve some general Lua functions.