home · contact · privacy
Move everything that does not need to be top level dir into sub dir.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 21 Dec 2016 22:07:47 +0000 (23:07 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 21 Dec 2016 22:07:47 +0000 (23:07 +0100)
32 files changed:
add_dir.sh
processor/.meta/author.do [new file with mode: 0644]
processor/.meta/default.feed_snippet.do [new file with mode: 0644]
processor/.meta/default.index_snippet.do [new file with mode: 0644]
processor/.meta/default.intermediate.do [new file with mode: 0644]
processor/.meta/default.uuid.do [new file with mode: 0644]
processor/.meta/helpers.sh [new file with mode: 0644]
processor/.meta/intermediate.tmpl [new file with mode: 0644]
processor/.meta/title.do [new file with mode: 0644]
processor/.meta/url.do [new file with mode: 0644]
processor/.meta/uuid.do [new file with mode: 0644]
processor/all.do
processor/author.meta.do [deleted file]
processor/default.feed_snippet.do [deleted file]
processor/default.html.do
processor/default.index_snippet.do [deleted file]
processor/default.intermediate.do [deleted file]
processor/default.uuid.do [deleted file]
processor/feed.xml.do
processor/helpers.sh [deleted file]
processor/index.html.do
processor/intermediate.tmpl [deleted file]
processor/title.meta.do [deleted file]
processor/url.meta.do [deleted file]
processor/uuid.meta.do [deleted file]
test.sh
test/test_files/.meta/author [new file with mode: 0644]
test/test_files/.meta/title [new file with mode: 0644]
test/test_files/.meta/url [new file with mode: 0644]
test/test_files/author.meta [deleted file]
test/test_files/title.meta [deleted file]
test/test_files/url.meta [deleted file]

index 33bc9135ee1e82ba74c82d060028224020defeab..36bcf665d47af61e6ed8f6653732489613a06bc6 100755 (executable)
@@ -2,11 +2,26 @@
 
 set -e
 
+link_files_in_dir () {
+  srcdir="$1"
+  for file in "$srcdir"/* "$srcdir"/.*; do
+    if [ -f "$file" ]; then
+      set +e
+      ln -s "$file"
+      set -e
+    elif [ -d "$file" ] && \
+        [ $(basename "$file") != "." ] && \
+        [ $(basename "$file") != ".." ]; then
+      dir=$(basename "$file")
+      mkdir "$dir"
+      cd "$dir"
+        link_files_in_dir "$srcdir/$dir"
+      cd ..
+    fi
+  done
+}
+
 srcdir=`pwd`/processor
 mkdir -p "$1"
 cd "$1"
-for file in "$srcdir"/*; do
-  set +e
-  ln -s "$file"
-  set -e
-done 
+link_files_in_dir "$srcdir"
diff --git a/processor/.meta/author.do b/processor/.meta/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/.meta/default.feed_snippet.do b/processor/.meta/default.feed_snippet.do
new file mode 100644 (file)
index 0000000..1949d0b
--- /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/.meta/default.index_snippet.do b/processor/.meta/default.index_snippet.do
new file mode 100644 (file)
index 0000000..33499ed
--- /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/.meta/default.intermediate.do b/processor/.meta/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/.meta/default.uuid.do b/processor/.meta/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/.meta/helpers.sh b/processor/.meta/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"
+}
diff --git a/processor/.meta/intermediate.tmpl b/processor/.meta/intermediate.tmpl
new file mode 100644 (file)
index 0000000..2357009
--- /dev/null
@@ -0,0 +1,2 @@
+$title$
+$body$
diff --git a/processor/.meta/title.do b/processor/.meta/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/.meta/url.do b/processor/.meta/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/.meta/uuid.do b/processor/.meta/uuid.do
new file mode 100644 (file)
index 0000000..ba9e919
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  uuidgen
+fi
index edd2b476138f004700d16d19f9734d8116c56136..73d01249d653473fcc5eb760364aec696fff6b46 100644 (file)
@@ -1,24 +1,28 @@
 #!/bin/sh
 
+metadata_dir=.meta
+
 # Remove target files for which no sources files can be found.
-for file in *.intermediate; do
+for file in "$metadata_dir"/*.intermediate; do
+  basename=$(basename "$file")
   if   test -f "$file" &&
-     ! test -f "${file%.intermediate}.md" &&
-     ! test -f "${file%.intermediate}.rst"; then
+     ! test -f "${basename%.intermediate}.md" &&
+     ! test -f "${basename%.intermediate}.rst"; then
     rm "$file"
   fi
 done
-for file in *.uuid; do
+for file in "$metadata_dir"/*.uuid; do
+  basename=$(basename "$file")
   if   test -f "$file" &&
-     ! test -f "${file%.uuid}.md" &&
-     ! test -f "${file%.uuid}.rst"; then
+     ! test -f "${basename%.uuid}.md" &&
+     ! test -f "${basename%.uuid}.rst"; then
     rm "$file"
   fi
 done
 for file in *.html; do
   if   test -f "$file" &&
      ! test "$file" = "index.html" &&
-     ! test -f "${file%.html}.intermediate"; then
+     ! test -f "${metadata_dir}/${file%.html}.intermediate"; then
     rm "$file"
   fi
 done
@@ -27,12 +31,13 @@ done
 # of the all.do script on them / build them if necessary.
 for file in *.rst *.md; do
   if test -f "$file"; then
-    redo-ifchange "${file%.*}.intermediate"
+    redo-ifchange "${metadata_dir}/${file%.*}.intermediate"
   fi
 done
-for file in *.intermediate; do
+for file in "$metadata_dir"/*.intermediate; do
   if test -f "$file"; then
-    redo-ifchange "${file%.*}.html"
+    basename=$(basename "$file")
+    redo-ifchange "${basename%.intermediate}.html"
   fi
 done
 
diff --git a/processor/author.meta.do b/processor/author.meta.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/default.feed_snippet.do b/processor/default.feed_snippet.do
deleted file mode 100644 (file)
index 9d33ad9..0000000
+++ /dev/null
@@ -1,27 +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="${src_file%.*}.intermediate"
-redo-ifchange "$intermediate_file"
-
-# Get variables, write entry.
-html_file=`escape_url "${src_file%.*}.html"`
-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"
index 2a457a5ad2eda05c2f47e9953357da48af5de818..4371a3a0e70f9f12fae31712bad7a6c4240d8ecb 100644 (file)
@@ -1,9 +1,10 @@
 #!/bin/sh
 
 # Pull in global dependencies.
-. ./helpers.sh
-intermediate_file="${1%.html}.intermediate"
-title_file=title.meta
+metadata_dir=.meta
+. "$metadata_dir"/helpers.sh
+intermediate_file="${metadata_dir}/${1%.html}.intermediate"
+title_file="${metadata_dir}"/title
 redo-ifchange "$title_file" 
 redo-ifchange "$intermediate_file"
 
diff --git a/processor/default.index_snippet.do b/processor/default.index_snippet.do
deleted file mode 100644 (file)
index 759a510..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# Pull in dependencies.
-. ./helpers.sh
-src_file=$(get_source_file "$1")
-intermediate_file="${src_file%.*}.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/default.intermediate.do b/processor/default.intermediate.do
deleted file mode 100644 (file)
index 7470c3c..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/default.uuid.do b/processor/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
index 16011f3d744331f3142030554660e6a5b02a7178..2b4396957954b5eab9c021a0d3695c1fb2a7dfcb 100644 (file)
@@ -1,10 +1,12 @@
 #!/bin/sh
 
 # Pull in global dependencies.
-. ./helpers.sh
-author_file=author.meta
-uuid_file=uuid.meta
-title_file=title.meta
+metadata_dir=.meta
+. "$metadata_dir"/helpers.sh
+author_file="$metadata_dir"/author
+uuid_file="$metadata_dir"/uuid
+title_file="$metadata_dir"/title
+url_file="$metadata_dir"/url
 redo-ifchange "$url_file"
 redo-ifchange "$author_file"
 redo-ifchange "$uuid_file"
@@ -13,10 +15,11 @@ redo-ifchange "$title_file"
 # Build some variables. XML-escape even file contents that should not contain
 # dangerous characters, just to avoid any XML trouble.
 srcdir=`pwd`
-basepath=$(get_basepath)
+basepath=$(get_basepath "${metadata_dir}/")
 title=`read_and_escape_file "$title_file" | head -1`
 author=`read_and_escape_file "$author_file" | head -1`
 uuid=`read_and_escape_file "$uuid_file" | head -1`
+tmp_snippets_dir=.tmp_feed_snippets
 
 # Write majority of feed head.
 cat << EOF
@@ -30,21 +33,21 @@ printf "<author><name>%s</name></author>\n" "$author"
 printf "<id>urn:uuid:%s</id>\n" "$uuid"
 
 # Generate feed entry snippets.
-mkdir -p feed_snippets
+mkdir -p "$tmp_snippets_dir"
 for file in ./*.rst ./*.md; do
   if [ -e "$file" ]; then
-    uuid_file="${file%.*}.uuid"
+    uuid_file="${metadata_dir}/${file%.*}.uuid"
     redo-ifchange "$uuid_file"
     published=`stat -c%y "${uuid_file}"`
     published_unix=$(date -u "+%s%N" -d "${published}")
-    snippet_file="${file%.*}.feed_snippet"
+    snippet_file=./${metadata_dir}/"${file%.*}.feed_snippet"
     redo-ifchange "$snippet_file"
-    ln -s "$srcdir/$snippet_file" "./feed_snippets/${published_unix}"
+    ln -s "$srcdir/$snippet_file" "./${tmp_snippets_dir}/${published_unix}"
   fi
 done
 
 # Derive feed modification date from snippets.
-mod_dates=$(grep -hE "^<updated>" ./feed_snippets/* | sed -E 's/<.?updated>//g')
+mod_dates=$(grep -hE "^<updated>" ./${metadata_dir}/*.feed_snippet | sed -E 's/<.?updated>//g')
 last_mod_unix=0
 for date in $mod_dates; do
   date_unix=$(date -u "+%s" -d "${date}")
@@ -56,11 +59,11 @@ lastmod_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "@${last_mod_unix}"`
 printf "<updated>%s</updated>\n\n" "$lastmod_rfc3339"
 
 # Write feed entries.
-for file in ./feed_snippets/*; do
+for file in ./${tmp_snippets_dir}/*; do
   cat "${file}"
   printf "\n"
 done
-rm -rf feed_snippets
+rm -rf "$tmp_snippets_dir"
 
 # Write feed foot.
 printf "</feed>"
diff --git a/processor/helpers.sh b/processor/helpers.sh
deleted file mode 100644 (file)
index cc12358..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=url.meta
-  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 af8ba85e225e05599ba7cca418f68ad453b9376f..64fe355e037e2b77b6569e525761db1228e088c0 100644 (file)
@@ -1,9 +1,10 @@
 #!/bin/sh
 
 # Pull in global dependencies.
-. ./helpers.sh
+metadata_dir=.meta
+. "$metadata_dir"/helpers.sh
 srcdir=`pwd`
-title_file=title.meta
+title_file="$metadata_dir"/title
 redo-ifchange "$title_file"
 
 # Write index head.
@@ -17,29 +18,30 @@ printf "<title>%s</title>\n</head>\n<body>\n" "$blog_title"
 printf "<h1>%s</h1>\n<ul>\n" "$blog_title"
 
 # Generate link list entries.
-mkdir -p index_snippets
+tmp_snippets_dir=.tmp_index_snippets
+mkdir -p "$tmp_snippets_dir"
 for file in ./*.rst ./*.md; do
   if [ -e "$file" ]; then
-    uuid_file="${file%.*}.uuid"
+    uuid_file="${metadata_dir}/${file%.*}.uuid"
     redo-ifchange "$uuid_file"
     published=`stat -c%y "${uuid_file}"`
     published_unix=$(date -u "+%s%N" -d "${published}")
-    snippet_file="${file%.*}.index_snippet"
+    snippet_file="${metadata_dir}/${file%.*}.index_snippet"
     redo-ifchange "$snippet_file"
-    ln -s "$srcdir/$snippet_file" "./index_snippets/${published_unix}"
+    ln -s "$srcdir/$snippet_file" "./${tmp_snippets_dir}/${published_unix}"
   fi
 done
 
 # Write link list.
-for file in ./index_snippets/*; do
-  touch ./index_snippets/list
-  cat "$file" ./index_snippets/list > ./index_snippets/tmp
-  mv ./index_snippets/tmp ./index_snippets/list
+for file in ./${tmp_snippets_dir}/*; do
+  touch ./${tmp_snippets_dir}/list
+  cat "$file" ./${tmp_snippets_dir}/list > ./${tmp_snippets_dir}/tmp
+  mv ./${tmp_snippets_dir}/tmp ./${tmp_snippets_dir}/list
 done
-if [ -e "./index_snippets/list" ]; then
-  cat ./index_snippets/list
+if [ -e "./${tmp_snippets_dir}/list" ]; then
+  cat ./${tmp_snippets_dir}/list
 fi
-rm -rf index_snippets
+rm -rf "${tmp_snippets_dir}"
 
 # Write index footer.
 printf "</ul>\n</body>\n</html>"
diff --git a/processor/intermediate.tmpl b/processor/intermediate.tmpl
deleted file mode 100644 (file)
index 2357009..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-$title$
-$body$
diff --git a/processor/title.meta.do b/processor/title.meta.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/url.meta.do b/processor/url.meta.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/uuid.meta.do b/processor/uuid.meta.do
deleted file mode 100644 (file)
index ba9e919..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "$1" ]; then
-  uuidgen
-fi
diff --git a/test.sh b/test.sh
index d930e6697d3763bb827eb6f254307b0693a59920..c54e48a23057587c007c6a6d9f7dac1c792172f0 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -2,13 +2,13 @@
 
 uuid_test()
 {
-uuid_file="$1"
-printf "== %s UUID pattern match test ==\n" "$uuid_file"
-if cat "$uuid_file" | grep -Eq "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; then
-  echo "== test SUCCESS =="
-else
-  echo "== test FAILURE =="
-fi
+  uuid_file="$1"
+  printf "== %s UUID pattern match test ==\n" "$uuid_file"
+  if cat "$uuid_file" | grep -Eq "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; then
+    echo "== test SUCCESS =="
+  else
+    echo "== test FAILURE =="
+  fi
 }
 
 diff_test()
@@ -42,13 +42,14 @@ redo
 cd "$working_dir"
 
 # Simple file comparison tests and UUID tests.
-uuid_test "$generated_files_dir""/uuid.meta"
-for file in "$expected_files_dir"/*.html "$expected_files_dir"/*.meta; do
+uuid_test "$generated_files_dir""/.meta/uuid"
+for file in "$expected_files_dir"/*.html "$expected_files_dir"/.meta/*; 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
-    uuid_test "${cmp_file%.html}.uuid"
+    basename=$(basename "$cmp_file")
+    uuid_test "${generated_files_dir}/.meta/${basename%.html}.uuid"
   fi
   diff_test "$file" "$cmp_file"
 done
diff --git a/test/test_files/.meta/author b/test/test_files/.meta/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/.meta/title b/test/test_files/.meta/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/.meta/url b/test/test_files/.meta/url
new file mode 100644 (file)
index 0000000..673d303
--- /dev/null
@@ -0,0 +1 @@
+http://example.org/
\ No newline at end of file
diff --git a/test/test_files/author.meta b/test/test_files/author.meta
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/title.meta b/test/test_files/title.meta
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/url.meta b/test/test_files/url.meta
deleted file mode 100644 (file)
index 673d303..0000000
+++ /dev/null
@@ -1 +0,0 @@
-http://example.org/
\ No newline at end of file