home · contact · privacy
Unhide metadata directory, move helpers script up in tree.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 21 Dec 2016 23:16:12 +0000 (00:16 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 21 Dec 2016 23:16:12 +0000 (00:16 +0100)
31 files changed:
processor/.meta/author.do [deleted file]
processor/.meta/default.feed_snippet.do [deleted file]
processor/.meta/default.index_snippet.do [deleted file]
processor/.meta/default.intermediate.do [deleted file]
processor/.meta/default.uuid.do [deleted file]
processor/.meta/helpers.sh [deleted file]
processor/.meta/intermediate.tmpl [deleted file]
processor/.meta/title.do [deleted file]
processor/.meta/url.do [deleted file]
processor/.meta/uuid.do [deleted file]
processor/all.do
processor/default.html.do
processor/feed.xml.do
processor/helpers.sh [new file with mode: 0644]
processor/index.html.do
processor/metadata/author.do [new file with mode: 0644]
processor/metadata/default.feed_snippet.do [new file with mode: 0644]
processor/metadata/default.index_snippet.do [new file with mode: 0644]
processor/metadata/default.intermediate.do [new file with mode: 0644]
processor/metadata/default.uuid.do [new file with mode: 0644]
processor/metadata/intermediate.tmpl [new file with mode: 0644]
processor/metadata/title.do [new file with mode: 0644]
processor/metadata/url.do [new file with mode: 0644]
processor/metadata/uuid.do [new file with mode: 0644]
test.sh
test/test_files/.meta/author [deleted file]
test/test_files/.meta/title [deleted file]
test/test_files/.meta/url [deleted file]
test/test_files/metadata/author [new file with mode: 0644]
test/test_files/metadata/title [new file with mode: 0644]
test/test_files/metadata/url [new file with mode: 0644]

diff --git a/processor/.meta/author.do b/processor/.meta/author.do
deleted file mode 100644 (file)
index ed14e3f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "$1" ]; then
-  printf "Joe Sixpack"
-fi
diff --git a/processor/.meta/default.feed_snippet.do b/processor/.meta/default.feed_snippet.do
deleted file mode 100644 (file)
index 1949d0b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# Pull in dependencies. 
-. ./helpers.sh
-src_file=$(get_source_file "$1")
-uuid_file="${1%.feed_snippet}.uuid"
-redo-ifchange "$uuid_file"
-intermediate_file="${1%.feed_snippet}.intermediate"
-redo-ifchange "$intermediate_file"
-
-# Get variables, write entry.
-html_file=`escape_url "${src_file%.*}.html"`
-html_file=${html_file#*/}
-lastmod=`stat -c%y "$src_file"`
-lastmod_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "$lastmod"`
-published=`stat -c%y "$uuid_file"`
-published_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "${published}"`
-title=`read_and_escape_file "$intermediate_file" | head -1`
-uuid=`read_and_escape_file "$uuid_file" | head -1`
-body=`read_and_escape_file "$intermediate_file" | sed 1d`
-printf "<entry>\n"
-printf "<title type=\"html\">%s</title>\n" "$title"
-printf "<id>urn:uuid:%s</id>\n" "$uuid"
-printf "<updated>%s</updated>\n" "$lastmod_rfc3339"
-printf "<published>%s</published>\n" "$published_rfc3339"
-printf "<link href=\"%s%s\" />\n" "$(get_basepath)" "${html_file}"
-printf "<content type=\"html\">\n%s\n</content>\n" "$body"
-printf "</entry>\n"
diff --git a/processor/.meta/default.index_snippet.do b/processor/.meta/default.index_snippet.do
deleted file mode 100644 (file)
index 33499ed..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# Pull in dependencies.
-. ./helpers.sh
-src_file=$(get_source_file "$1")
-intermediate_file="${1%.index_snippet}.intermediate"
-redo-ifchange "$intermediate_file"
-html_file="${src_file%.*}.html"
-redo-ifchange "$html_file"
-
-# Get variables, write entry.
-title_html=`cat "$intermediate_file" | head -1`
-html_file_escaped=`escape_url "${html_file#*/}"`
-printf "<li><a href=\"%s\" />%s</a></li>\n" "$html_file_escaped" "$title_html"
diff --git a/processor/.meta/default.intermediate.do b/processor/.meta/default.intermediate.do
deleted file mode 100644 (file)
index e6addea..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-template=intermediate.tmpl
-uuidfile="${1%.intermediate}.uuid"
-redo-ifchange "$uuidfile"
-redo-ifchange "$template"
-mdfile="../${1%.intermediate}.md"
-rstfile="../${1%.intermediate}.rst"
-if [ -f "$rstfile" ]; then
-  redo-ifchange "$rstfile"
-  pandoc -f rst --template="$template" --mathml -t html5 "$rstfile" > "$3"
-elif [ -f "$mdfile" ]; then
-  redo-ifchange "$mdfile"
-  pandoc -f markdown --template="$template" --mathml -t html5 "$mdfile" > "$3"
-fi
diff --git a/processor/.meta/default.uuid.do b/processor/.meta/default.uuid.do
deleted file mode 100644 (file)
index 5efffc8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "$1" ]; then
-  uuidgen > "$1"
-fi
diff --git a/processor/.meta/helpers.sh b/processor/.meta/helpers.sh
deleted file mode 100644 (file)
index 20905ab..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-escape_html() {
-  out=`python3 -c 'import sys, html; print(html.escape(sys.argv[1]))' "$1"`
-  printf "%s" "$out"
-}
-
-read_and_escape_file() {
-  in=`cat "$1"`
-  escape_html "$in"
-}
-
-escape_url() {
-  out=`python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' "$1"`
-  printf "%s" "$out"
-}
-
-get_basepath() {
-  url_file="$1"url
-  redo-ifchange "$url_file"
-  base_url=`cat "$url_file" | head -1`
-  url_protocol=`echo $base_url | cut -d ':' -f 1`
-  url_basepath=`echo $base_url | cut -d '/' -f 3-`
-  url_basepath_escaped=`escape_url "$url_basepath"`
-  basepath="$url_protocol""://""$url_basepath_escaped"
-  echo "$basepath"
-}
-
-get_source_file() {
-  md_file="../${1%.*}.md"
-  rst_file="../${1%.*}.rst"
-  if [ -f "$rst_file" ]; then
-    src_file="$rst_file"
-  elif [ -f "$md_file" ]; then
-    src_file="$md_file"
-  else
-    exit 1
-  fi
-  redo-ifchange "$src_file"
-  printf "$src_file"
-}
diff --git a/processor/.meta/intermediate.tmpl b/processor/.meta/intermediate.tmpl
deleted file mode 100644 (file)
index 2357009..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-$title$
-$body$
diff --git a/processor/.meta/title.do b/processor/.meta/title.do
deleted file mode 100644 (file)
index 082accf..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "$1" ]; then
-  printf "Yet another blog"
-fi
diff --git a/processor/.meta/url.do b/processor/.meta/url.do
deleted file mode 100644 (file)
index 4e4079f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "$1" ]; then
-  printf "http://example.org/"
-fi
diff --git a/processor/.meta/uuid.do b/processor/.meta/uuid.do
deleted file mode 100644 (file)
index ba9e919..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "$1" ]; then
-  uuidgen
-fi
index 3c3a021ff18e97819f49adad5ab0f96b8410dd41..5857254a2c72b56f801833bac0161861d81a15f4 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 # Set up directories.
 #!/bin/sh
 
 # Set up directories.
