summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gophermap.m418
-rw-r--r--tools/Makefile67
-rw-r--r--tools/README8
-rwxr-xr-xtools/publish.sh41
-rw-r--r--tools/xml-notes-dump.xsl2
-rw-r--r--tools/xml-notes-limit.xsl2
-rw-r--r--tools/xml-notes-sort.xsl2
-rw-r--r--tools/xml-notes-to-atom.xsl2
-rw-r--r--tools/xml-to-html.xsl44
9 files changed, 136 insertions, 50 deletions
diff --git a/src/gophermap.m4 b/src/gophermap.m4
new file mode 100644
index 0000000..ae05e7d
--- /dev/null
+++ b/src/gophermap.m4
@@ -0,0 +1,18 @@
+!defanor's homepage
+
+Most recent phlog entries:
+
+syscmd(ls -r blog/*.txt |
+ head -n 8 |
+ sed -e "sS^blog/\(.*\)S0- \\1\tblog/\\1S")
+
+1phlog archive blog
+hindex.xhtml index.xhtml
+hWWW URL:https://www.thunix.net/~defanor/
+
+External Gopher links:
+
+1Floodgap Systems / gopher.floodgap.com 70
+1SDF / sdf.org 70
+1Bongusta phlog aggregator /bongusta i-logout.cz 70
+.
diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644
index 0000000..356cd97
--- /dev/null
+++ b/tools/Makefile
@@ -0,0 +1,67 @@
+all: $(patsubst src/%,%,$(wildcard src/notes/*.xhtml src/*.xhtml)) \
+ notes/atom.xml blog/index.xhtml blog/gophermap gophermap
+
+# Index page
+index.xhtml: src/index.xhtml build/notes-by-modification-date.xml build/blog.xml tools/xml-to-html.xsl
+ xsltproc -o $@ tools/xml-to-html.xsl $<
+
+# Note index page
+notes/index.xhtml: src/notes/index.xhtml build/notes-by-publication-date.xml tools/xml-to-html.xsl
+ xsltproc -o $@ tools/xml-to-html.xsl $<
+
+# Notes
+notes/%.xhtml: src/notes/%.xhtml tools/xml-to-html.xsl
+ xsltproc -o $@ tools/xml-to-html.xsl $<
+
+# Other static pages
+%.xhtml: src/%.xhtml tools/xml-to-html.xsl
+ xsltproc -o $@ tools/xml-to-html.xsl $<
+
+# Blog and phlog indexes. Assuming that the blog post file names are
+# prefixed with dates in a format that makes sense to sort in the
+# lexiographic order.
+blog/index.xhtml: src/blog/index.xhtml build/blog.xml tools/xml-to-html.xsl
+ xsltproc -o $@ tools/xml-to-html.xsl $<
+
+build/blog.xml: blog/*.txt
+ (echo '<?xml version="1.0" encoding="UTF-8"?>' && \
+ echo '<files>' && \
+ ls -r blog/*.txt | \
+ sed -e "sS^blog/\(.*\)S <file src=\"\\1\" />S" && \
+ echo '</files>') \
+ > build/blog.xml
+
+blog/gophermap: blog/*.txt
+ (echo "!defanor's phlog" && \
+ ls -r blog/*.txt | \
+ sed -e "sS^blog/\(.*\)S0\\1\t\\1S" && \
+ echo '.') \
+ > $@
+
+gophermap: src/gophermap.m4 blog/*.txt
+ m4 src/gophermap.m4 > $@
+
+# A single-file dump of all notes
+build/notes-dump.xml: src/notes/*.xhtml tools/xml-notes-dump.xsl
+ (echo '<?xml version="1.0" encoding="UTF-8"?>' && \
+ echo '<notes>' && \
+ find src/notes -name '*.xhtml' | \
+ grep -v index.xhtml | \
+ sed -e "sS^src/\(.*\)S <note src=\"\\1\" />S" && \
+ echo '</notes>') | \
+ xsltproc -o $@ tools/xml-notes-dump.xsl -
+
+# Notes sorted by publication date
+build/notes-by-publication-date.xml: build/notes-dump.xml tools/xml-notes-sort.xsl
+ xsltproc -o $@ tools/xml-notes-sort.xsl build/notes-dump.xml
+
+# Notes sorted by modification date
+build/notes-by-modification-date.xml: build/notes-dump.xml tools/xml-notes-sort.xsl
+ xsltproc -o $@ --stringparam sortBy modified \
+ tools/xml-notes-sort.xsl build/notes-dump.xml
+
+# An Atom feed
+notes/atom.xml: build/notes-by-modification-date.xml tools/xml-notes-limit.xsl tools/xml-notes-to-atom.xsl
+ xsltproc --param number 10 tools/xml-notes-limit.xsl \
+ build/notes-by-modification-date.xml | \
+ xsltproc -o $@ tools/xml-notes-to-atom.xsl -
diff --git a/tools/README b/tools/README
index bbd251d..f4c1de3 100644
--- a/tools/README
+++ b/tools/README
@@ -21,20 +21,22 @@ Editing is done with the emacs html-mode, with
Indexing:
-- xml-notes-dump.xsl (with some help from publish.sh) is used to
+- xml-notes-dump.xsl (with some help from Makefile) 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.
+Opaque files can be indexed externally, as done with build/blog.xml.
+
HTML:
- xml-to-html.xsl is used to translate source files into actual (X)HTML
in ~/homepage/.
-Indexes can be included into those using the <notes> element (so it
-should run after those are built, if they are used).
+Indexes can be included into those using the <notes> or <file> element
+(so it should run after those are built, if they are used).
Atom feed:
diff --git a/tools/publish.sh b/tools/publish.sh
index 90ed8e2..56055ba 100755
--- a/tools/publish.sh
+++ b/tools/publish.sh
@@ -1,41 +1,6 @@
#!/bin/sh
-BASEDIR=~/homepage
-TOOLS="${BASEDIR}/tools"
-BUILD="${BASEDIR}/build"
-ATOM="${BASEDIR}/notes/atom.xml"
-SOURCES="${BASEDIR}/src"
-NOTES="${SOURCES}/notes"
+make -f tools/Makefile
-
-# dump all the notes into a single file
-(echo '<?xml version="1.0" encoding="UTF-8"?>' &&
- echo '<notes>' &&
- find "${NOTES}" -name '*.xhtml' |
- grep -v index.xhtml |
- sed -e "sS^${SOURCES}/\(.*\)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 . tart.uberspace.net:public_html/
+rsync -avz *.xhtml gophermap notes pictures files blog uberspace.net:public_html/
+rsync -avz *.xhtml gophermap notes pictures files blog thunix.net:public_html/
diff --git a/tools/xml-notes-dump.xsl b/tools/xml-notes-dump.xsl
index 79b9606..c1ba20b 100644
--- a/tools/xml-notes-dump.xsl
+++ b/tools/xml-notes-dump.xsl
@@ -16,7 +16,7 @@
</xsl:copy>
</xsl:template>
- <xsl:template match="node()" priority="0">
+ <xsl:template match="node()" priority="-1">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
diff --git a/tools/xml-notes-limit.xsl b/tools/xml-notes-limit.xsl
index 149cbd9..4b8a223 100644
--- a/tools/xml-notes-limit.xsl
+++ b/tools/xml-notes-limit.xsl
@@ -12,7 +12,7 @@
</xsl:copy>
</xsl:template>
- <xsl:template match="node()" priority="0">
+ <xsl:template match="node()" priority="-1">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
diff --git a/tools/xml-notes-sort.xsl b/tools/xml-notes-sort.xsl
index 9d6ac70..9a274ee 100644
--- a/tools/xml-notes-sort.xsl
+++ b/tools/xml-notes-sort.xsl
@@ -23,7 +23,7 @@
</xsl:copy>
</xsl:template>
- <xsl:template match="node()" priority="0">
+ <xsl:template match="node()" priority="-1">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
diff --git a/tools/xml-notes-to-atom.xsl b/tools/xml-notes-to-atom.xsl
index 3c1f07f..a33fb67 100644
--- a/tools/xml-notes-to-atom.xsl
+++ b/tools/xml-notes-to-atom.xsl
@@ -61,7 +61,7 @@
</entry>
</xsl:template>
- <xsl:template match="node()" priority="0">
+ <xsl:template match="node()" priority="-1">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
diff --git a/tools/xml-to-html.xsl b/tools/xml-to-html.xsl
index d317688..96c94c8 100644
--- a/tools/xml-to-html.xsl
+++ b/tools/xml-to-html.xsl
@@ -68,19 +68,32 @@
<!-- The rest is fixed metadata -->
<link property="dc:creator schema:creator foaf:maker sioc:has_creator"
href="https://defanor.uberspace.net/about.xhtml#me" />
+ <link property="dc:creator schema:creator foaf:maker sioc:has_creator"
+ href="https://www.thunix.net/~defanor/about.xhtml#me" />
+ <link property="dc:license schema:license"
+ href="https://creativecommons.org/licenses/by-sa/4.0/" />
<link property="dc:isPartOf schema:isPartOf sioc:has_container"
href="https://defanor.uberspace.net/" />
+ <link property="dc:isPartOf schema:isPartOf sioc:has_container"
+ href="https://www.thunix.net/~defanor/" />
<meta name="robots" content="noarchive" />
</head>
<body>
<xsl:apply-templates mode="body" select="xhtml:body/@*" />
<xsl:apply-templates mode="body" select="xhtml:body/*" />
<footer>
+ defanor, <a
+ href="https://creativecommons.org/licenses/by-sa/4.0/">CC
+ BY-SA 4.0</a>,
<xsl:if test="not(//notes) and @created and @modified">
- <a href="https://defanor.uberspace.net/">defanor</a>,
- <time><xsl:copy-of select="substring(@created,0,8)" /></time>
- <xsl:if test="substring(@created,0,8) != substring(@modified,0,8)"> to <time><xsl:copy-of select="substring(@modified,0,8)" /></time></xsl:if>
- </xsl:if>
+ <time><xsl:copy-of select="substring(@created,0,8)"
+ /></time> <xsl:if test="substring(@created,0,8) !=
+ substring(@modified,0,8)"> to <time><xsl:copy-of
+ select="substring(@modified,0,8)" /></time></xsl:if>,
+ </xsl:if>at <a
+ href="https://defanor.uberspace.net/">defanor.uberspace.net</a>
+ or <a
+ href="https://www.thunix.net/~defanor/">thunix.net/~defanor</a>
</footer>
</body>
</html>
@@ -127,6 +140,27 @@
</dd>
</xsl:template>
+ <xsl:template mode="body" match="files">
+ <xsl:variable name="files" select="document(@src)" />
+ <xsl:variable name="number" select="@number" />
+ <ul>
+ <xsl:apply-templates mode="file-index"
+ select="$files/files/file[$number=0 or position()&lt;=$number]">
+ <xsl:with-param name="prefix"
+ select="@prefix" />
+ </xsl:apply-templates>
+ </ul>
+ </xsl:template>
+
+ <xsl:template mode="file-index" match="file">
+ <xsl:param name="prefix" />
+ <li>
+ <a href="{$prefix}/{@src}">
+ <xsl:value-of select="@src" />
+ </a>
+ </li>
+ </xsl:template>
+
<xsl:template mode="body" match="xhtml:h1|xhtml:h2|xhtml:h3|xhtml:h4|xhtml:h5">
<xsl:copy>
<xsl:attribute name="id">
@@ -137,7 +171,7 @@
</xsl:copy>
</xsl:template>
- <xsl:template mode="body" match="@* | node()" priority="0">
+ <xsl:template mode="body" match="@* | node()" priority="-1">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates mode="body" />