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

Fix processing of multiline expressions #311

Closed
wants to merge 1 commit into from

Conversation

kenjknox
Copy link

Wanted to allow the processing of block expressions like:

quote a = 1
    b = 2
    c = 3
end

However the current behaviour of latexify is only to return the last line of the expression.

The external fix is to make a custom function to strip the LineNumberNodes and return as an array:

latexifyquote = (ex::Expr; kwargs...) -> latexify(filter(x->!(x isa LineNumberNode), ex.args); kwargs...)

However I expect this is functionality which should belong in the base package, since it is fairly useful and doesn't (to my knowledge) conflict with any other feature.

The core change is adding a function to check if any argument is a Expr containing LineNumberNode and then splitting it into an array so all lines can be processed correctly. Finding the LineNumberNode is assumed to indicate a multiline Expr only.

@kenjknox kenjknox closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant