Implement variable substitution for site files.
It was such a pain to update the links in site/index.html for v0.1.0, so this is necessary to prevent me from going insane manually updating all these version numbers sprinkled everywhere.
This commit is contained in:
parent
4eae5b771f
commit
b63eeffb0f
5 changed files with 69 additions and 32 deletions
|
@ -53,10 +53,9 @@ To cut a new release for Telodendria, perform the following
|
||||||
steps. This is just a reference for me so I don't mess it up.
|
steps. This is just a reference for me so I don't mess it up.
|
||||||
|
|
||||||
- Update tools/bin/td to declare the next version number.
|
- Update tools/bin/td to declare the next version number.
|
||||||
- Update site/index.html with links to the new version.
|
- Make sure man/man7/telodendria-changelog.7 is up to date.
|
||||||
- Make sure man/man7/telodendria-changelog.7 is up to date
|
|
||||||
with the latest information.
|
with the latest information.
|
||||||
- Commit any changes made in the previous steps.
|
- Commit all changes.
|
||||||
- Run the release recipe: td release
|
- Run the release recipe: td release
|
||||||
- Deploy the site: td site
|
- Deploy the site: td site
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.Dd $Mdocdate: December 13 2022 $
|
.Dd $Mdocdate: December 14 2022 $
|
||||||
.Dt TELODENDRIA-CHANGELOG 7
|
.Dt TELODENDRIA-CHANGELOG 7
|
||||||
.Os Telodendria Project
|
.Os Telodendria Project
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -40,6 +40,11 @@ Fixed a bug in
|
||||||
that caused
|
that caused
|
||||||
.Xr cvs 1
|
.Xr cvs 1
|
||||||
to be invoked in the wrong directory when tagging a new release.
|
to be invoked in the wrong directory when tagging a new release.
|
||||||
|
.It
|
||||||
|
Added support for environment variable substitution in all site
|
||||||
|
files. This makes it easier to release
|
||||||
|
.Nm
|
||||||
|
versions.
|
||||||
.El
|
.El
|
||||||
.Sh v0.1.0
|
.Sh v0.1.0
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -68,20 +68,20 @@ telodendria-signify.pub</a>.
|
||||||
<th>Signature</th>
|
<th>Signature</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>v0.1.1</td>
|
<td>${TELODENDRIA_VERSION}</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/pub/v0.1.1/Telodendria-v0.1.1.tar.gz">
|
<a href="/pub/v${TELODENDRIA_VERSION}/Telodendria-v${TELODENDRIA_VERSION}.tar.gz">
|
||||||
Telodendria-v0.1.1.tar.gz
|
<code>Telodendria-v${TELODENDRIA_VERSION}.tar.gz</code>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/pub/v0.1.1/Telodendria-v0.1.1.tar.gz.sha256">
|
<a href="/pub/v${TELODENDRIA_VERSION}/Telodendria-v${TELODENDRIA_VERSION}.tar.gz.sha256">
|
||||||
SHA256
|
<code>Telodendria-v${TELODENDRIA_VERSION}.tar.gz.sha256</code>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/pub/v0.1.1/Telodendria-v0.1.1.tar.gz.sig">
|
<a href="/pub/v${TELODENDRIA_VERSION}/Telodendria-v${TELODENDRIA_VERSION}.tar.gz.sig">
|
||||||
Signify
|
<code>Telodendria-v${TELODENDRIA_VERSION}.tar.gz.sig</code>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -278,6 +278,8 @@ Extremely simple HTTP server.
|
||||||
<hr>
|
<hr>
|
||||||
<p>
|
<p>
|
||||||
© 2022 Jordan Bancino <@jordan:bancino.net>
|
© 2022 Jordan Bancino <@jordan:bancino.net>
|
||||||
|
<br>
|
||||||
|
Updated on ${DATE}.
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -43,14 +43,6 @@ body {
|
||||||
text-decoration: underline
|
text-decoration: underline
|
||||||
}
|
}
|
||||||
|
|
||||||
.Bd {
|
|
||||||
background-color: var(--color-snippet);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
padding-left: 10px;
|
|
||||||
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +75,6 @@ table {
|
||||||
border-spacing: 0px;
|
border-spacing: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
td, th {
|
td, th {
|
||||||
border: 1px solid var(--color-table-border);
|
border: 1px solid var(--color-table-border);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -94,8 +85,23 @@ tr:nth-child(even) {
|
||||||
background-color: var(--color-table-accent);
|
background-color: var(--color-table-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The above styles are nice for real tables, but not for
|
/* Thanks Jonah! */
|
||||||
* a man page synopsis. */
|
#logo {
|
||||||
|
display: block;
|
||||||
|
margin: auto;
|
||||||
|
width: 50vw;
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mandoc overrides */
|
||||||
|
|
||||||
|
.Bd {
|
||||||
|
background-color: var(--color-snippet);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.Nm {
|
.Nm {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
@ -105,11 +111,4 @@ tr:nth-child(even) {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Thanks Jonah! */
|
|
||||||
#logo {
|
|
||||||
display: block;
|
|
||||||
margin: auto;
|
|
||||||
width: 50vw;
|
|
||||||
max-width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
38
tools/bin/td
38
tools/bin/td
|
@ -63,6 +63,24 @@ mod_time() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Substitute shell variables in a stream with their actual value
|
||||||
|
# in this shell.
|
||||||
|
setsubst() {
|
||||||
|
SED="/tmp/sed-$RANDOM.txt"
|
||||||
|
|
||||||
|
(
|
||||||
|
set | while IFS='=' read -r var val; do
|
||||||
|
val=$(echo "$val" | cut -d "'" -f 2)
|
||||||
|
echo "s|\\\${$var}|$val|g"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "s|\\\${[a-zA-Z_]*}||g"
|
||||||
|
) > "$SED"
|
||||||
|
|
||||||
|
sed -f "$SED" $@
|
||||||
|
rm "$SED"
|
||||||
|
}
|
||||||
|
|
||||||
# Build the source code, and generate the 'build/telodendria'
|
# Build the source code, and generate the 'build/telodendria'
|
||||||
# binary.
|
# binary.
|
||||||
recipe_build() {
|
recipe_build() {
|
||||||
|
@ -133,15 +151,29 @@ recipe_site() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -v site/* "$TELODENDRIA_PUB/"
|
DATE=$(date)
|
||||||
|
|
||||||
|
cd site/
|
||||||
|
find . -type f | while IFS= read -r file; do
|
||||||
|
dest="$TELODENDRIA_PUB/$file"
|
||||||
|
dir=$(dirname "$dest")
|
||||||
|
|
||||||
|
echo "$dest"
|
||||||
|
|
||||||
|
mkdir -p "$dir"
|
||||||
|
setsubst "$file" > "$dest"
|
||||||
|
done
|
||||||
|
cd - > /dev/null
|
||||||
|
|
||||||
find man/ -name '*.[1-9]' | while IFS= read -r man; do
|
find man/ -name '*.[1-9]' | while IFS= read -r man; do
|
||||||
dir=$(dirname "$man")
|
dir=$(dirname "$man")
|
||||||
html=$(basename "$man")
|
html=$(basename "$man")
|
||||||
|
|
||||||
mkdir -p "$TELODENDRIA_PUB/$dir/"
|
mkdir -p "$TELODENDRIA_PUB/$dir/"
|
||||||
mandoc -Thtml -O style=/style.css,man=/man/man%S/%N.%S.html "$man" > "$TELODENDRIA_PUB/$dir/$html.html"
|
mandoc -Thtml \
|
||||||
echo "$man -> $TELODENDRIA_PUB/$dir/$html.html"
|
-O style=/style.css,man=man/man%S/%N.%S.html "$man" \
|
||||||
|
> "$TELODENDRIA_PUB/$dir/$html.html"
|
||||||
|
echo "$TELODENDRIA_PUB/$dir/$html.html"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue