Skip to content

Commit

Permalink
better fix for <p> and envs
Browse files Browse the repository at this point in the history
  • Loading branch information
tlienart committed Oct 19, 2020
1 parent 89ea131 commit 92cd37e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 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.5"
version = "0.10.6"

This comment has been minimized.

Copy link
@tlienart

tlienart Oct 19, 2020

Author Owner

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
6 changes: 3 additions & 3 deletions src/converter/markdown/md.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function convert_md(mds::AbstractString,
sp_chars, fnrefs, hrules)

#> 2. Form intermediate markdown + html
inter_md, mblocks = form_inter_md(mds, b2insert, lxdefs)
inter_md, mblocks = form_inter_md(mds, b2insert, lxdefs; isrecursive=isrecursive)
inter_html = md2html(inter_md; stripp=isrecursive && !nostripp)

(:convert_md, "inter_md: '$inter_md'") |> logger
Expand Down Expand Up @@ -278,7 +278,7 @@ Form an intermediate MD file where special blocks are replaced by a marker
* `lxdefs`: existing latex definitions prior to the math block
"""
function form_inter_md(mds::AS, blocks::Vector{<:AbstractBlock},
lxdefs::Vector{LxDef}
lxdefs::Vector{LxDef}; isrecursive=false
)::Tuple{String, Vector{AbstractBlock}}
strlen = lastindex(mds)
intermd = IOBuffer()
Expand Down Expand Up @@ -314,7 +314,7 @@ function form_inter_md(mds::AS, blocks::Vector{<:AbstractBlock},
if isa(β, OCBlock) && β.name MD_OCB_IGNORE
head = nextind(mds, to(β))
else
if isa(β, OCBlock) &&.name MD_CLOSEP)
if (isa(β, LxEnv) && !isrecursive) || (isa(β, OCBlock) &&.name MD_CLOSEP))
write(intermd, CLOSEP_INSERT)
else
write(intermd, INSERT)
Expand Down
14 changes: 11 additions & 3 deletions test/latex/begin-end.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ end
s = raw"""
\newenvironment{aaa}{pre}{post}
\newenvironment{bbb}[2]{abc:#1}{def:#2}
ABC
\begin{aaa}
A
\begin{bbb}{00}{11}
Expand All @@ -113,7 +114,7 @@ end
C
\end{aaa}
""" |> fd2html
@test s // "pre A abc: 00 B def: 11 C post"
@test s // "<p>ABC</p>\npre A abc: 00 B def: 11 C post"
end

@testset "env-maths" begin
Expand All @@ -125,7 +126,14 @@ end
\end{align}
BB
""" |> fd2html
@test s // "<p>AA \\[\\begin{aligned}\nA &= B \\\\\nC &= D+E\n\\end{aligned}\\] BB</p>"
@test s // raw"""
<p>AA</p>
\[\begin{aligned}
A &= B \\
C &= D+E
\end{aligned}\]
<p>BB</p>
"""
end

@testset "env-nest" begin
Expand All @@ -142,7 +150,7 @@ end
\end{aaa}
44
""" |> fd2html
@test s // "<p>00 AA 11 BA 22 BB 33 AB 44</p>"
@test s // "<p>00</p>\nAA 11 BA 22 BB 33 AB\n<p>44</p>"
end

@testset "env-errors" begin
Expand Down

1 comment on commit 92cd37e

@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/23259

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.6 -m "<description of version>" 92cd37e11202393ac6667857130b4e6da74c584a
git push origin v0.10.6

Please sign in to comment.