Skip to content

Commit

Permalink
Merge branch 'add_multiline' of https://github.com/kenjknox/Latexify.jl
Browse files Browse the repository at this point in the history
… into add_multiline
  • Loading branch information
kenjknox committed Sep 23, 2024
2 parents fe9ec47 + 903b233 commit 83b2dbf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/latexify_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ L"\begin{equation}
"""
function latexify(args...; kwargs...)
kwargs = merge(default_kwargs, kwargs)

## Split multiline quotes before processing
args = process_multiline(args...)

result = process_latexify(args...; kwargs...)

should_render = get(kwargs, :render, false)
Expand All @@ -37,6 +41,11 @@ function latexify(args...; kwargs...)
return result
end

function process_multiline(args...)
## Test if argument contains LineNumberNode, and if true return as array of expressions with LineNumberNodes stripped
map(x -> Base.isexpr(x, :block) ? filter(y -> !(y isa LineNumberNode), x.args) : x, args)
end

function process_latexify(args...; kwargs...)
## Let potential recipes transform the arguments.
args, kwargs = apply_recipe(args...; kwargs...)
Expand Down

0 comments on commit 83b2dbf

Please sign in to comment.