Closed philomorphism closed 1 year ago
here are some of the web source examples this PR is solving. the empty newlines seen here get multiplied on every ./bb rebuild
. (the number of empty lines generally suggests the number of time the rebuild command was issues on the site)
on all rebuild run the
main()
function callsrebuild_all_entries()
, within which a call toget_html_file_content()
is made, and then using the returned information along with timestamp found in the entry a call tocreate_html_page()
is made.but the definition of
create_html_page()
contains the lineecho -e '\n<!-- text end -->'
. the newline character causes all the mess in the rebuilt entries. this happens because newline character gets multiplied in the process of regeneration, and that happens because the functionget_html_file_content()
returns all the lines between'<!-- $1 begin -->'
and'<!-- $2 end -->'
, where the variables are either "entry" or "text". but this "content" includes the newline character that was inserted (which was necessary) in the first call tocreate_html_page()
, and then becauserebuild_all_entries()
calls it again, on each such call an another newline character is added.instead of adding (on which i haven't given much thought though) conditional statement in
create_html_page()
, the solution i have given is to just truncate the newline character from the returned string ofget_html_file_content()
to keep the "content" invariant under all these callings.(this is my first open source commit, i apologize for explaining in boring details. btw, BashBlog is beautiful, thank you!)