-metadata_dir=.meta
+metadata_dir=metadata
 public_dir=public
 cur_dir=$(pwd)
 mkdir -p "$public_dir"
 public_dir=public
 cur_dir=$(pwd)
 mkdir -p "$public_dir"
index 99be4638584ecc9b3cb6294c662b602c8ee02be0..fcef3efe6b778e72d24f434afc6b51ca7c6d6325 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 # Pull in global dependencies.
 #!/bin/sh
 
 # Pull in global dependencies.
-metadata_dir=.meta
-. "$metadata_dir"/helpers.sh
+. ./helpers.sh
+metadata_dir=metadata
 intermediate_file="${metadata_dir}/${1%.html}.intermediate"
 title_file="${metadata_dir}"/title
 redo-ifchange "$title_file" 
 intermediate_file="${metadata_dir}/${1%.html}.intermediate"
 title_file="${metadata_dir}"/title
 redo-ifchange "$title_file" 
index 2b4396957954b5eab9c021a0d3695c1fb2a7dfcb..19ba026d3589d30c0fefab2c82e0562e4358c376 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 # Pull in global dependencies.
 #!/bin/sh
 
 # Pull in global dependencies.
-metadata_dir=.meta
-. "$metadata_dir"/helpers.sh
+. ./helpers.sh
+metadata_dir=metadata
 author_file="$metadata_dir"/author
 uuid_file="$metadata_dir"/uuid
 title_file="$metadata_dir"/title
 author_file="$metadata_dir"/author
 uuid_file="$metadata_dir"/uuid
 title_file="$metadata_dir"/title
