Skip to content

Commit

Permalink
closes #670 + patch release (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlienart authored Oct 24, 2020
1 parent 93ac79e commit 4f7907a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Franklin"
uuid = "713c75ef-9fc9-4b05-94a9-213340da978e"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.10.6"
version = "0.10.7"

This comment has been minimized.

Copy link
@tlienart

tlienart Oct 24, 2020

Author Owner

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
4 changes: 2 additions & 2 deletions src/converter/markdown/md.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ function convert_md(mds::AbstractString,
(lprelx > 0) && (lxdefs = cat(pastdef.(pre_lxdefs), lxdefs, dims=1))
#>> c. find latex environments
lxenvs, tokens = find_lxenvs(tokens, lxdefs, braces)
deactivate_blocks_in_envs!(blocks, lxenvs)
ranges2 = deactivate_blocks_in_envs!(blocks, lxenvs)
#>> d. find latex commands
lxcoms, _ = find_lxcoms(tokens, lxdefs, braces)

#> 3[ex]. find double brace blocks, note we do it on pre_ocb tokens
# as the step `find_all_ocblocks` possibly found and deactivated {...}.
dbb = find_double_brace_blocks(toks_pre_ocb)
deactivate_inner_dbb!(dbb, ranges)
deactivate_inner_dbb!(dbb, vcat(ranges, ranges2))

# ------------------------------------------------------------------------
#> 4. Page variable definition (mddefs), also if in config, update lxdefs
Expand Down
43 changes: 21 additions & 22 deletions src/parser/ocblocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,33 +141,13 @@ function deactivate_inner_blocks!(blocks::Vector{OCBlock}, nin=MD_OCB_NO_INNER)
return ranges
end


"""
$SIGNATURES
Given ranges found by `deactivate_inner_blocks!` deactivate double brace blocks
that are within those ranges (they will be reprocessed later).
"""
function deactivate_inner_dbb!(dbb, ranges)
isempty(dbb) && return nothing
isempty(ranges) && return nothing
active = ones(Bool, length(dbb))
for (i, d) in enumerate(dbb)
hd, td = from(d), to(d)
r = findfirst(r -> r.first < hd && td < r.second, ranges)
isnothing(r) || (active[i] = false)
end
deleteat!(dbb, map(!, active))
return nothing
end

"""
$SIGNATURES
Deactivate blocks that are contained in an environment so that they be reprocessed later.
"""
function deactivate_blocks_in_envs!(blocks, lxenvs)
lxe_ranges = []
lxe_ranges = Vector{Pair{Int,Int}}()
for lxe in lxenvs
range = from(lxe) => to(lxe)
any(r -> r.first < range.first && r.second > range.second, lxe_ranges) && continue
Expand All @@ -182,7 +162,26 @@ function deactivate_blocks_in_envs!(blocks, lxenvs)
end
end
deleteat!(blocks, inner_blocks)
return
return lxe_ranges
end

"""
$SIGNATURES
Given ranges found by `deactivate_inner_blocks!` deactivate double brace blocks
that are within those ranges (they will be reprocessed later).
"""
function deactivate_inner_dbb!(dbb, ranges)
isempty(dbb) && return nothing
isempty(ranges) && return nothing
active = ones(Bool, length(dbb))
for (i, d) in enumerate(dbb)
hd, td = from(d), to(d)
r = findfirst(r -> r.first < hd && td < r.second, ranges)
isnothing(r) || (active[i] = false)
end
deleteat!(dbb, map(!, active))
return nothing
end

"""
Expand Down

1 comment on commit 4f7907a

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/23600

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.7 -m "<description of version>" 4f7907ac68f46a3262829af987c73f18e697c0ec
git push origin v0.10.7

Please sign in to comment.