Skip to content

Commit

Permalink
Check if block rather than checking LineNumberNode
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjknox committed Sep 23, 2024
1 parent 475a76b commit 903b233
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 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 @@ -39,16 +43,13 @@ end

function process_multiline(args...)
## Test if argument contains LineNumberNode, and if true return as array of expressions with LineNumberNodes stripped
map(x -> x isa Expr && LineNumberNode in typeof.(x.args) ? filter(y -> !(y isa LineNumberNode), x.args) : x, args)
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...)

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

## If the environment is unspecified, use auto inference.
env = get(kwargs, :env, :auto)

Expand Down

0 comments on commit 903b233

Please sign in to comment.