Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\toc error #1061

Closed
yangcht opened this issue Nov 6, 2023 · 7 comments · Fixed by #1062
Closed

\toc error #1061

yangcht opened this issue Nov 6, 2023 · 7 comments · Fixed by #1062

Comments

@yangcht
Copy link

yangcht commented Nov 6, 2023

Hi @mossr, I have been using the \toc function. It is fantastic. However, since the last update, it has stopped working and giving me errors like the following. Do you have any idea how to fix it?

⋮ shutting down LiveServer… ✓
ERROR: ArgumentError: invalid Array dimensions
Stacktrace:
 [1] serve(fw::LiveServer.SimpleWatcher; host::String, port::Int64, dir::String, debug::Bool, verbose::Bool, coreloopfun::Franklin.var"#267#270"{…}, preprocess_request::typeof(identity), inject_browser_reload_script::Bool, launch_browser::Bool, allow_cors::Bool)
   @ LiveServer ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:658
 [2] serve (repeats 2 times)
   @ ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:578 [inlined]
 [3]
   @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:140
 [4] serve()
   @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:49
 [5] top-level scope
   @ REPL[3]:1

caused by: ArgumentError: invalid Array dimensions
Stacktrace:
  [1] Array
    @ Core ./boot.jl:475 [inlined]
  [2] Array
    @ Core ./boot.jl:484 [inlined]
  [3] fill
    @ Base ./array.jl:582 [inlined]
  [4] fill(v::Nothing, dims::Int64)
    @ Base ./array.jl:580
  [5] hfun_toc(params::Vector{String})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/functions.jl:244
  [6] top-level scope
    @ none:1
  [7] eval
    @ Core ./boot.jl:383 [inlined]
  [8] eval
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/Franklin.jl:1 [inlined]
  [9] convert_html_fblock(β::Franklin.HFun)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/functions.jl:18
 [10] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock}, head::Int64, tail::Int64)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:122
 [11] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:102
 [12] convert_html(hs::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:22
 [13] map
    @ Base ./tuple.jl:293 [inlined]
 [14] map
    @ Base ./tuple.jl:294 [inlined]
 [15] write_page(output_path::String, content::String; head::String, pgfoot::String, foot::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:108
 [16] write_page
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:75 [inlined]
 [17] convert_and_write(root::String, file::String, head::String, pgfoot::String, foot::String, output_path::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:215
 [18] process_file_err(case::Symbol, fpair::Pair{String, String}, head::String, pgfoot::String, foot::String, t::Float64)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/file_utils.jl:153
 [19] process_file(::Symbol, ::Pair{String, String}, ::String, ::Vararg{Any})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/file_utils.jl:104
 [20] fd_loop(cycle_counter::Int64, ::LiveServer.SimpleWatcher, watched_files::@NamedTuple{…})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:408
 [21] #267
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:136 [inlined]
 [22] serve(fw::LiveServer.SimpleWatcher; host::String, port::Int64, dir::String, debug::Bool, verbose::Bool, coreloopfun::Franklin.var"#267#270"{…}, preprocess_request::typeof(identity), inject_browser_reload_script::Bool, launch_browser::Bool, allow_cors::Bool)
    @ LiveServer ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:648
 [23] serve (repeats 2 times)
    @ ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:578 [inlined]
 [24]
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:140
 [25] serve()
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:49
 [26] top-level scope
    @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.

The detailed error msgs are:

julia> show(err)
2-element ExceptionStack:
ArgumentError: invalid Array dimensions
Stacktrace:
 [1] serve(fw::LiveServer.SimpleWatcher; host::String, port::Int64, dir::String, debug::Bool, verbose::Bool, coreloopfun::Franklin.var"#267#270"{@NamedTuple{other::Dict{Pair{String, String}, Float64}, infra::Dict{Pair{String, String}, Float64}, md::Dict{Pair{String, String}, Float64}, html::Dict{Pair{String, String}, Float64}, literate::Dict{Pair{String, String}, Float64}}}, preprocess_request::typeof(identity), inject_browser_reload_script::Bool, launch_browser::Bool, allow_cors::Bool)
   @ LiveServer ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:658
 [2] serve (repeats 2 times)
   @ ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:578 [inlined]
 [3] serve(; clear::Bool, verb::Bool, port::Int64, single::Bool, prerender::Bool, nomess::Bool, is_final_pass::Bool, no_fail_prerender::Bool, eval_all::Bool, silent::Bool, cleanup::Bool, on_write::Franklin.var"#268#271", log::Bool, host::String, show_warnings::Bool, fail_on_warning::Bool, launch::Bool, no_set_paths::Bool, join_to_prepath::String)
   @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:140
 [4] serve()
   @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:49
 [5] top-level scope
   @ REPL[3]:1

caused by: ArgumentError: invalid Array dimensions
Stacktrace:
  [1] Array
    @ Core ./boot.jl:475 [inlined]
  [2] Array
    @ Core ./boot.jl:484 [inlined]
  [3] fill
    @ Base ./array.jl:582 [inlined]
  [4] fill(v::Nothing, dims::Int64)
    @ Base ./array.jl:580
  [5] hfun_toc(params::Vector{String})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/functions.jl:244
  [6] top-level scope
    @ none:1
  [7] eval
    @ Core ./boot.jl:383 [inlined]
  [8] eval
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/Franklin.jl:1 [inlined]
  [9] convert_html_fblock(β::Franklin.HFun)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/functions.jl:18
 [10] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock}, head::Int64, tail::Int64)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:122
 [11] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:102
 [12] convert_html(hs::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:22
 [13] map
    @ Base ./tuple.jl:293 [inlined]
 [14] map
    @ Base ./tuple.jl:294 [inlined]
 [15] write_page(output_path::String, content::String; head::String, pgfoot::String, foot::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:108
 [16] write_page
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:75 [inlined]
 [17] convert_and_write(root::String, file::String, head::String, pgfoot::String, foot::String, output_path::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:215
 [18] process_file_err(case::Symbol, fpair::Pair{String, String}, head::String, pgfoot::String, foot::String, t::Float64)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/file_utils.jl:153
 [19] process_file(::Symbol, ::Pair{String, String}, ::String, ::Vararg{Any})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/file_utils.jl:104
 [20] fd_loop(cycle_counter::Int64, ::LiveServer.SimpleWatcher, watched_files::@NamedTuple{other::Dict{Pair{String, String}, Float64}, infra::Dict{Pair{String, String}, Float64}, md::Dict{Pair{String, String}, Float64}, html::Dict{Pair{String, String}, Float64}, literate::Dict{Pair{String, String}, Float64}})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:408
 [21] #267
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:136 [inlined]
 [22] serve(fw::LiveServer.SimpleWatcher; host::String, port::Int64, dir::String, debug::Bool, verbose::Bool, coreloopfun::Franklin.var"#267#270"{@NamedTuple{other::Dict{Pair{String, String}, Float64}, infra::Dict{Pair{String, String}, Float64}, md::Dict{Pair{String, String}, Float64}, html::Dict{Pair{String, String}, Float64}, literate::Dict{Pair{String, String}, Float64}}}, preprocess_request::typeof(identity), inject_browser_reload_script::Bool, launch_browser::Bool, allow_cors::Bool)
    @ LiveServer ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:648
 [23] serve (repeats 2 times)
    @ ~/.julia/packages/LiveServer/3Dvy0/src/server.jl:578 [inlined]
 [24] serve(; clear::Bool, verb::Bool, port::Int64, single::Bool, prerender::Bool, nomess::Bool, is_final_pass::Bool, no_fail_prerender::Bool, eval_all::Bool, silent::Bool, cleanup::Bool, on_write::Franklin.var"#268#271", log::Bool, host::String, show_warnings::Bool, fail_on_warning::Bool, launch::Bool, no_set_paths::Bool, join_to_prepath::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:140
 [25] serve()
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:49
 [26] top-level scope
    @ REPL[3]:1
@ziotom78
Copy link

ziotom78 commented Nov 6, 2023

Hi @mossr, I have been using the \toc function. It is fantastic. However, since the last update, it has stopped working and giving me errors like the following. Do you have any idea how to fix it?

I get the same error using Franklin.jl 0.10.94 and Julia 1.9.1, but the line numbers are slightly different:

julia> using Franklin

julia> serve()
  Activating project at `~/Documents/corsi/laboratorio_calcolo/tnds-notebooks`
→ Initial full pass...
┌ Franklin Warning: in <lezione10.md>
│ Encountered an issue processing 'lezione10.md' in lcolo/tnds-notebooks.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ ArgumentError("invalid Array dimensions")
└
ERROR: ArgumentError: invalid Array dimensions
Stacktrace:
  [1] Array
    @ ./boot.jl:477 [inlined]
  [2] Array
    @ ./boot.jl:486 [inlined]
  [3] fill
    @ ./array.jl:532 [inlined]
  [4] fill(v::Nothing, dims::Int64)
    @ Base ./array.jl:530
  [5] hfun_toc(params::Vector{String})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/functions.jl:244
  [6] top-level scope
    @ none:1
  [7] eval
    @ ./boot.jl:370 [inlined]
  [8] eval
    @ ~/.julia/packages/Franklin/UskEZ/src/Franklin.jl:1 [inlined]
  [9] convert_html_fblock(β::Franklin.HFun)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/functions.jl:18
 [10] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock}, head::Int64, tail::Int64)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:122
 [11] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:102
 [12] convert_html(hs::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/converter/html/html.jl:22
 [13] map
    @ ./tuple.jl:275 [inlined]
 [14] map
    @ ./tuple.jl:276 [inlined]
 [15] write_page(output_path::String, content::String; head::String, pgfoot::String, foot::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:108
 [16] write_page
    @ ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:75 [inlined]
 [17] convert_and_write(root::String, file::String, head::String, pgfoot::String, foot::String, output_path::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/write_page.jl:215
 [18] process_file_err(case::Symbol, fpair::Pair{String, String}, head::String, pgfoot::String, foot::String, t::Float64)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/file_utils.jl:153
 [19] process_file(::Symbol, ::Pair{String, String}, ::String, ::Vararg{Any})
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/file_utils.jl:104
 [20] fd_fullpass(watched_files::NamedTuple{(:other, :infra, :md, :html, :literate), NTuple{5, Dict{Pair{String, String}, Float64}}}, join_to_prepath::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:265
 [21] serve(; clear::Bool, verb::Bool, port::Int64, single::Bool, prerender::Bool, nomess::Bool, is_final_pass::Bool, no_fail_prerender::Bool, eval_all::Bool, silent::Bool, cleanup::Bool, on_write::Franklin.var"#268#271", log::Bool, host::String, show_warnings::Bool, fail_on_warning::Bool, launch::Bool, no_set_paths::Bool, join_to_prepath::String)
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:126
 [22] serve()
    @ Franklin ~/.julia/packages/Franklin/UskEZ/src/manager/franklin.jl:49
 [23] top-level scope
    @ REPL[2]:1

I am having problems running Franklin.jl on this repository after having run Pkg.update(): https://github.com/ziotom78/tnds-notebooks.

@tlienart
Copy link
Owner

tlienart commented Nov 6, 2023

for anyone stumbling against this, pin Franklin to 0.10.93 ( ] pin [email protected] ) while we investigate (the only change between 93 and 94 is this PR which intended to improve the behaviour of \toc). My bad for not testing this more but hopefully we can get out of this with more robust tests.

@ziotom78 and @yangcht can you guys point to a specific source file that throws this error please?

@ziotom78
Copy link

ziotom78 commented Nov 6, 2023

Hi @tlienart , sure! This one: lezione07.md. (To trigger the error, you have to clone the repository and then run Pkg.update().)

mossr added a commit to mossr/Franklin.jl that referenced this issue Nov 6, 2023
@mossr
Copy link
Contributor

mossr commented Nov 6, 2023

Hey, sorry about that 🙃

I've pushed a fix that simplifies the TOC code with an added test of a more complicated TOC example.

@ziotom78 your TOC now works as expected:
image

@tlienart
Copy link
Owner

tlienart commented Nov 6, 2023

awesome thanks! if @yangcht you could also give a shot to #1062 and confirm it fixes your issue, then we're good to go and I'll get that 🚢 asap 😄

@yangcht
Copy link
Author

yangcht commented Nov 6, 2023

Hi @tlienart, I just did a test with #1062 and it works.

@tlienart
Copy link
Owner

tlienart commented Nov 7, 2023

Released in 0.10.95. Note that CI fails here because of some compat requirement thing that I'm trying to figure out but it shouldn't cause issues elsewhere. https://discourse.julialang.org/t/compat-bounds-for-stdlib-and-empty-intersection-issue-on-ci/105898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants