diff --git a/makefile b/makefile index 61d1a06..bf393ec 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ .DEFAULT_GOAL := build_pdf DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework -DOCKER_CMD := docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c +DOCKER_CMD := docker run -it -v $(PWD):/opt/repo --platform linux/x86_64 $(DOCKER_IMAGE) /bin/bash -c .PHONY: bake build_pdf build_docker_image push_docker_image validate website .PHONY: print_os_version start_shell printvars show_tools_version mrproper diff --git a/website/modify_build.rb b/website/modify_build.rb index 8f527fe..c2fe620 100644 --- a/website/modify_build.rb +++ b/website/modify_build.rb @@ -76,7 +76,7 @@ class ModifyBuild end def is_list_figures_tables?(filename) - ["listfigurename.html", "listtablename.html", "listoflocname.html"].any? do |name| + ["listfigurename.html", "listtablename.html", "listoflocname.html", "bibname.html"].any? do |name| filename.include?(name) end end @@ -245,7 +245,9 @@ class ModifyBuild # Users are lost and can't easily access the root page of the book. This # adds a home menu item. def add_home_link_to_menu(text) - doc = build_doc(text) + # Remove duplicate menu entries first before building clean menu + doc = build_doc(remove_duplicate_entries_menu(text)) + menu = doc.css(".menu-items")[0] return text if menu.nil? @@ -260,6 +262,21 @@ class ModifyBuild List of Flowcharts + + + List of Tables + + + + + List of Figures + + + + + Bibliography + + ⭐️ @@ -277,6 +294,18 @@ class ModifyBuild doc.to_html end + # Some of the menu links are added in the wrong order. Remove them since we + # later on add them in the structure that we want. + def remove_duplicate_entries_menu(text) + doc = build_doc(text) + remove = ["List of Tables", "List of Figures"] + selected_elements = doc.css(".menu-items .chapterToc > a").select do |el| + remove.include?(el.text) + end + selected_elements.each(&:remove) + doc.to_html + end + # Some of the links in the menu have an anchor. This makes clicking through # the menu frustrating as the browser jumps a lot on each request. Only do # this for the top level menu entries though.