Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMike Gerwitz <mike@mikegerwitz.com>2013-06-06 14:44:39 -0400
committerMike Gerwitz <mike@mikegerwitz.com>2013-06-06 14:59:48 -0400
commit050071eb321b3e96e52079e8119d80c2acf7f4b0 (patch)
tree2bee8519061bacc8349be237df5ba9d2ae78f18c /tools
parent962e7bf63e66c52f66a19385375025d4c0f8a8e9 (diff)
downloadthoughts-050071eb321b3e96e52079e8119d80c2acf7f4b0.tar.gz
thoughts-050071eb321b3e96e52079e8119d80c2acf7f4b0.tar.bz2
thoughts-050071eb321b3e96e52079e8119d80c2acf7f4b0.zip
doclist altered to use URL rewriting scheme rather than extension-less filenames
Was convenient for development, but I would prefer to stay conventional.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/doc-cp21
1 files changed, 6 insertions, 15 deletions
diff --git a/tools/doc-cp b/tools/doc-cp
index b2312d4..bacf4f8 100755
--- a/tools/doc-cp
+++ b/tools/doc-cp
@@ -1,7 +1,6 @@
#!/bin/bash
#
-# Copies a html file without its sorting prefix and extension, placing it in its
-# own directory and naming it as an index file if necessary
+# Copies a html file without its sorting prefix
#
# Copyright (C) 2013 Mike Gerwitz
#
@@ -22,8 +21,7 @@
sstrip()
{
base="$( basename "$1" )"
- a="${base#??-}"
- echo "${1%/*}/${a%.*}"
+ echo "${1%/*}/${base#??-}"
}
[ -n "$2" ] || {
@@ -31,15 +29,8 @@ sstrip()
exit 64
}
-dest="$( sstrip "$2" )"
-
-# if there is a src directory matching the stripped src name, then we shall
-# place the destination file in a subdirectory of that name; this both solves
-# the problem of naming conflicts and maintains the illusion of url rewriting
-# using only the filesystem
-[ -d "$( sstrip "$1" )" ] \
- && dest="$dest/index.html"
+# ensure that parent directory exists
+mkdir -p "${dest%/*}"
-dir="${dest%/*}"
-( test -d "$dir" || mkdir -p "$dir" ) \
- && cp -v "$1" "$dest"
+dest="$( sstrip "$2" )"
+cp -v "$1" "$dest"