From 56c57f94738efab8b0bf83dc68480931a2ceee00 Mon Sep 17 00:00:00 2001 From: defanor Date: Tue, 1 May 2018 06:10:19 +0300 Subject: 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: --- tools/README | 29 ++++++++---- tools/atom-limit.xsl | 27 ----------- tools/atom-sort.xsl | 29 ------------ tools/html-to-atom-dump.xsl | 110 -------------------------------------------- tools/html-to-atom.sh | 20 -------- tools/publish.sh | 40 ++++++++++++++-- tools/xml-notes-dump.xsl | 26 +++++++++++ tools/xml-notes-limit.xsl | 22 +++++++++ tools/xml-notes-sort.xsl | 32 +++++++++++++ tools/xml-notes-to-atom.xsl | 73 +++++++++++++++++++++++++++++ tools/xml-to-html.sh | 12 ----- tools/xml-to-html.xsl | 29 +++++++++++- 12 files changed, 236 insertions(+), 213 deletions(-) delete mode 100644 tools/atom-limit.xsl delete mode 100644 tools/atom-sort.xsl delete mode 100644 tools/html-to-atom-dump.xsl delete mode 100755 tools/html-to-atom.sh create mode 100644 tools/xml-notes-dump.xsl create mode 100644 tools/xml-notes-limit.xsl create mode 100644 tools/xml-notes-sort.xsl create mode 100644 tools/xml-notes-to-atom.xsl delete mode 100755 tools/xml-to-html.sh diff --git a/tools/README b/tools/README index 43dfea4..bbd251d 100644 --- a/tools/README +++ b/tools/README @@ -7,8 +7,8 @@ works for now, and is pretty simple. Editing: -- skeleton.xml is the primary skeleton to start with, for *.xhtml - files in ~/homepage/src/. +- 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 @@ -19,21 +19,30 @@ Editing is done with the emacs html-mode, with . +Indexing: + +- xml-notes-dump.xsl (with some help from publish.sh) is used to + create notes-dump.xml in the build directory. +- xml-notes-sort.xsl sorts that to create + notes-by-publication-date.xml and notes-by-modification-date.xml. +- xml-notes-limit.xsl is used to extract the most recent notes. + + HTML: -- xml-to-html.sh translates source files into actual (X)HTML in - ~/homepage/ by applying xml-to-html.xsl to them. +- xml-to-html.xsl is used to translate source files into actual (X)HTML + in ~/homepage/. + +Indexes can be included into those using the element (so it +should run after those are built, if they are used). 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. +- xml-notes-to-atom.xsl translates a dump of notes (such as + notes-by-modification-date.xml) into an atom feed. Publishing: -- publish.sh runs the above two and uploads the files with rsync. +- publish.sh runs all of the above and uploads the files with rsync. diff --git a/tools/atom-limit.xsl b/tools/atom-limit.xsl deleted file mode 100644 index 2b6a285..0000000 --- a/tools/atom-limit.xsl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/atom-sort.xsl b/tools/atom-sort.xsl deleted file mode 100644 index a00b599..0000000 --- a/tools/atom-sort.xsl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/html-to-atom-dump.xsl b/tools/html-to-atom-dump.xsl deleted file mode 100644 index fce78a2..0000000 --- a/tools/html-to-atom-dump.xsl +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - 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 deleted file mode 100755 index 3bebf45..0000000 --- a/tools/html-to-atom.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Composes an atom feed out of XHTML files. - -BASEDIR=~/homepage -TOOLS="${BASEDIR}/tools" -SOURCES="${BASEDIR}/src" -ATOM="${BASEDIR}/atom.xml" -NOTES="${BASEDIR}/notes" - -(echo '' && - echo '' && - find "${NOTES}" -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 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 '' && + echo '' && + find "${NOTES}" -name '*.xhtml' | + sed -e "sS^${BASEDIR}/\(.*\)S S" && + echo '') | + 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/ diff --git a/tools/xml-notes-dump.xsl b/tools/xml-notes-dump.xsl new file mode 100644 index 0000000..79b9606 --- /dev/null +++ b/tools/xml-notes-dump.xsl @@ -0,0 +1,26 @@ + + + + + + + + ../src/ + + + + + + + + + + + + + + + + + diff --git a/tools/xml-notes-limit.xsl b/tools/xml-notes-limit.xsl new file mode 100644 index 0000000..149cbd9 --- /dev/null +++ b/tools/xml-notes-limit.xsl @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/xml-notes-sort.xsl b/tools/xml-notes-sort.xsl new file mode 100644 index 0000000..9d6ac70 --- /dev/null +++ b/tools/xml-notes-sort.xsl @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/xml-notes-to-atom.xsl b/tools/xml-notes-to-atom.xsl new file mode 100644 index 0000000..fd18072 --- /dev/null +++ b/tools/xml-notes-to-atom.xsl @@ -0,0 +1,73 @@ + + + + + + https://defanor.uberspace.net/ + + + + + defanor's notes + + + + + + + 2018-05-01T01:00:00Z + + + + + + + + + + https://defanor.uberspace.net/ + + + + defanor + + + <xsl:value-of select="document/@title" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/xml-to-html.sh b/tools/xml-to-html.sh deleted file mode 100755 index c05d749..0000000 --- a/tools/xml-to-html.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/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 index 97e8431..1b92318 100644 --- a/tools/xml-to-html.xsl +++ b/tools/xml-to-html.xsl @@ -77,7 +77,7 @@ href="/xhtml-rdfa-light.css" /> - + @@ -92,4 +92,31 @@ + + + +
+ +
+
+ + +
+ + + +
+
+ +
+
+ + + + + + + + -- cgit v1.2.3