Add everything
This commit is contained in:
parent
9d4fd78aae
commit
6ba818e9f3
44
build.sh
44
build.sh
|
@ -1,28 +1,46 @@
|
|||
#!/bin/bash
|
||||
shopt -s globstar
|
||||
|
||||
# Preprocess include-after.html
|
||||
tmpfile=$(mktemp "/tmp/$USER.XXXXXXXXXX")
|
||||
trap "rm \"$tmpfile\"" EXIT
|
||||
sed "s/{{ now }}/$(date --iso-8601=seconds)/g;s/{{ generator }}/$(pandoc --version | head -n1)/g" include-after.html > "$tmpfile"
|
||||
include_after=$(mktemp "/tmp/$USER.XXXXXXXXXX")
|
||||
tree_file=$(mktemp "/tmp/$USER.XXXXXXXXXX")
|
||||
trap "rm \"$include_after\" \"$tree_file\"" EXIT
|
||||
|
||||
for file in content/**/*.md; do
|
||||
output="${file/#content/html}"
|
||||
output="${output/%.md/.html}"
|
||||
mkdir -p "$(dirname "$output")"
|
||||
echo "Building $file to $output"
|
||||
# Preprocess include-after.html
|
||||
sed "s/{{ now }}/$(date --iso-8601=seconds)/g;s/{{ generator }}/$(pandoc --version | head -n1)/g" include-after.html > "$include_after"
|
||||
|
||||
function convert {
|
||||
pandoc \
|
||||
--read markdown \
|
||||
--write html \
|
||||
--standalone \
|
||||
--include-in-header include-header.html \
|
||||
--include-before-body include-before.html \
|
||||
--include-after-body "$tmpfile" \
|
||||
--css $(echo "$(dirname $(dirname "$file"))/theme.css" | sed 's|^\./||;s|[^/]*/|../|g') \
|
||||
-o "$output" \
|
||||
"$file"
|
||||
--include-after-body "$include_after" \
|
||||
--css "/~$USER/theme.css" \
|
||||
-o "$2" \
|
||||
"$1"
|
||||
chmod 644 "$2"
|
||||
}
|
||||
|
||||
for file in content/**/*.md; do
|
||||
output="${file/#content/html}"
|
||||
output="${output/%.md/.html}"
|
||||
mkdir -p "$(dirname "$output")"
|
||||
chmod 711 "$(dirname "$output")"
|
||||
echo "Building $file to $output"
|
||||
convert "$file" "$output"
|
||||
done
|
||||
|
||||
# Build the 'everything' page
|
||||
echo "---
|
||||
title: everything
|
||||
---
|
||||
" > "$tree_file"
|
||||
pushd html >/dev/null
|
||||
tree --du --si -X --prune -P '*.html' | xsltproc ../xsl/tree.xsl - >> "$tree_file"
|
||||
popd >/dev/null
|
||||
convert "$tree_file" "html/everything.html"
|
||||
|
||||
for src in assets/*; do
|
||||
dest="${src/#assets/html}"
|
||||
echo "Symlinking $src to $dest"
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
title: ~lucidiot's wiki
|
||||
---
|
||||
|
||||
todo: put content in here
|
||||
hello! this is lucidiot's personal wiki; a place where things that belong to
|
||||
nowhere else but deserve to be published will go.
|
||||
|
||||
---
|
||||
you can start by browsing [all the articles](./everything.html).
|
||||
|
||||
## other things hosted here
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:template match="tree">
|
||||
<ul>
|
||||
<xsl:apply-templates select="./file | ./directory/file | ./directory/directory">
|
||||
<xsl:with-param name="base" select="'/~lucidiot'" />
|
||||
</xsl:apply-templates>
|
||||
</ul>
|
||||
<xsl:apply-templates select="report" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="file | directory">
|
||||
<xsl:param name="base" />
|
||||
<li>
|
||||
<a href="{concat($base, '/', @name)}">
|
||||
<xsl:value-of select="@name" />
|
||||
</a>
|
||||
<xsl:if test="@size">
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="@size" />
|
||||
<xsl:text> bytes)</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="self::directory and (file | directory)">
|
||||
<ul>
|
||||
<xsl:apply-templates select="file | directory">
|
||||
<xsl:with-param name="base" select="concat($base, '/', @name)" />
|
||||
</xsl:apply-templates>
|
||||
</ul>
|
||||
</xsl:if>
|
||||
</li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="report">
|
||||
<p>
|
||||
<xsl:value-of select="directories" />
|
||||
<xsl:text> director</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="directories/text() = '1'">
|
||||
<xsl:text>y</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>ies</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text> and </xsl:text>
|
||||
<xsl:value-of select="files" />
|
||||
<xsl:text> file</xsl:text>
|
||||
<xsl:if test="files/text() != '1'">
|
||||
<xsl:text>s</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="size">
|
||||
<xsl:text>, </xsl:text>
|
||||
<xsl:value-of select="size" />
|
||||
<xsl:text> bytes</xsl:text>
|
||||
</xsl:if>
|
||||
</p>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue