Updated Redo Version

Christopher Vollick [2013-09-25 00:42]
Updated Redo Version

The new(er) version of redo changed $1 and $2 to mean other things.
Since I wanted to update it, in general, I had to fix this.
Filename
default.augmented.do
default.converted.do
default.html.do
default.tagfeed.do
default.tagindex.do
default.tagtemplate.do
diff --git a/default.augmented.do b/default.augmented.do
index cea6ad4..3ce62e8 100644
--- a/default.augmented.do
+++ b/default.augmented.do
@@ -3,9 +3,9 @@
 # It's meant to fill in all the auto-generatable blanks
 # This implementation gets data from git.

-redo-ifchange "$1.mime"
+redo-ifchange "$2.mime"

-times="$(git log --follow --pretty=format:%at "$1.mime")"
+times="$(git log --follow --pretty=format:%at "$2.mime")"
 # This is the last time a change was made
 modify_time="$(echo "$times" | sed -n '1p')"
 # This is the first time the file was added
@@ -13,7 +13,7 @@ create_time="$(echo "$times" | sed -n '$p')"

 # This is the ID
 # It's used by things which are just given the contents and not the filename.
-id="$1"
+id="$2"

 # This is the date format (iso8601)
 date_format="%Y-%m-%dT%H:%M:%SZ"
@@ -22,4 +22,4 @@ date_format="%Y-%m-%dT%H:%M:%SZ"
 echo "Date-Created: $(date -ud "@$create_time" "+$date_format")"
 echo "Date-Modified: $(date -ud "@$modify_time" "+$date_format")"
 echo "ID: $id"
-cat "$1.mime"
+cat "$2.mime"
diff --git a/default.converted.do b/default.converted.do
index abee25b..02d49f6 100644
--- a/default.converted.do
+++ b/default.converted.do
@@ -1,17 +1,17 @@

 # This is meant to take the mime files and turn their bodies from whatever format they are, into html

-redo-ifchange "$1.augmented"
+redo-ifchange "$2.augmented"

 # Pull the type out of the file to figure out how to build it
 # Also, convert the / in the type into _ for filesystem niceness
-type="$(./extract_headers "Content-Type" < "$1.augmented" | tr '/' '_')"
+type="$(./extract_headers "Content-Type" < "$2.augmented" | tr '/' '_')"
 if [ -z "$type" ]; then
 	echo "Warning: No Content Type. Assuming text/plain" >&2
 	type="text_plain"
 fi
 # Output the headers of the augmented file, without Content-Type
-sed '/^$/,$d' < "$1.augmented" | grep -v '^Content-Type:'
+sed '/^$/,$d' < "$2.augmented" | grep -v '^Content-Type:'
 # We assume that it will turn into HTML, so we'll add that now
 echo "Content-Type: text/html"
 # Now, we're done with headers
@@ -21,4 +21,4 @@ echo
 redo-ifchange "$type.typeconvert"

 # Now run it with the body and let it output directly
-sed '1,/^$/d' < "$1.augmented" | "./$type.typeconvert"
+sed '1,/^$/d' < "$2.augmented" | "./$type.typeconvert"
diff --git a/default.html.do b/default.html.do
index 499c265..d2bddc0 100644
--- a/default.html.do
+++ b/default.html.do
@@ -2,8 +2,8 @@
 # This is meant to take the mime files and run them through this tag's template engine to get static html files
 # It also fills in some per-tag info

-tag="${1##*.}"
-base="$(basename "$1" ".$tag")"
+tag="${2##*.}"
+base="$(basename "$2" ".$tag")"
 dependedFile="$base.converted"

 redo-ifchange "$dependedFile" "$tag.tagtemplate" "tagindex"
diff --git a/default.tagfeed.do b/default.tagfeed.do
index 7f280fb..df0bbfe 100644
--- a/default.tagfeed.do
+++ b/default.tagfeed.do
@@ -1,7 +1,7 @@

 # This file makes feed, for each tag, of recent articles, etc.

-tag="$1"
+tag="$2"
 author_name="Christopher Vollick"
 author_email="0@psycoti.ca"
 icon="http://psycoti.ca/0/static/avatar.png"
diff --git a/default.tagindex.do b/default.tagindex.do
index f72444e..9f18f18 100644
--- a/default.tagindex.do
+++ b/default.tagindex.do
@@ -1,7 +1,7 @@

 # This file makes list, for each tag, of recent articles, etc.

-tag="$1"
+tag="$2"

 echo '<?xml version="1.0" encoding="UTF-8"?>'
 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
diff --git a/default.tagtemplate.do b/default.tagtemplate.do
index bd84728..053c493 100644
--- a/default.tagtemplate.do
+++ b/default.tagtemplate.do
@@ -12,7 +12,7 @@ created="$(echo "$contents" | ./extract_headers "Date-Created")"
 modified="$(echo "$contents" | ./extract_headers "Date-Modified")"
 id="$(echo "$contents" | ./extract_headers "ID")"
 ' > "$3"
-echo "tag='$1'" >> "$3"
+echo "tag='$2'" >> "$3"

 echo 'redo-ifchange "tagindex"
ViewGit