From 0939258be1e7bcf780814d8667f7bf6ca684f673 Mon Sep 17 00:00:00 2001 From: defanor Date: Thu, 26 Apr 2018 02:17:17 +0300 Subject: Add authoring tools --- tools/README | 38 +++++++++++++++ tools/atom-limit.xsl | 27 +++++++++++ tools/atom-sort.xsl | 29 ++++++++++++ tools/html-to-atom-dump.xsl | 110 ++++++++++++++++++++++++++++++++++++++++++++ tools/html-to-atom.sh | 19 ++++++++ tools/publish.sh | 8 ++++ tools/skeleton.xhtml | 46 ++++++++++++++++++ tools/skeleton.xml | 15 ++++++ tools/xml-to-html.sh | 12 +++++ tools/xml-to-html.xsl | 90 ++++++++++++++++++++++++++++++++++++ 10 files changed, 394 insertions(+) create mode 100644 tools/README create mode 100644 tools/atom-limit.xsl create mode 100644 tools/atom-sort.xsl create mode 100644 tools/html-to-atom-dump.xsl create mode 100755 tools/html-to-atom.sh create mode 100755 tools/publish.sh create mode 100644 tools/skeleton.xhtml create mode 100644 tools/skeleton.xml create mode 100755 tools/xml-to-html.sh create mode 100644 tools/xml-to-html.xsl diff --git a/tools/README b/tools/README new file mode 100644 index 0000000..c7bf4c9 --- /dev/null +++ b/tools/README @@ -0,0 +1,38 @@ +These are the tools I use for my personal web page authoring. + +The scripts can be improved to process just the modified files (and to +be less hacky in general), the XSLTs can be made more generic, but it +works for now, and is pretty simple. + + +Editing: +- skeleton.xml is the primary skeleton to start with, for *.xhtml + files in ~/homepage/src/. + +This stage is mostly needed to get unified styles, metadata +properties, and other bits in case if I'll change them. The same can +be achieved by processing (X)HTML files, but such a processing may get +tricky, and it's also nicer to have a less verbose skeleton. + +Editing is done with the emacs html-mode, with +. + + +HTML: + +- xml-to-html.sh translates source files into actual (X)HTML in + ~/homepage/ by applying xml-to-html.xsl to them. + + +Atom feed: + +- html-to-atom-dump.xsl dumps HTML files into a single atom feed. +- atom-sort.xsl sorts those by modification date. +- atom-limit.xsl limits them, taking the newest entries. +- html-to-atom.sh finds source files, and pipes them through the + XSLTs. + + +Publishing: + +- publish.sh runs the above two and uploads the files with rsync. diff --git a/tools/atom-limit.xsl b/tools/atom-limit.xsl new file mode 100644 index 0000000..2b6a285 --- /dev/null +++ b/tools/atom-limit.xsl @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/atom-sort.xsl b/tools/atom-sort.xsl new file mode 100644 index 0000000..a00b599 --- /dev/null +++ b/tools/atom-sort.xsl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/html-to-atom-dump.xsl b/tools/html-to-atom-dump.xsl new file mode 100644 index 0000000..fce78a2 --- /dev/null +++ b/tools/html-to-atom-dump.xsl @@ -0,0 +1,110 @@ + + + + + + https://defanor.uberspace.net/ + + + + + + defanor's notes + + + + + + + 2018-04-14T10:00:00Z + + + + + + + + ../ + + + + + + + https://defanor.uberspace.net/ + + + + + defanor + + + + + + + + + + + + + <xsl:value-of select="." /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/html-to-atom.sh b/tools/html-to-atom.sh new file mode 100755 index 0000000..aa665b0 --- /dev/null +++ b/tools/html-to-atom.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Composes an atom feed out of XHTML files. + +BASEDIR=~/homepage +TOOLS="${BASEDIR}/tools" +SOURCES="${BASEDIR}/src" +ATOM="${BASEDIR}/atom.xml" + +(echo '' && + echo '' && + find "${BASEDIR}" -name '*.xhtml' | + grep -Ev "^(${TOOLS}|${SOURCES}).*" | + sed -e "sS^${BASEDIR}\(.*\)SS" && + echo '') | + xsltproc "${TOOLS}/html-to-atom-dump.xsl" - | + xsltproc "${TOOLS}/atom-sort.xsl" - | + xsltproc "${TOOLS}/atom-limit.xsl" - | + xmllint --format --nsclean - > "${ATOM}" diff --git a/tools/publish.sh b/tools/publish.sh new file mode 100755 index 0000000..5a6cbea --- /dev/null +++ b/tools/publish.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +TOOLS=~/homepage/tools + +${TOOLS}/xml-to-html.sh +${TOOLS}/html-to-atom.sh +rsync --exclude '.*' --exclude '*.org' --exclude 'src/' --exclude 'tools/' \ + -avz . uberspace.net:homepage/web/ diff --git a/tools/skeleton.xhtml b/tools/skeleton.xhtml new file mode 100644 index 0000000..3e157b7 --- /dev/null +++ b/tools/skeleton.xhtml @@ -0,0 +1,46 @@ + + + + + FILL ME + + + + + + + + + + + + + + + + FILL ME + + diff --git a/tools/skeleton.xml b/tools/skeleton.xml new file mode 100644 index 0000000..a65f179 --- /dev/null +++ b/tools/skeleton.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/tools/xml-to-html.sh b/tools/xml-to-html.sh new file mode 100755 index 0000000..c05d749 --- /dev/null +++ b/tools/xml-to-html.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Translates simplified documents from src/ + +BASEDIR=~/homepage +TOOLS="${BASEDIR}/tools" +SOURCES="${BASEDIR}/src" + +find "${SOURCES}" -name '*.xhtml' | + sed -e "sS^${SOURCES}SS" | + xargs -Ifile xsltproc -o "${BASEDIR}/file" \ + "${TOOLS}/xml-to-html.xsl" "${SOURCES}file" diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl new file mode 100644 index 0000000..1b1358d --- /dev/null +++ b/tools/xml-to-html.xsl @@ -0,0 +1,90 @@ + + + + + + + + + + + + <!DOCTYPE html> + + + + + + + + + + + + + + <xsl:value-of select="@title" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3