From 22c5dd2c365b0582adacbc19879fe3bc91f6579e Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 25 Feb 2022 21:35:29 -0500 Subject: [PATCH 1/3] Manual.md: make heading levels match Table of Contents --- Manual.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manual.md b/Manual.md index af5f698debae..80c825087930 100644 --- a/Manual.md +++ b/Manual.md @@ -815,10 +815,10 @@ not a particular package is present in `makedepends` or `hostmakedepends`, that package shouldn't be added as a build time dependency. -#### Repositories +### Repositories -##### Repositories defined by Branch +#### Repositories defined by Branch The global repository takes the name of the current branch, except if the name of the branch is master. Then the resulting @@ -826,7 +826,7 @@ repository will be at the global scope. The usage scenario is that the user can update multiple packages in a second branch without polluting his local repository. -##### Package defined Repositories +#### Package defined Repositories The second way to define a repository is by setting the `repository` variable in a template. This way the maintainer can define repositories for a specific @@ -1910,7 +1910,7 @@ If it is running under another architecture it tries to use the host's `install- utility. -### initramfs-regenerate +#### initramfs-regenerate The initramfs-regenerate trigger will trigger the regeneration of all kernel initramfs images after package installation or removal. The trigger must be From cae8f800d3a4537226822e0f59fc8e0c977c555f Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 25 Feb 2022 21:36:12 -0500 Subject: [PATCH 2/3] manual/: Add script to generate mdbook of Manual.md --- .gitignore | 1 + manual/book.toml | 13 + manual/generate_mdbook.py | 107 ++++++++ manual/src/SUMMARY.md | 1 + manual/src/theme/book.js | 104 ++++++++ manual/src/theme/css/general.css | 419 +++++++++++++++++++++++++++++++ manual/src/theme/css/print.css | 54 ++++ manual/src/theme/favicon.png | Bin 0 -> 5800 bytes manual/src/theme/index.hbs | 157 ++++++++++++ 9 files changed, 856 insertions(+) create mode 100644 manual/book.toml create mode 100644 manual/generate_mdbook.py create mode 100644 manual/src/SUMMARY.md create mode 100644 manual/src/theme/book.js create mode 100644 manual/src/theme/css/general.css create mode 100644 manual/src/theme/css/print.css create mode 100644 manual/src/theme/favicon.png create mode 100644 manual/src/theme/index.hbs diff --git a/.gitignore b/.gitignore index 958f644eee94..52806ca91964 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ etc/conf.* etc/virtual etc/xbps.d/custom .xbps-checkvers*.plist +/manual/book/ diff --git a/manual/book.toml b/manual/book.toml new file mode 100644 index 000000000000..5ef5064d8928 --- /dev/null +++ b/manual/book.toml @@ -0,0 +1,13 @@ +[book] +authors = ["The Void Linux Team"] +multilingual = false +src = "src" +title = "XBPS Source Packages Manual" + +[preprocessor.gen_manual] +command = "python3 generate_mdbook.py" + +[output.html] +# TODO: this should be a submodule or something +# to avoid de-syncing with void-docs/src/theme +theme = "src/theme" diff --git a/manual/generate_mdbook.py b/manual/generate_mdbook.py new file mode 100644 index 000000000000..d8a5f5421625 --- /dev/null +++ b/manual/generate_mdbook.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python3 + +from dataclasses import asdict, dataclass, field +import json +from pathlib import Path +import re +import sys +from typing import Optional + + +HEADING_RE = re.compile(r"###? (?:\w|\d)") +ANCHOR_RE = re.compile(r'') +REL_LINK_RE = re.compile(r"\[(.*)\]\(\./(.*)\)") + + +@dataclass +class Chapter: + name: str + content: str + path: str + source_path: str + number: Optional[list[int]] = None + sub_items: list['Chapter'] = field(default_factory=list) + parent_names: list[str] = field(default_factory=list) + + +@dataclass +class Section: + Chapter: Chapter + + +@dataclass +class Book: + sections: list[Section] + + +def slugify(s: str) -> str: + return s.lower().replace(" ", "-").replace(".", "-").replace("`", "") + + +if __name__ == "__main__": + if len(sys.argv) > 1: + if sys.argv[1] == "supports": + raise SystemExit + + manual = Path("Manual.md").read_text().split("\n") + + sections = [] + curr_chapter = [] + hlevel = None + heading = None + fn = None + in_section = False + + for line in manual: + line = REL_LINK_RE.sub(r"[\1](https://github.com/void-linux/void-packages/blob/master/\2)", line) + + if HEADING_RE.match(line): + if in_section: + if ANCHOR_RE.search(curr_chapter[-1]): + del curr_chapter[-1] + + sections.append( + Section( + Chapter( + name=heading, + number=num, + content="\n".join(curr_chapter), + path=fn, + source_path=fn, + ) + ) + ) + curr_chapter = ["#" + line.lstrip("#")] + hlevel, heading = line.split(" ", maxsplit=1) + fn = f"./{slugify(heading)}.md" + + match len(hlevel): + # intro/help + case 2: + num = None + # other "top" level headings + case 3: + num = [ len(sections) ] + case _: + continue + + in_section = True + elif in_section: + curr_chapter.append(line.replace("####", "##", 1)) + + # get the last section + sections.append( + Section( + Chapter( + name=heading, + number=num, + content="\n".join(curr_chapter), + path=fn, + source_path=fn, + ) + ) + ) + + # mdBook requires this key in the emitted json, for reasons unknown + book = asdict(Book(sections)) | {"__non_exhaustive": None} + print(json.dumps(book)) diff --git a/manual/src/SUMMARY.md b/manual/src/SUMMARY.md new file mode 100644 index 000000000000..73fa82d6e79c --- /dev/null +++ b/manual/src/SUMMARY.md @@ -0,0 +1 @@ + diff --git a/manual/src/theme/book.js b/manual/src/theme/book.js new file mode 100644 index 000000000000..853247bfc4c9 --- /dev/null +++ b/manual/src/theme/book.js @@ -0,0 +1,104 @@ +"use strict"; + +// Fix back button cache problem +window.onunload = function () { }; + +(function sidebar() { + var html = document.querySelector("html"); + var sidebar = document.getElementById("sidebar"); + var sidebarLinks = document.querySelectorAll('#sidebar a'); + var sidebarToggleButton = document.getElementById("sidebar-toggle"); + var firstContact = null; + + function showSidebar() { + html.classList.remove('sidebar-hidden') + html.classList.add('sidebar-visible'); + Array.from(sidebarLinks).forEach(function (link) { + link.setAttribute('tabIndex', 0); + }); + sidebarToggleButton.setAttribute('aria-expanded', true); + sidebar.setAttribute('aria-hidden', false); + try { localStorage.setItem('mdbook-sidebar', 'visible'); } catch (e) { } + } + + function hideSidebar() { + html.classList.remove('sidebar-visible') + html.classList.add('sidebar-hidden'); + Array.from(sidebarLinks).forEach(function (link) { + link.setAttribute('tabIndex', -1); + }); + sidebarToggleButton.setAttribute('aria-expanded', false); + sidebar.setAttribute('aria-hidden', true); + try { localStorage.setItem('mdbook-sidebar', 'hidden'); } catch (e) { } + } + + // Toggle sidebar + sidebarToggleButton.addEventListener('click', function sidebarToggle() { + if (html.classList.contains("sidebar-hidden")) { + showSidebar(); + } else if (html.classList.contains("sidebar-visible")) { + hideSidebar(); + } else { + if (getComputedStyle(sidebar)['transform'] === 'none') { + hideSidebar(); + } else { + showSidebar(); + } + } + }); + + document.addEventListener('touchstart', function (e) { + firstContact = { + x: e.touches[0].clientX, + time: Date.now() + }; + }, { passive: true }); + + document.addEventListener('touchmove', function (e) { + if (!firstContact) + return; + + var curX = e.touches[0].clientX; + var xDiff = curX - firstContact.x, + tDiff = Date.now() - firstContact.time; + + if (tDiff < 250 && Math.abs(xDiff) >= 150) { + if (xDiff >= 0 && firstContact.x < Math.min(document.body.clientWidth * 0.25, 300)) + showSidebar(); + else if (xDiff < 0 && curX < 300) + hideSidebar(); + + firstContact = null; + } + }, { passive: true }); + + // Scroll sidebar to current active section + var activeSection = sidebar.querySelector(".active"); + if (activeSection) { + sidebar.scrollTop = activeSection.offsetTop; + } +})(); + +(function chapterNavigation() { + document.addEventListener('keydown', function (e) { + if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; } + if (window.search && window.search.hasFocus()) { return; } + + switch (e.key) { + case 'ArrowRight': + e.preventDefault(); + var nextButton = document.querySelector('.nav-chapters.next'); + if (nextButton) { + window.location.href = nextButton.href; + } + break; + case 'ArrowLeft': + e.preventDefault(); + var previousButton = document.querySelector('.nav-chapters.previous'); + if (previousButton) { + window.location.href = previousButton.href; + } + break; + } + }); +})(); diff --git a/manual/src/theme/css/general.css b/manual/src/theme/css/general.css new file mode 100644 index 000000000000..e0255a8281b1 --- /dev/null +++ b/manual/src/theme/css/general.css @@ -0,0 +1,419 @@ +body { + font-family: 'Ubuntu', sans-serif; + font-size: 1rem; + line-height: 1.5; + color: #333; + margin: 0; + background-color: #ffffff; +} +h1, h2, h3, h4, h5, h6 { color: #333; } +a { + color: #478061; + text-decoration: none; +} +a:hover { + color: #333; + text-decoration: underline; +} + +code { + background: #fdf6e3; + padding: 2px 4px; + border-radius: 4px; + white-space: pre-wrap; + overflow-wrap: break-word; +} +pre code { + padding: 0; + border-radius: 0; +} +pre { + padding: .5em; + margin: 1em 0; + background: #fdf6e3; + border: 1px solid #ccc; + border-radius: 4px; +} + +blockquote { + margin: 20px 0; + padding: 0 20px; + padding-left: 1em; + background: #ebf4ef; + border: 1px solid #d1e6da; + border-left: none; + border-right: none; +} + +li.js-unavailable { + background-color: #f6cf68; + border-radius: 10px; + margin-left: 1em; + padding-left: 1em; + padding-right: 1em; +} + +table { + border-collapse: collapse; + display: block; + overflow-y: auto; +} +table td { + padding: 3px 20px; + border: 1px #fafafa solid; +} +table thead { + background: #fafafa; +} +table thead td { + font-weight: 700; + border: none; +} +table thead tr { +} +/* Alternate background colors for rows */ +table tbody tr:nth-child(2n) { + background: #fafafa; +} + +svg { + position: relative; + top: .125em; + width: 1em; + height: auto; +} + +.hidden { + display: none; +} + +.icon-button { + border: none; + background: none; + cursor: pointer; + padding: 1em; +} + +/* void navigation */ + +#void-nav { + width: 100%; + min-height: 50px; + background: #478061; + font-size: 14px; + + display: flex; + flex-direction: row; + flex-wrap: wrap; +} +#void-nav button, +#void-nav label { + fill: #fff; + height: 50px; + display: block; + line-height: 50px; + padding: 0 15px; + font-size: 1.2em; +} +#void-nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +#void-nav ul#nav-right { + margin-left: auto; +} + +#void-nav ul li { + display: inline-block; +} +#void-nav ul li a { + color: #fff; + display: block; + padding: 0 15px; + line-height: 50px; + font-size: 1.2em; + text-decoration: none +} +#void-nav ul li a:hover, +#void-nav ul li a:focus, +#void-nav button:hover, +#void-nav button:focus, +#void-nav label:hover, +#void-nav label:focus { + background: #000; +} + +#skip-to-content { + position: absolute; + left: -999px; + top: -999px; +} + +#skip-to-content:active, +#skip-to-content:focus { + position: relative; + left: 0; + top: 0; +} + +/* sidebar */ + +.sidebar-hidden #sidebar { + display: none; +} +#sidebar { + padding: .5em; + background: #fafafa; + font-size: 0.875em; +} +#sidebar ol { + list-style: none; + margin: 0; +} +#sidebar ol.chapter { + padding: 0; + line-height: 2.2em; +} +#sidebar ol.section { + padding-left: 20px; + line-height: 1.9em; +} +#sidebar a { + color: #000; + display: block; +} +#sidebar a:hover { + color: #478061; + text-decoration: none; +} +#sidebar a.active { + color: #478061; +} + +#sidebar-toggle { + display: none; +} + +/* search */ + +#searchbar { + width: 100%; + padding: 10px 16px; + margin: 5px 0; + border-radius: 3px; + border: 1px solid #aaa; +} +#searchresults-header { + font-weight: bold; + font-size: 1em; + padding: 18px 0 0 5px; +} +ul#searchresults { + list-style: none; + padding-left: 20px; +} +ul#searchresults li { + margin: 10px 0px; + padding: 2px; + border-radius: 2px; +} +ul#searchresults span.teaser { + display: block; + clear: both; + margin: 5px 0 0 20px; + font-size: 0.8em; +} + +/* chapter navigation */ + +#nav-wide-wrapper { + max-width: 800px; + margin: 0 auto; + margin-top: 50px; +} +.previous { + float: left; +} +.next { + float: right; + right: 15px; +} +.nav-chapters { + fill: #ccc; + text-align: center; + text-decoration: none; + display: block; + max-width: 150px; + min-width: 90px; +} +.nav-chapters:hover { + text-decoration: none; + fill: #333 +} + +.nav-chapters svg { + margin: 0 auto; + width: 1.5em; +} + +/* layout */ + +body { + box-sizing: border-box; +} +#content { + display: flex; + flex-direction: row; + width: 100%; +} +#page-wrapper { + --content-padding: 10px; + padding: 0 var(--content-padding); + width: calc(100% - var(--content-padding) * 2); +} +#search-wrapper, +#page-wrapper main { + width: 100%; + max-width: 800px; + margin: 0 auto; +} +#sidebar { + max-width: 300px; + flex-shrink: 0; +} + +/* 300px + 800px + 2*90px + 15px */ +@media only screen and (min-width: 1295px) { + .sidebar-visible #nav-wide-wrapper { + max-width: none; + margin: 0; + } + .sidebar-visible .nav-chapters { + background: none; + position: fixed; + top: 50px; + bottom: 0; + margin: 0; + justify-content: center; + align-content: center; + display: flex; + flex-direction: column; + } +} +/* 800px + 2*90px + 15px */ +@media only screen and (min-width: 995px) { + .sidebar-hidden #nav-wide-wrapper { + max-width: none; + margin: 0; + } + .sidebar-hidden .nav-chapters { + background: none; + position: fixed; + top: 50px; + bottom: 0; + margin: 0; + justify-content: center; + align-content: center; + display: flex; + flex-direction: column; + } + table { + display: table; + } +} + +@media (prefers-color-scheme: dark) { + body { + color: #ccc; + background-color: #222; + } + h1, h2, h3, h4, h5, h6 { color: #ccc; } + a { + color: #62b086; + } + a:hover { + color: #ccc; + } + + code { + background: inherit; + } + pre { + background: #353535; + border: 1px solid #111; + } + + blockquote { + background: inherit; + border-left: .2em solid #ccc; + border-right: none; + border-top: none; + border-bottom: none; + padding-top: .5em; + padding-bottom: .5em; + padding-left: 1em; + padding-right: 1em; + margin-left: 1em; + } + blockquote code { + color: #62b086; + } + li.js-unavailable { + background-color: #f6cf68; + color: #000000; + border-radius: 10px; + margin-left: 1em; + padding-left: 1em; + padding-right: 1em; + } + table td { + border: 1px #2c2c2c solid; + } + table thead { + background: #2c2c2c; + } + table tbody tr:nth-child(2n) { + background: #2c2c2c; + } + + /* nav */ + #void-nav ul li a:hover, + #void-nav ul li a:focus, + #void-nav button:hover, + #void-nav button:focus, + #void-nav label:hover, + #void-nav label:focus { + background: #222; + } + + #void-nav { + background: #295340; + } + + /* sidebar */ + #sidebar { + background: #252525; + } + #sidebar a { + color: #ccc; + } + #sidebar a:hover { + color: #62b086; + } + #sidebar a.active { + color: #62b086; + } + + /* search */ + #searchbar { + background-color: #222; + color: #ccc; + } + + /* chapter navigation */ + .nav-chapters:hover { + fill: #fff + } +} diff --git a/manual/src/theme/css/print.css b/manual/src/theme/css/print.css new file mode 100644 index 000000000000..717ccb80ed2c --- /dev/null +++ b/manual/src/theme/css/print.css @@ -0,0 +1,54 @@ + +#sidebar, +#menu-bar, +.nav-chapters, +.mobile-nav-chapters { + display: none; +} + +#page-wrapper.page-wrapper { + transform: none; + margin-left: 0px; + overflow-y: initial; +} + +#content { + max-width: none; + margin: 0; + padding: 0; +} + +.page { + overflow-y: initial; +} + +code { + background-color: #666666; + border-radius: 5px; + + /* Force background to be printed in Chrome */ + -webkit-print-color-adjust: exact; +} + +pre > .buttons { + z-index: 2; +} + +a, a:visited, a:active, a:hover { + color: #4183c4; + text-decoration: none; +} + +h1, h2, h3, h4, h5, h6 { + page-break-inside: avoid; + page-break-after: avoid; +} + +pre, code { + page-break-inside: avoid; + white-space: pre-wrap; +} + +svg { + display: none !important; +} diff --git a/manual/src/theme/favicon.png b/manual/src/theme/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..fd3ec045d08445cdd73c7413e01a89754827593f GIT binary patch literal 5800 zcmV;Z7FX$sP)E`C_b8aA?wO9+1dw$!Xc_U0yr4h z7uZKt`yuofWC-9iU6NFEiy-wVn-DeuA0fO$ihm|0x!!r-*%*t(QX&0Fp&(%=U=vqe zGxDjChmm5m7&!rDG;lm=qxj8E;1%E{;3b23w*S`tYbQ;bRBu5mC)nf6^HA+WhewD^ zRMj(puK`0sOs8JawSv?rx?=Ny&3~SG;>^Yn^YN8lZ=R~Es>nxqA59>|nFtesFNU2{ zC)6qW1j--rcr;cN+ZuL4J)zf{C;n9YcuC2Hz!YG3*!g6^4n>y=a^JAju*ZvvijrX` z)LnX&dG3Ga{vrJu`dzH(G~k%9^YM|5qB371a#!isOWzJVnM~;w=2^6A(f)aPdEY^} z4A?L1d@SMtOV!g~#>U5<4m+8y$Z7M$YvLmf<|m4t2jqvHPmri+6~Z;KF|jpa=h6{5 zX`TnyJa}Lv6}b+f957+$6EZ7}XRahKB)s+{i=v?4{uye^_wyEgc&HXq3Iv3W9LO0Lin#Bircy|D2hn-7r zK}FX&;!H0cQ~FGpd4y&jRh2|dqC!M|1MCx49=(_p!Yu>044f6#E09pk$)sFfj za84NddlHJi2%HxyjJ+DPb|_CWuDG6x-a-0hVjn#~kmCedTUk>%J$UU9NmM6_5gq~h zg_*~mf*|*K5pQPfYq1@{=!HzYHa<~Q9;VMgzM$x{DU~A(ja$@y1Ixf0WMbD*g4&)aHs_5$Y>i7hkA~|6mf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%;|7v6 z%+t&Sx8gttovrEW#J+c9pRo<(_XYjAA(zT+bILr;q$}^_I-n%%TtX%Va*u;|O)eJt z=cIX>ndnxG0iB}+*J?6Hs8{rU;O3R?g4e@NrXzCNJk3mS%a1phAA?Szch(AJN}a+2 z2j`|`?jPO>JDINN73OJX()AY~l1h5hNw;4*FzkGM<}wmD}BW-{mmVBfHF z>V$uQt`LzWgOA#}D&5n*_tNXl(~|M78!0gBPsNiGU>xb!AYm4xeFCgOWVtb^<;#At z@U0MY@tr-&Ji8NhqxoCR;L)ny$*LS9$g#jE?A+!)23}NjEh5i}n&(!ycfUnI=Q)PK z9&MfukO^+Z0hrXGj%N<_kb?vrCNNClbEHSA0U%A=Xf#QBC+aq!Uf>f&HVfVc57_`_ my~EB8%iIStI!$X&;{O3r3)blbBiM}q0000 + + + + + {{ title }} + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + + + +
+ {{#if search_enabled}} + + {{/if}} + +
+ {{{ content }}} +
+ + +
+
+ + {{#if livereload}} + + + {{/if}} + + {{#if search_js}} + + + + {{/if}} + + + + From 286f12e02c5ec30fa11420f0777d69b8aa402419 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 1 Apr 2022 15:24:18 -0400 Subject: [PATCH 3/3] manual/: add linkcheck, CI for checking Manual.md changes --- .github/workflows/manual.yml | 25 +++++++++++++++++++++++++ manual/book.toml | 6 +++++- manual/ci/format.sh | 22 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/manual.yml create mode 100755 manual/ci/format.sh diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 000000000000..3e4ce6a2cf61 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,25 @@ +name: Check Manual Changes + +on: + pull_request: + paths: + - 'Manual.md' + - 'manual/**' + +jobs: + only: + name: Check formatting and links + runs-on: ubuntu-latest + container: + image: ghcr.io/void-linux/void-linux:latest-mini-x86_64-musl + steps: + - name: Prepare container + run: | + xbps-install -Syu || xbps-install -yu xbps + xbps-install -yu + xbps-install -y mdBook mdbook-linkcheck vmdfmt git + - uses: actions/checkout@v1 + with: + fetch-depth: 200 + - run: ./manual/ci/format.sh + diff --git a/manual/book.toml b/manual/book.toml index 5ef5064d8928..4272409788e3 100644 --- a/manual/book.toml +++ b/manual/book.toml @@ -5,9 +5,13 @@ src = "src" title = "XBPS Source Packages Manual" [preprocessor.gen_manual] -command = "python3 generate_mdbook.py" +command = "python3 manual/generate_mdbook.py" [output.html] # TODO: this should be a submodule or something # to avoid de-syncing with void-docs/src/theme theme = "src/theme" + +[output.linkcheck] +optional = true +follow-web-links = true diff --git a/manual/ci/format.sh b/manual/ci/format.sh new file mode 100755 index 000000000000..e47ec8fba57d --- /dev/null +++ b/manual/ci/format.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +echo "Checking links" +RUST_LOG=linkcheck=debug mdbook build manual +LINKCHECK=$? + +# Format them +printf "Formatting tree" +vmdfmt -l -w Manual.md + +# Check Status +if [ ! -z "$(git status --porcelain)" ] ; then + git diff + echo "Working directory not clean, files to be formatted:" + git status + VMDFMT=1 +fi + +# Generate exit value +if [ ! -z $VMDFMT ] || [ ! $LINKCHECK -eq 0 ] ; then + exit 2 +fi