Giter Site home page Giter Site logo

Comments (3)

TheCedarPrince avatar TheCedarPrince commented on August 22, 2024 1

That was a funny bug! It reminds of the year 2000 glitch! Thanks for the help and guidance @tlienart !

from ft-so-simple.

TheCedarPrince avatar TheCedarPrince commented on August 22, 2024

To make sure I wasn't crazy and that it was working, I tested out your current version off of the master branch. I still get the same error when serving from inside the root directory:

julia> serve()
→ Initial full pass...
→ evaluating code [ex] in (blog/2019/09/code.md)
┌ Franklin Warning: in <index.md>
│ Encountered an issue processing 'index.md' in ts/ft-so-simple/blog.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ ArgumentError("reducing over an empty collection is not allowed")
└
ERROR: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
 [1] process_file(::Symbol, ::Pair{String,String}, ::String, ::Vararg{Any,N} where N) at /h
ome/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/file_utils.jl:72
 [2] fd_fullpass(::NamedTuple{(:other, :infra, :md, :html, :literate),NTuple{5,Dict{Pair{St
ring,String},Float64}}}) at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/fr
anklin.jl:239
 [3] serve(; clear::Bool, verb::Bool, port::Int64, single::Bool, prerender::Bool, nomess::B
ool, is_final_pass::Bool, no_fail_prerender::Bool, eval_all::Bool, silent::Bool, cleanup::B
ool, on_write::Franklin.var"#221#224", log::Bool, host::String, show_warnings::Bool, launch
::Bool) at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/franklin.jl:118
 [4] serve() at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/franklin.jl:66
 [5] top-level scope at REPL[2]:1
caused by [exception 1]
ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
 [1] _empty_reduce_error() at ./reduce.jl:299
 [2] mapreduce_empty(::Function, ::Base.BottomRF{typeof(Base.add_sum)}, ::Type{T} where T)
at ./reduce.jl:342
 [3] reduce_empty(::Base.MappingRF{Main.Utils.var"#3#4"{Dict{Any,Any},String},Base.BottomRF
{typeof(Base.add_sum)}}, ::Type{Any}) at ./reduce.jl:329
 [4] reduce_empty_iter at ./reduce.jl:355 [inlined]
 [5] reduce_empty_iter at ./reduce.jl:354 [inlined]
 [6] foldl_impl at ./reduce.jl:49 [inlined]
 [7] mapfoldl_impl at ./reduce.jl:44 [inlined]
 [8] #mapfoldl#204 at ./reduce.jl:160 [inlined]
 [9] mapfoldl at ./reduce.jl:160 [inlined]
 [10] #mapreduce#208 at ./reduce.jl:287 [inlined]
 [11] mapreduce at ./reduce.jl:287 [inlined]
 [12] sum at ./reduce.jl:494 [inlined]
 [13] sum(::Base.Generator{Base.KeySet{Any,Dict{Any,Any}},Main.Utils.var"#3#4"{Dict{Any,Any
},String}}) at ./reduce.jl:511
 [14] hfun_blog_calendar() at /home/src/Projects/ft-so-simple/utils.jl:39
 [15] top-level scope at none:1
 [16] eval at ./boot.jl:331 [inlined]
 [17] convert_html_fblock(::Franklin.HFun) at /home/cedarprince/.julia/packages/Franklin/bu
5tC/src/converter/html/functions.jl:14
 [18] process_html_qblocks(::String, ::Array{Franklin.AbstractBlock,1}, ::Int64, ::Int64) a
t /home/cedarprince/.julia/packages/Franklin/bu5tC/src/converter/html/html.jl:121
 [19] process_html_qblocks(::String, ::Array{Franklin.AbstractBlock,1}) at /home/cedarprinc
e/.julia/packages/Franklin/bu5tC/src/converter/html/html.jl:101
 [20] convert_html(::String) at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/conver
ter/html/html.jl:22
 [21] map at ./tuple.jl:159 [inlined]
 [22] map at ./tuple.jl:160 [inlined]
 [23] write_page(::String, ::String; head::String, pgfoot::String, foot::String) at /home/c
edarprince/.julia/packages/Franklin/bu5tC/src/manager/write_page.jl:96
 [24] convert_and_write(::String, ::String, ::String, ::String, ::String, ::String) at /hom
e/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/write_page.jl:198
 [25] process_file_err(::Symbol, ::Pair{String,String}, ::String, ::String, ::String, ::Flo
at64) at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/file_utils.jl:97
 [26] process_file(::Symbol, ::Pair{String,String}, ::String, ::Vararg{Any,N} where N) at /
home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/file_utils.jl:59
 [27] fd_fullpass(::NamedTuple{(:other, :infra, :md, :html, :literate),NTuple{5,Dict{Pair{S
tring,String},Float64}}}) at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/f
ranklin.jl:239
 [28] 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"#221#224", log::Bool, host::String, show_warnings::Bool, launc
h::Bool) at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/franklin.jl:118
 [29] serve() at /home/cedarprince/.julia/packages/Franklin/bu5tC/src/manager/franklin.jl:6
6
 [30] top-level scope at REPL[2]:1

Super confused as I have never had this error before. I am using this version of Franklin: [713c75ef] Franklin v0.10.22

from ft-so-simple.

tlienart avatar tlienart commented on August 22, 2024

hahaha this is kind of hilarious, the issue is just that in get_all_blog_posts() it starts at the current year which is 2021 (now), and in the line

yc = sum(length(all_posts[ys][ms]) for ms in keys(all_posts[ys]))

all_posts has no entry for "2021" whence the error. The fix is just to not add an entry for years for which there's no posts of course 😂

I'll open a PR with the fix ;-) (and you should feel free to further modify these functions / make them more robust)

PS: while for sure Franklin can have issues etc, it's usually more likely that a bug comes from utils.jl rather than Franklin itself, so usually I start by putting a few @show in the recalcitrant hfun_* function to see what's going on :)

from ft-so-simple.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.