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

Support multiple args with the lx_* function? #518

Open
findmyway opened this issue Jun 10, 2020 · 1 comment
Open

Support multiple args with the lx_* function? #518

findmyway opened this issue Jun 10, 2020 · 1 comment
Labels
enhancement lx-com

Comments

@findmyway
Copy link
Contributor

findmyway commented Jun 10, 2020

It seems that the number of arguments with the lx_* function defined in utils.jl is hardcoded:

https://github.com/tlienart/Franklin.jl/blob/master/src/parser/latex/blocks.jl#L161

This makes it impossible to support multiple arguments in a latex command.

Though you provide a workaround here: #411 (comment)

\figure{path=“...”, alt=..., caption=“...”}

But this means one has to parse argument names and values by hand.

@tlienart
Copy link
Owner

tlienart commented Jun 10, 2020

right so the reason I did this is that when defining a command via \newcommand, you must explicitly pass the number of arguments. When defining a lx_* you don't specify this and so it's hardcoded to one.

You can see the extractor code in https://github.com/tlienart/PackagePage.jl/blob/master/src/utils.jl but I agree that it's maybe not the easiest.

I'll have a think about it. In theory it could be done by passing an optional kwarg to lx_* so that you'd define lx_*(com, _; nargs=2) but it needs to be done carefully.

(side note: I actually quite like passing named arguments to "latex-like" commands because it becomes more readable which is why I went down that route of parsing the content of the command but I agree that both things should be supported).

@tlienart tlienart added lx-com enhancement labels Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement lx-com
Projects
None yet
Development

No branches or pull requests

2 participants