Skip to content

Commit 7afc5f5

Browse files
committed
Use mdbook for HTML generation (instead of pdsite)
1 parent e7617d7 commit 7afc5f5

File tree

5 files changed

+225
-18
lines changed

5 files changed

+225
-18
lines changed

.pdsite.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

SUMMARY.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Summary
2+
3+
<!--
4+
SPDX-FileCopyrightText: Robin Vobruba <hoijui.quaero@gmail.com>
5+
6+
SPDX-License-Identifier: CC-BY-SA-3.0
7+
-->
8+
9+
<!--
10+
NOTE:
11+
This file was auto-generated with script
12+
"run/generate_summary";
13+
do not edit manually!
14+
-->
15+
16+
[Title](text/s0-c00-title.md)
17+
18+
[About this book](text/s0-c01-about.md)
19+
20+
[Installing on Linux](text/s0-c02-installing.md)
21+
22+
[A Short History of Git](text/s0-c03-short-history.md)
23+
24+
# Understanding Git
25+
26+
- [Understanding Git](text/s1-c00-understanding-git.md)
27+
- [What is Git?](text/s1-c01-what-is-git.md)
28+
- [Focus and Design](text/s1-c02-focus-design.md)
29+
- [Git Object Types](text/s1-c03-object-types.md)
30+
- [The Git Data Model](text/s1-c05-the-data-model.md)
31+
- [Branching and Merging](text/s1-c06-branching-and-merging.md)
32+
- [The Git Directory](text/s1-c07a-git-directory.md)
33+
- [The Treeish](text/s1-c07-treeish.md)
34+
- [Working Directory](text/s1-c08-working-directory.md)
35+
- [The Index](text/s1-c09-the-index.md)
36+
- [Non-SCM Uses of Git](text/s1-c10-non-scm-uses.md)
37+
38+
# Using Git
39+
40+
- [Using Git](text/s2-c00-using-git.md)
41+
- [Getting a Git Repository](text/s2-c02-getting-a-git-repo.md)
42+
- [Normal Workflow Examples](text/s2-c03-normal-workflow.md)
43+
- [Log - the Commit History](text/s2-c04-log-commit-history.md)
44+
- [Searching Git](text/s2-c05a-searching-git.md)
45+
- [Browsing Git](text/s2-c05-browsing-git.md)
46+
- [Git Diff](text/s2-c06-git-diff.md)
47+
- [Branching](text/s2-c07-branching.md)
48+
- [Simple Merging](text/s2-c08-simple-merging.md)
49+
- [Stashing](text/s2-c09a-stashing.md)
50+
- [Rebasing](text/s2-c09-rebasing.md)
51+
- [Exporting Git](text/s2-c10a-archiving.md)
52+
- [The Care and Feeding of Git](text/s2-c10b-care-and-feeding.md)
53+
- [Tagging](text/s2-c10-tagging.md)
54+
- [Distributed Workflow Examples](text/s2-c11-distributed-workflow.md)
55+
- [Sharing Repositories](text/s2-c13-sharing-repositories.md)
56+
- [Hosted Repositories](text/s2-c14-github.md)
57+
58+
# Annex
59+
60+
.
61+
62+
[Commands Overview](text/s3-c00-commands-overview.md)
63+
64+
[References and Endnotes](text/s4-c00-references.md)
65+
66+
[Revisions](text/s9-c00-revisions.md)

book.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2023-2024 Robin Vobruba <hoijui.quaero@gmail.com>
2+
#
3+
# SPDX-License-Identifier: CC-BY-SA-3.0
4+
5+
[book]
6+
authors = ["Robin Vobruba <hoijui.quaero@gmail.com>"]
7+
language = "en"
8+
multilingual = false
9+
src = "."
10+
title = "Git Internals"
11+
12+
[build]
13+
build-dir = "build/html"
14+
15+
[output.html]
16+
site-url = "/mdBook/"
17+
smart-punctuation = false
18+
git-repository-url = "https://github.com/osegermany/git-internals-doc"
19+
edit-url-template = "https://github.com/osegermany/git-internals-doc/edit/master/{path}"