diff --git a/processor/helpers.sh b/processor/helpers.sh
new file mode 100644 (file)
index 0000000..20905ab
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+escape_html() {
+  out=`python3 -c 'import sys, html; print(html.escape(sys.argv[1]))' "$1"`
+  printf "%s" "$out"
+}
+
+read_and_escape_file() {
+  in=`cat "$1"`
+  escape_html "$in"
+}
+
+escape_url() {
+  out=`python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' "$1"`
+  printf "%s" "$out"
+}
+
+get_basepath() {
+  url_file="$1"url
+  redo-ifchange "$url_file"
+  base_url=`cat "$url_file" | head -1`
+  url_protocol=`echo $base_url | cut -d ':' -f 1`
+  url_basepath=`echo $base_url | cut -d '/' -f 3-`
+  url_basepath_escaped=`escape_url "$url_basepath"`
+  basepath="$url_protocol""://""$url_basepath_escaped"
+  echo "$basepath"
+}
+
+get_source_file() {
+  md_file="../${1%.*}.md"
+  rst_file="../${1%.*}.rst"
+  if [ -f "$rst_file" ]; then
+    src_file="$rst_file"
+  elif [ -f "$md_file" ]; then
+    src_file="$md_file"
+  else
+    exit 1
+  fi
+  redo-ifchange "$src_file"
+  printf "$src_file"
+}
index 64fe355e037e2b77b6569e525761db1228e088c0..86369692cad6f9070110a04d644e29baa60fad20 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 # Pull in global dependencies.
 #!/bin/sh
 
 # Pull in global dependencies.
-metadata_dir=.meta
-. "$metadata_dir"/helpers.sh
+. ./helpers.sh
+metadata_dir=metadata
 srcdir=`pwd`
 title_file="$metadata_dir"/title
 redo-ifchange "$title_file"
 srcdir=`pwd`
 title_file="$metadata_dir"/title
 redo-ifchange "$title_file"
