From 6836ac43ea23627d502c73ad01d9c0a65940dee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deniz=20Ak=C5=9Fim=C5=9Fek?= Date: Tue, 14 Feb 2023 00:40:19 +0300 Subject: [PATCH] full book in one page updates --- book/HypermediaSystems.adoc | 9 +++++---- www/_includes/chapter.njk | 25 +++++++++++++++---------- www/_plugins/postprocess-asciidoc.ts | 5 +++++ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/book/HypermediaSystems.adoc b/book/HypermediaSystems.adoc index bb139f4..843b7e9 100644 --- a/book/HypermediaSystems.adoc +++ b/book/HypermediaSystems.adoc @@ -1,5 +1,5 @@ -= Hypermedia Systems += [.allcaps.big]#Hypermedia Systems# Adam Stepinski, Carson Gross, Deniz Akşimşek :doctype: book :title-page: @@ -7,11 +7,12 @@ Adam Stepinski, Carson Gross, Deniz Akşimşek :toclevels: 2 :toc-title!: :imagesdir: images -:sectnums: -:sectnumlevels: 2 -:showtitle: +:partnums: +:sectnums: all +:sectnumlevels: 4 :layout: chapter.njk :url: ./hypermedia-systems/ +:is_whole_book: 1 ifdef::hypermedia-systems-pdf[] [.toc-container] diff --git a/www/_includes/chapter.njk b/www/_includes/chapter.njk index 9ebb522..f4becc0 100644 --- a/www/_includes/chapter.njk +++ b/www/_includes/chapter.njk @@ -42,17 +42,22 @@ layout: layout.njk
Contents - {% macro toc(block) %} - + {% macro toc(block, level=0) %} + {% set isPart = level == 0 and is_whole_book %} + {% set isChapter = level == 1 and is_whole_book %} + {% endmacro %} - {{ asciidoc and toc(asciidoc) }} + {{ asciidoc and toc(asciidoc, 0) }}
{% endif %} diff --git a/www/_plugins/postprocess-asciidoc.ts b/www/_plugins/postprocess-asciidoc.ts index 9bdd130..042521d 100644 --- a/www/_plugins/postprocess-asciidoc.ts +++ b/www/_plugins/postprocess-asciidoc.ts @@ -7,6 +7,11 @@ export default () => { const document = page.document; if (!document) return; + $$(document, ".sect0").forEach((el) => { + const [num, ...title] = el.innerHTML.split(":"); + el.innerHTML = `Part ${num}: ${title.join(":")}` + }); + $$(document, ".listingblock, .imageblock").forEach((el) => { el.tagName = "figure"; el.classList.add("contents"); // Don't draw box around images and code listings