Skip to content

Commit

Permalink
closes #891 (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlienart authored Oct 1, 2021
1 parent 7dc5564 commit 88fd8ad
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
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.58"
version = "0.10.59"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
3 changes: 3 additions & 0 deletions src/Franklin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ utils_symb() = Symbol(utils_name())
utils_module() = getproperty(Main, utils_symb())
utils_hash() = nothing

# HACK avoid stackoverflow for pagevar cycle (see juliacomputing issue #891)
const PAGEVAR_DEPTH = Ref{Int}(0)

# keep track of pages which need to be re-evaluated after the full-pass
# to ensure that their h-fun are working with the fully-defined scope
# (e.g. if need list of all tags)
Expand Down
7 changes: 7 additions & 0 deletions src/converter/markdown/md.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ function convert_md(
# instantiate page dictionaries
isrecursive || isinternal || set_page_env()

# HACK avoid stackoverflow in pagevar loop see #891
if pagevar
PAGEVAR_DEPTH[] += 1
else
PAGEVAR_DEPTH[] = 0
end

#
# Parsing of the markdown string
# (to find latex command, latex definitions, math envs etc.)
Expand Down
1 change: 1 addition & 0 deletions src/converter/markdown/tags.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note: the `clean_tags` cleans up orphan tags (tags that wouldn't be pointing
to any page anymore).
"""
function generate_tag_pages(refresh_tags=Set{String}())::Nothing
globvar(:generate_tags)::Bool || return
# if there are no page tags, cleanup and finish
PAGE_TAGS = globvar("fd_page_tags")
isnothing(PAGE_TAGS) && return clean_tags()
Expand Down
5 changes: 5 additions & 0 deletions src/utils/vars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const GLOBAL_VARS_DEFAULT = [
"literate_mds" => dpair(false),
# each cell runs a cd in/out OUT_PATH
"auto_code_path" => dpair(false),
# don't generate tag pages
"generate_tags" => dpair(true),
# -----------------------------------------------------
# LEGACY
"div_content" => dpair(""), # see build_page
Expand Down Expand Up @@ -239,6 +241,9 @@ processed yet so force a pass over that page.
Return `default` (which is `nothing` if not specified) if the variable is not found.
"""
function pagevar(rpath::AS, name::Union{Symbol,String}; default=nothing)
# HACK avoid stackoverflow for pagevar cycle
PAGEVAR_DEPTH[] > 5 && return default

# only split extension if it's .md or .html (otherwise can cause trouble
# if there's a dot in the page name... not recommended but happens.)
rpc = splitext(rpath)
Expand Down

2 comments on commit 88fd8ad

@tlienart
Copy link
Owner Author

Choose a reason for hiding this comment

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

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

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.59 -m "<description of version>" 88fd8adb0d370e63e3522c9544b06541f0209b31
git push origin v0.10.59

Please sign in to comment.