diff --git a/processor/metadata/author.do b/processor/metadata/author.do
new file mode 100644 (file)
index 0000000..ed14e3f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  printf "Joe Sixpack"
+fi
diff --git a/processor/metadata/default.feed_snippet.do b/processor/metadata/default.feed_snippet.do
new file mode 100644 (file)
index 0000000..b09eaa0
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Pull in dependencies. 
+. ../helpers.sh
+src_file=$(get_source_file "$1")
+uuid_file="${1%.feed_snippet}.uuid"
+redo-ifchange "$uuid_file"
+intermediate_file="${1%.feed_snippet}.intermediate"
+redo-ifchange "$intermediate_file"
+
+# Get variables, write entry.
+html_file=`escape_url "${src_file%.*}.html"`
+html_file=${html_file#*/}
+lastmod=`stat -c%y "$src_file"`
+lastmod_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "$lastmod"`
+published=`stat -c%y "$uuid_file"`
+published_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "${published}"`
+title=`read_and_escape_file "$intermediate_file" | head -1`
+uuid=`read_and_escape_file "$uuid_file" | head -1`
+body=`read_and_escape_file "$intermediate_file" | sed 1d`
+printf "<entry>\n"
+printf "<title type=\"html\">%s</title>\n" "$title"
+printf "<id>urn:uuid:%s</id>\n" "$uuid"
+printf "<updated>%s</updated>\n" "$lastmod_rfc3339"
+printf "<published>%s</published>\n" "$published_rfc3339"
+printf "<link href=\"%s%s\" />\n" "$(get_basepath)" "${html_file}"
+printf "<content type=\"html\">\n%s\n</content>\n" "$body"
+printf "</entry>\n"
diff --git a/processor/metadata/default.index_snippet.do b/processor/metadata/default.index_snippet.do
new file mode 100644 (file)
index 0000000..d95b27b
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Pull in dependencies.
+. ../helpers.sh
+src_file=$(get_source_file "$1")
+intermediate_file="${1%.index_snippet}.intermediate"
+redo-ifchange "$intermediate_file"
+html_file="${src_file%.*}.html"
+redo-ifchange "$html_file"
+
+# Get variables, write entry.
+title_html=`cat "$intermediate_file" | head -1`
+html_file_escaped=`escape_url "${html_file#*/}"`
+printf "<li><a href=\"%s\" />%s</a></li>\n" "$html_file_escaped" "$title_html"
diff --git a/processor/metadata/default.intermediate.do b/processor/metadata/default.intermediate.do
new file mode 100644 (file)
index 0000000..e6addea
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+template=intermediate.tmpl
+uuidfile="${1%.intermediate}.uuid"
+redo-ifchange "$uuidfile"
+redo-ifchange "$template"
+mdfile="../${1%.intermediate}.md"
+rstfile="../${1%.intermediate}.rst"
+if [ -f "$rstfile" ]; then
+  redo-ifchange "$rstfile"
+  pandoc -f rst --template="$template" --mathml -t html5 "$rstfile" > "$3"
+elif [ -f "$mdfile" ]; then
+  redo-ifchange "$mdfile"
+  pandoc -f markdown --template="$template" --mathml -t html5 "$mdfile" > "$3"
+fi
diff --git a/processor/metadata/default.uuid.do b/processor/metadata/default.uuid.do
new file mode 100644 (file)
index 0000000..5efffc8
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  uuidgen > "$1"
+fi
diff --git a/processor/metadata/intermediate.tmpl b/processor/metadata/intermediate.tmpl
new file mode 100644 (file)
index 0000000..2357009
--- /dev/null
@@ -0,0 +1,2 @@
+$title$
+$body$
diff --git a/processor/metadata/title.do b/processor/metadata/title.do
new file mode 100644 (file)
index 0000000..082accf
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  printf "Yet another blog"
+fi
diff --git a/processor/metadata/url.do b/processor/metadata/url.do
new file mode 100644 (file)
index 0000000..4e4079f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  printf "http://example.org/"
+fi
diff --git a/processor/metadata/uuid.do b/processor/metadata/uuid.do
new file mode 100644 (file)
index 0000000..ba9e919
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  uuidgen
+fi
diff --git a/test.sh b/test.sh
index 8e2a024d3e96b3463858b04005708b80147cdadc..f91d84e3cae8a0c9be682891a973a7a0a138356a 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -42,14 +42,14 @@ redo
 cd "$working_dir"
 
 # Simple file comparison tests and UUID tests.
 cd "$working_dir"
 
 # Simple file comparison tests and UUID tests.
-uuid_test "$generated_files_dir""/.meta/uuid"
-for file in "$expected_files_dir"/*.html "$expected_files_dir"/.meta/*; do
+uuid_test "$generated_files_dir""/metadata/uuid"
+for file in "$expected_files_dir"/*.html "$expected_files_dir"/metadata/*; do
   sed_expression='s/'"$expected_files_dir_escaped"'/'"$generated_files_dir_escaped"'/'
   cmp_file=`echo "$file" | sed "$sed_expression"`
   if [ ! "$file" = "$expected_files_dir""/index.html" ] && \
       echo "$file" | grep -q "\.html$"; then
     basename=$(basename "$cmp_file")
   sed_expression='s/'"$expected_files_dir_escaped"'/'"$generated_files_dir_escaped"'/'
   cmp_file=`echo "$file" | sed "$sed_expression"`
   if [ ! "$file" = "$expected_files_dir""/index.html" ] && \
       echo "$file" | grep -q "\.html$"; then
     basename=$(basename "$cmp_file")
-    uuid_test "${generated_files_dir}/.meta/${basename%.html}.uuid"
+    uuid_test "${generated_files_dir}/metadata/${basename%.html}.uuid"
   fi
   diff_test "$file" "$cmp_file"
 done
   fi
   diff_test "$file" "$cmp_file"
 done
diff --git a/test/test_files/.meta/author b/test/test_files/.meta/author
deleted file mode 100644 (file)
index 5f36248..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Joe Sixpack
\ No newline at end of file
diff --git a/test/test_files/.meta/title b/test/test_files/.meta/title
deleted file mode 100644 (file)
index 4d35b7e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Yet another blog
\ No newline at end of file
diff --git a/test/test_files/.meta/url b/test/test_files/.meta/url
deleted file mode 100644 (file)
index 673d303..0000000
+++ /dev/null
@@ -1 +0,0 @@
-http://example.org/
\ No newline at end of file
diff --git a/test/test_files/metadata/author b/test/test_files/metadata/author
new file mode 100644 (file)
index 0000000..5f36248
--- /dev/null
@@ -0,0 +1 @@
+Joe Sixpack
\ No newline at end of file
diff --git a/test/test_files/metadata/title b/test/test_files/metadata/title
new file mode 100644 (file)
index 0000000..4d35b7e
--- /dev/null
@@ -0,0 +1 @@
+Yet another blog
\ No newline at end of file
diff --git a/test/test_files/metadata/url b/test/test_files/metadata/url
new file mode 100644 (file)
index 0000000..673d303
--- /dev/null
@@ -0,0 +1 @@
+http://example.org/
\ No newline at end of file