summaryrefslogtreecommitdiff
path: root/tools/publish.sh
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2018-05-01 06:10:19 +0300
committerdefanor <defanor@uberspace.net>2018-05-01 06:10:19 +0300
commit56c57f94738efab8b0bf83dc68480931a2ceee00 (patch)
tree30663a142eedd52670a68e26885cff6348a45d3f /tools/publish.sh
parente0b97e0e2168c4d2b9cf60b16e81591f912c2f4a (diff)
Focus on source XML manipulation, introduce indexes
Instead of XHTML or Atom, so resulting files get generated out of custom XML structures now. This was needed to get indexes that won't depend on Atom (and to avoid the duplication). Now indexes can be included with something like the following: <notes xmlns="" number="5" src="../build/notes-by-modification-date.xml" />
Diffstat (limited to 'tools/publish.sh')
-rwxr-xr-xtools/publish.sh40
1 files changed, 36 insertions, 4 deletions
diff --git a/tools/publish.sh b/tools/publish.sh
index 5a6cbea..c962063 100755
--- a/tools/publish.sh
+++ b/tools/publish.sh
@@ -1,8 +1,40 @@
#!/bin/sh
-TOOLS=~/homepage/tools
+BASEDIR=~/homepage
+TOOLS="${BASEDIR}/tools"
+BUILD="${BASEDIR}/build"
+ATOM="${BASEDIR}/atom.xml"
+SOURCES="${BASEDIR}/src"
+NOTES="${BASEDIR}/notes"
-${TOOLS}/xml-to-html.sh
-${TOOLS}/html-to-atom.sh
-rsync --exclude '.*' --exclude '*.org' --exclude 'src/' --exclude 'tools/' \
+
+# dump all the notes into a single file
+(echo '<?xml version="1.0" encoding="UTF-8"?>' &&
+ echo '<notes>' &&
+ find "${NOTES}" -name '*.xhtml' |
+ sed -e "sS^${BASEDIR}/\(.*\)S <note src=\"\\1\" />S" &&
+ echo '</notes>') |
+ xsltproc -o "${BUILD}/notes-dump.xml" "${TOOLS}/xml-notes-dump.xsl" -
+
+# sort by publication and modification dates
+xsltproc -o "${BUILD}/notes-by-publication-date.xml" \
+ "${TOOLS}/xml-notes-sort.xsl" "${BUILD}/notes-dump.xml"
+xsltproc -o "${BUILD}/notes-by-modification-date.xml" \
+ --stringparam sortBy modified \
+ "${TOOLS}/xml-notes-sort.xsl" "${BUILD}/notes-dump.xml"
+
+# create an atom feed with the most recently modified 10 entries
+xsltproc --param number 10 "${TOOLS}/xml-notes-limit.xsl" \
+ "${BUILD}/notes-by-modification-date.xml" |
+ xsltproc -o "${ATOM}" "${TOOLS}/xml-notes-to-atom.xsl" -
+
+# convert sources into XHTML
+find "${SOURCES}" -name '*.xhtml' |
+ sed -e "sS^${SOURCES}SS" |
+ xargs -Ifile xsltproc -o "${BASEDIR}/file" \
+ "${TOOLS}/xml-to-html.xsl" "${SOURCES}file"
+
+# upload
+rsync --exclude '.*' --exclude '*.org' --exclude 'src/' \
+ --exclude 'tools/' --exclude 'build/' \
-avz . uberspace.net:homepage/web/