patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 26e96ecbd1f66638bf63c6f6ac6cab225a6c8076 2770 bytes (raw)
name: Documentation/_includes/sitemap.html 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-FileCopyrightText: 2026 Valentin Gagarin <valentin@gagarin.work>

Render a nested sitemap rooted at a given URL prefix.  Hierarchy is
derived from URL structure: a page is a direct child of prefix P iff
its URL starts with P, is not P itself, and contains no further path
segments below P.
{% endcomment %}

{%- assign default_root = "/" -%}
{% comment %}
`prefix` is the URL of the section to list children of.  It must end with "/",
which we assume if it is constructed by a directory and contains an index file.
{% endcomment %}
{%- assign prefix = include.prefix | default: default_root -%}
{%- capture inner -%}
  {%- assign candidates = site.html_pages
        | where_exp: "p", "p.url contains prefix"
        | where_exp: "p", "p.url != prefix" -%}
  {%- if prefix == default_root -%}
    {%- assign list_with_root_page = site.html_pages | where: "url", prefix -%}
    {%- assign candidates = list_with_root_page | concat: candidates -%}
  {%- endif -%}
  {%- comment %}
  Ordered pages first, ascending.  The rest after, in URL order, so output is deterministic.
  {%- endcomment %}
  {%- assign ordered = candidates | where_exp: "p", "p.nav_order" | sort: "nav_order" -%}
  {%- assign unordered = candidates | where_exp: "p", "p.nav_order == nil" | sort: "url" -%}
  {%- assign sorted = ordered | concat: unordered -%}
  {%- for p in sorted -%}
    {%- comment %}
    `assign` is page-global.  A recursive include below may have overwritten `prefix`.
    {%- endcomment %}
    {%- assign prefix = include.prefix | default: default_root -%}
    {%- assign url_start = p.url | slice: 0, prefix.size -%}
    {%- if url_start == prefix -%}
    {%- assign suffix = p.url | slice: prefix.size, p.url.size -%}
    {%- assign without_slashes = suffix | replace: "/", "" -%}
    {%- assign slashes = suffix.size | minus: without_slashes.size -%}
    {%- assign is_index = false -%}
    {%- if p.name == "index.adoc" or p.name == "index.html" -%}{%- assign is_index = true -%}{%- endif -%}
    {%- assign is_page = false -%}
    {%- if is_index == false and slashes == 0 -%}{%- assign is_page = true -%}{%- endif -%}
    {%- if is_index and suffix == "" -%}{%- assign is_page = true -%}{%- endif -%}
    {%- assign is_section = false -%}
    {%- if is_index and slashes == 1 -%}{%- assign is_section = true -%}{%- endif -%}
    {%- if is_page or is_section %}
    <li>
      <a href="{{ p.url | relative_url }}">{{ p.title }}</a>
      {%- if is_section -%}
        {%- include sitemap.html prefix=p.url -%}
      {%- endif -%}
    </li>
    {%- endif -%}
    {%- endif -%}
  {%- endfor -%}
{%- endcapture -%}
{%- assign trimmed = inner | strip -%}
{%- if trimmed != "" %}
<ul>{{ inner }}
</ul>
{%- endif -%}

debug log:

solving 26e96ec ...
found 26e96ec in https://inbox.spectrum-os.org/spectrum-devel/20260616093527.388679-1-valentin@gagarin.work/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20260616093527.388679-4-valentin@gagarin.work/
found 51c5bb0 in https://inbox.spectrum-os.org/spectrum-devel/20260611063724.487914-3-valentin@gagarin.work/
found 0850a48 in https://inbox.spectrum-os.org/spectrum-devel/20260611063724.487914-2-valentin@gagarin.work/
found cd493f8 in https://inbox.spectrum-os.org/spectrum-devel/20260608164938.290202-5-valentin@gagarin.work/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20260608164938.290202-2-valentin@gagarin.work/ ||
	https://inbox.spectrum-os.org/spectrum-devel/20260611063724.487914-1-valentin@gagarin.work/

applying [1/4] https://inbox.spectrum-os.org/spectrum-devel/20260608164938.290202-5-valentin@gagarin.work/
diff --git a/Documentation/_includes/sitemap.html b/Documentation/_includes/sitemap.html
new file mode 100644
index 0000000..cd493f8

Checking patch Documentation/_includes/sitemap.html...
Applied patch Documentation/_includes/sitemap.html cleanly.

skipping https://inbox.spectrum-os.org/spectrum-devel/20260608164938.290202-2-valentin@gagarin.work/ for cd493f8
skipping https://inbox.spectrum-os.org/spectrum-devel/20260611063724.487914-1-valentin@gagarin.work/ for cd493f8
index at:
100644 cd493f8083a44c6c9f12ffd85fa776641ce4e2e6	Documentation/_includes/sitemap.html

applying [2/4] https://inbox.spectrum-os.org/spectrum-devel/20260611063724.487914-2-valentin@gagarin.work/
diff --git a/Documentation/_includes/sitemap.html b/Documentation/_includes/sitemap.html
index cd493f8..0850a48 100644


applying [3/4] https://inbox.spectrum-os.org/spectrum-devel/20260611063724.487914-3-valentin@gagarin.work/
diff --git a/Documentation/_includes/sitemap.html b/Documentation/_includes/sitemap.html
index 0850a48..51c5bb0 100644


applying [4/4] https://inbox.spectrum-os.org/spectrum-devel/20260616093527.388679-1-valentin@gagarin.work/
diff --git a/Documentation/_includes/sitemap.html b/Documentation/_includes/sitemap.html
index 51c5bb0..26e96ec 100644

Checking patch Documentation/_includes/sitemap.html...
Applied patch Documentation/_includes/sitemap.html cleanly.
Checking patch Documentation/_includes/sitemap.html...
Applied patch Documentation/_includes/sitemap.html cleanly.
Checking patch Documentation/_includes/sitemap.html...
Applied patch Documentation/_includes/sitemap.html cleanly.

skipping https://inbox.spectrum-os.org/spectrum-devel/20260616093527.388679-4-valentin@gagarin.work/ for 26e96ec
index at:
100644 26e96ecbd1f66638bf63c6f6ac6cab225a6c8076	Documentation/_includes/sitemap.html

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).