summaryrefslogtreecommitdiff
path: root/src/xmlentry
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-08-31 21:01:44 -0300
committerEuAndreh <eu@euandre.org>2024-08-31 21:05:57 -0300
commit05903eea532bfd18cfb4a289c9d3c57f62e9d20e (patch)
tree146cad5d1a92a4b34c165e5eee555756d43c5467 /src/xmlentry
parentInitial empty commit (diff)
downloadmkwb-05903eea532bfd18cfb4a289c9d3c57f62e9d20e.tar.gz
mkwb-05903eea532bfd18cfb4a289c9d3c57f62e9d20e.tar.xz
Import code from website repository
Diffstat (limited to 'src/xmlentry')
-rwxr-xr-xsrc/xmlentry48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/xmlentry b/src/xmlentry
new file mode 100755
index 0000000..c2458d1
--- /dev/null
+++ b/src/xmlentry
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -eu
+
+
+usage() {
+ echo 'Usage: xmlentry FILENAME'
+}
+
+FILENAME="${1:-}"
+eval "$(assert-arg -- "$FILENAME" 'FILENAME')"
+. "${FILENAME%.*}.conf"
+
+
+title_html=
+url_absolute=
+update_xml=
+cat <<EOF
+ <entry xml:lang="$lang">
+ <title type="html">
+ $title_html
+ </title>
+ <link type="text/html" rel="alternative" href="$url_absolute" title="$title_html" />
+ <published>
+ $date_iso
+ </published>
+$update_xml
+ <id>
+ $url_absolute
+ </id>
+ <author>
+ <name>
+ $author
+ </name>
+ <email>
+ $email
+ </email>
+ </author>
+
+ <summary type="html">
+EOF
+
+head -n1 < "${FILENAME%.*}.htmlbody" | htmlesc
+printf ' </summary>\n'
+printf ' <content type="html" xml:base="%s">\n' "${url:?}"
+
+htmlesc < "${FILENAME%.*}.htmlbody"
+printf ' </content>\n'
+printf ' </entry>\n'