mirror of
https://github.com/bigskysoftware/hypermedia-systems.git
synced 2025-12-05 00:03:55 -05:00
full book in one page updates
This commit is contained in:
parent
fd42cbc447
commit
6836ac43ea
@ -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]
|
||||
|
||||
@ -42,17 +42,22 @@ layout: layout.njk
|
||||
<details>
|
||||
<summary>Contents</summary>
|
||||
|
||||
{% macro toc(block) %}
|
||||
<ul>
|
||||
{% for sect in block.getSections() %}
|
||||
<li>
|
||||
<a href="#{{ sect.getId() }}">{{ sect.getTitle() | safe }}</a>
|
||||
{{ toc(sect) if sect.getSections().length > 0 }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% macro toc(block, level=0) %}
|
||||
{% set isPart = level == 0 and is_whole_book %}
|
||||
{% set isChapter = level == 1 and is_whole_book %}
|
||||
<ul>
|
||||
{% for sect in block.getSections() %}
|
||||
<li>
|
||||
<a href="#{{ sect.getId() }}" class="{{ 'bold' if isPart or isChapter }}">
|
||||
{{ 'Part ' + loop.index + ':' if isPart }}
|
||||
{{ sect.getTitle() | safe }}
|
||||
</a>
|
||||
{{ toc(sect, level + 1) if level < 2 and sect.getSections().length > 0 }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
{{ asciidoc and toc(asciidoc) }}
|
||||
{{ asciidoc and toc(asciidoc, 0) }}
|
||||
</details>
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
||||
@ -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 = `<sub-title>Part ${num}<v-h>:</v-h></sub-title> ${title.join(":")}`
|
||||
});
|
||||
|
||||
$$(document, ".listingblock, .imageblock").forEach((el) => {
|
||||
el.tagName = "figure";
|
||||
el.classList.add("contents"); // Don't draw box around images and code listings
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user