Standardized on Self

Christopher Vollick [2010-03-21 00:26]
Standardized on Self

I needed it in one place, and I found I was kind of using it in other places too.

So, now each template gets a link to it's own url.
Filename
gitsite
diff --git a/gitsite b/gitsite
index 877fa26..c97937a 100755
--- a/gitsite
+++ b/gitsite
@@ -86,26 +86,29 @@ for index in $(seq 1 $numArticles); do
 	# This should be the same as the ID now, but might as well pull it from this source while I've got it
 	published="$(echo "$dates" | sed -n '$p')"

+	# This is the url for the current article
+	self="$encTitle"
+
 	# Run the article through the markup engine
 	./markup_engine < "articles/$title" > "$tmpArticleDir/$title"

 	# Now, run the article template on the content.
-	templates/article Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" > "$tmpArticleTemplateDir/$title"
+	templates/article Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" Self "$self" > "$tmpArticleTemplateDir/$title"

 	# Finish off with the site template
-	templates/site Content "|$tmpArticleTemplateDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" > "$articleDestDir/${encTitle}"
+	templates/site Content "|$tmpArticleTemplateDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" Self "$self" > "$articleDestDir/${encTitle}"

 	# And make a permalink
 	ln -f "$articleDestDir/$encTitle" "$idDestDir/$id"

 	# If this article is within the first feedNum, run it through there.
 	if [ "$index" -le "$feedNum" ]; then
-		templates/atom-entry Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" >> "$tmpAtom"
+		templates/atom-entry Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" Self "$self" >> "$tmpAtom"
 	fi

 	# If this article is within the first indexNum, run it through there.
 	if [ "$index" -le "$indexNum" ]; then
-		templates/index-article Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" Self "articles/$encTitle" >> "$tmpIndex"
+		templates/index-article Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" Self "$self" >> "$tmpIndex"
 	fi
 done
ViewGit