run/generate_summary

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/usr/bin/env bash
2+
# SPDX-FileCopyrightText: 2024 Robin Vobruba <hoijui.quaero@gmail.com>
3+
# SPDX-License-Identifier: AGPL-3.0-only
4+
#
5+
# See the output of "$0 -h" for details.
6+
7+
# Exit immediately on each error and unset variable;
8+
# see: https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
9+
set -Eeuo pipefail
10+
#set -Eeu
11+
12+
script_path="$(readlink -f "${BASH_SOURCE[0]}")"
13+
#script_dir="$(dirname "$script_path")"
14+
script_name="$(basename "$script_path")"
15+
16+
function print_help() {
17+
18+
echo -e "$script_name -"
19+
echo "Generates the 'SUMMARY.md' file"
20+
echo "(required by [mdbook](https://github.com/rust-lang/mdBook/))."
21+
echo
22+
echo "Usage:"
23+
echo " $script_name [OPTION...]"
24+
echo "Options:"
25+
echo " -h, --help Print this usage help and exits."
26+
echo "Examples:"
27+
echo " $script_name --help"
28+
echo " $script_name"
29+
}
30+
31+
# read command-line args
32+
POSITIONAL=()
33+
while [[ $# -gt 0 ]]
34+
do
35+
arg="$1"
36+
shift # $2 -> $1, $3 -> $2, ...
37+
38+
case "$arg" in
39+
-h|--help)
40+
print_help
41+
exit 0
42+
;;
43+
*) # non-/unknown option
44+
POSITIONAL+=("$arg") # save it in an array for later
45+
;;
46+
esac
47+
done
48+
set -- "${POSITIONAL[@]}" # restore positional parameters
49+
50+
# REUSE-IgnoreStart
51+
find text/ -name "*.md" | sed -e 's|^\./||' | sort | awk -F'-' -e '
52+
BEGIN {
53+
section_title = ""
54+
chapter_title = ""
55+
last_section_id = -1
56+
last_chapter_id = -1
57+
introduction_ended = 0
58+
annex_started = 0
59+
60+
print("# Summary")
61+
print("\n<!--\nSPDX-FileCopyrightText: Robin Vobruba <hoijui.quaero@gmail.com>\n\nSPDX-License-Identifier: CC-BY-SA-3.0\n-->")
62+
print("\n<!--\nNOTE:\nThis file was auto-generated with script\n\"'"$0"'\";\ndo not edit manually!\n-->")
63+
}
64+
{
65+
section_id = $1
66+
sub(/^text\/s/, "", section_id)
67+
chapter_id = $2
68+
sub(/^c/, "", chapter_id)
69+
file_name = $0
70+
new_section = section_id != last_section_id && section_id > 0
71+
72+
if (new_section) {
73+
cmd_get_section_title = sprintf("grep \"^# \" < \"%s\" | head -1 | sed -e \"s/^# *//\" -e \"s/ *$//\"", file_name)
74+
section_title = "<SECTION_TITLE_NOT_FOUND>"
75+
while ( ( cmd_get_section_title | getline result ) > 0 ) {
76+
section_title = result
77+
break
78+
}
79+
} else {
80+
cmd_get_chapter_title = sprintf("grep \"^## \" < \"%s\" | head -1 | sed -e \"s/^## *//\" -e \"s/ *$//\"", file_name)
81+
chapter_title = "<CHAPTER_TITLE_NOT_FOUND>"
82+
while ( ( cmd_get_chapter_title | getline result ) > 0 ) {
83+
chapter_title = result
84+
break
85+
}
86+
}
87+
88+
if (section_id > 0) {
89+
introduction_ended = 1
90+
}
91+
92+
if (new_section && section_id == 3) {
93+
annex_started = 1
94+
}
95+
if (new_section && section_id > 3) {
96+
new_section = 0
97+
}
98+
if (annex_started) {
99+
chapter_title = section_title
100+
}
101+
102+
main_section = introduction_ended && !annex_started
103+
104+
if (new_section) {
105+
if (main_section) {
106+
sec_title = section_title "\n"
107+
chapter_title = section_title
108+
} else {
109+
sec_title = "Annex\n\n."
110+
}
111+
printf("\n# %s\n", sec_title)
112+
}
113+
114+
if (main_section) {
115+
sep = "- "
116+
} else {
117+
sep = "\n"
118+
}
119+
120+
printf("%s[%s](%s)\n", sep, chapter_title, file_name)
121+
122+
annex_started_now = 0
123+
section_title = ""
124+
chapter_title = ""
125+
last_section_id = section_id
126+
last_chapter_id = chapter_id
127+
}
128+
' > "SUMMARY.md"
129+
# REUSE-IgnoreEnd

text/s0-c00-title.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2024 Robin Vobruba <hoijui.quaero@gmail.com>
3+
4+
SPDX-License-Identifier: CC-BY-SA-3.0
5+
-->
6+
7+
<img src="../artwork/title.svg" alt="books title image - Git Internals" width="100%" />
8+
9+
<!--
10+
## Title
11+
-->

0 commit comments

Comments
 (0)