Add support for Gopher builds
81
build.sh
|
@ -10,41 +10,60 @@ now="$(date -Iseconds)"
|
|||
generator="$(pandoc --version | head -n1)"
|
||||
|
||||
function convert {
|
||||
pandoc \
|
||||
--read markdown \
|
||||
--write html \
|
||||
--standalone \
|
||||
--template template.html \
|
||||
--highlight-style zenburn \
|
||||
--css "/~$USER/theme.css" \
|
||||
--variable generator="$generator" \
|
||||
--variable now="$now" \
|
||||
-o "$2" \
|
||||
"$1"
|
||||
# Usage: convert input_file output_file output_format
|
||||
if [ "$3" = html ]; then
|
||||
pandoc \
|
||||
--read markdown \
|
||||
--write html \
|
||||
--standalone \
|
||||
--template template.html \
|
||||
--highlight-style zenburn \
|
||||
--css "/~$USER/theme.css" \
|
||||
--variable generator="$generator" \
|
||||
--variable now="$now" \
|
||||
-o "$2" \
|
||||
"$1"
|
||||
else
|
||||
pandoc \
|
||||
--read markdown \
|
||||
--write "$3" \
|
||||
-o "$2" \
|
||||
"$1"
|
||||
fi
|
||||
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
|
||||
|
||||
function link_assets {
|
||||
for src in "$1"/*; do
|
||||
dest="${src/#assets/html}"
|
||||
if [ ! -h "$dest" ] && [ -d "$dest" ]; then
|
||||
link_assets "$src"
|
||||
else
|
||||
echo "Symlinking $src to $dest"
|
||||
ln -fTs "$(echo "$dest" | sed 's|[^/]*/|../|g;s|/[^/]*$||')/$src" "$dest"
|
||||
fi
|
||||
function convert_all_md {
|
||||
# Usage: convert_all_md output_directory file_extension pandoc_output_format
|
||||
local file
|
||||
local output
|
||||
echo "Converting all Markdown files to .$2 files under $1/"
|
||||
for file in content/**/*.md; do
|
||||
output="${file/#content/$1}"
|
||||
output="${output/%.md/.$2}"
|
||||
mkdir -p "$(dirname "$output")"
|
||||
chmod 755 "$(dirname "$output")"
|
||||
echo " $file -> $output"
|
||||
convert "$file" "$output" "$3"
|
||||
done
|
||||
}
|
||||
link_assets assets
|
||||
convert_all_md html html html
|
||||
convert_all_md gopher txt plain
|
||||
|
||||
function link_assets {
|
||||
echo "Copying assets from $1 to $2"
|
||||
for path in $1/*; do
|
||||
echo " $path -> $2"
|
||||
cp -dr --no-preserve=mode "$path" "$2"
|
||||
done
|
||||
echo " Fixing asset attributes"
|
||||
find "$1" -type d | sed "s|^$1|$2|" | xargs chmod 755
|
||||
find "$1" -type f | sed "s|^$1|$2|" | xargs chmod 644
|
||||
}
|
||||
link_assets assets html
|
||||
link_assets assets gopher
|
||||
link_assets html_assets html
|
||||
link_assets gopher_assets gopher
|
||||
|
||||
# Build the 'everything' page and CDF feed
|
||||
echo 'Building article list'
|
||||
|
@ -57,7 +76,7 @@ title: everything
|
|||
---
|
||||
" > "$tree_file"
|
||||
xsltproc xsl/tree-html.xsl "$tree_output" >> "$tree_file"
|
||||
convert "$tree_file" "html/everything.html"
|
||||
convert "$tree_file" "html/everything.html" html
|
||||
|
||||
xsltproc xsl/tree-cdf.xsl "$tree_output" | xmllint --format - > "html/everything.cdf"
|
||||
xmllint --noout --schema "assets/xsd/cdf.xsd" "html/everything.cdf"
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Welcome to lucidiot's gopherhole on envs.net!
|
||||
This is an attempt at building a gopher version of my wiki.
|
||||
|
||||
Below are plain-text version of all the articles; they are
|
||||
generated using pandoc from Markdown files, and therefore may not
|
||||
contain all of the interesting content that the original files
|
||||
might have had, for example images or diagrams.
|
||||
|
||||
hThis wiki over HTTP URL:https://envs.net/~lucidiot/
|
||||
___________________________________________________________________
|
||||
|
||||
*
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 44 B After Width: | Height: | Size: 44 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |