🢀︎ stagit :: 2092028


commit 2092028a827a488503d520f4499bedeacbe774c3
Author: acidvegas <acid.vegas@acid.vegas>
Date:   Sat Jul 13 05:55:59 2019 -0400

    Removed some bashisms in html/css generation functions

diff --git a/stagit b/stagit
index 293239d..74fb8c1 100755
--- a/stagit
+++ b/stagit
@@ -14,49 +14,49 @@ WWW_DIR=$HOME/www    # directory to output to
 
 generate_css() {
 	if [ $THEME = 'light' ]; then
-		echo -e "a{color:blue}\n"\ # todo: fix possible bashism
-				"body{background-color:#fff;color:#000;font-family:monospace;margin-top:0px}\n"\
-				"code{counter-increment:line}\n"\
-				"code::before{border-right:1px solid #000;color:#000;content:counter(line);display:inline-block;margin-right:.5em;padding:0 .5em;width:1.5em;-webkit-user-select:none}\n"\
-				"h1{margin:0px}\n"\
-				"h1 a{color:#000;text-decoration:none}\n"\
-				"h4{color:#777;margin:0px}\n"\
-				"h5{margin:0px;font-style:italic;font-weight:normal}\n"\
-				"hr{border:none;border-bottom:1px solid #777}\n"\
-				"pre{counter-reset:line}\n"\
-				".item:hover{background-color:#eee}\n"\
-				".item td{white-space:nowrap}\n"\
-				"#main{border-collapse:collapse;table-layout:fixed}\n"\
-				"#main td,th{padding-left:5px;padding-right:5px}\n"\
-				"#navigation{color:#000;font-weight:900;text-align:left}" >> $WWW_DIR/style.css
+		echo "a{color:blue}" >> $WWW_DIR/style.css
+		echo "body{background-color:#fff;color:#000;font-family:monospace;margin-top:0px}" >> $WWW_DIR/style.css
+		echo "code{counter-increment:line}" >> $WWW_DIR/style.css
+		echo "code::before{border-right:1px solid #000;color:#000;content:counter(line);display:inline-block;margin-right:.5em;padding:0 .5em;width:1.5em;-webkit-user-select:none}" >> $WWW_DIR/style.css
+		echo "h1{margin:0px}" >> $WWW_DIR/style.css
+		echo "h1 a{color:#000;text-decoration:none}" >> $WWW_DIR/style.css
+		echo "h4{color:#777;margin:0px}" >> $WWW_DIR/style.css
+		echo "h5{margin:0px;font-style:italic;font-weight:normal}" >> $WWW_DIR/style.css
+		echo "hr{border:none;border-bottom:1px solid #777}" >> $WWW_DIR/style.css
+		echo "pre{counter-reset:line}" >> $WWW_DIR/style.css
+		echo ".item:hover{background-color:#eee}" >> $WWW_DIR/style.css
+		echo ".item td{white-space:nowrap}" >> $WWW_DIR/style.css
+		echo "#main{border-collapse:collapse;table-layout:fixed}" >> $WWW_DIR/style.css
+		echo "#main td,th{padding-left:5px;padding-right:5px}" >> $WWW_DIR/style.css
+		echo "#navigation{color:#000;font-weight:900;text-align:left}" >> $WWW_DIR/style.css
 	else
-		echo -e "a{color:#8dc}\n"\ # todo: fix possible bashism
-				"a:hover{color:#8cd}\n"\
-				"body{background-color:#111;color:#fff;font-family:monospace;margin-top:0px}\n"\
-				"code{counter-increment:line}\n"\
-				"code::before{border-right:1px solid #fff;color:#fff;content:counter(line);display:inline-block;margin-right:.5em;padding:0 .5em;width:1.5em;-webkit-user-select:none}\n"\
-				"h1{margin:0px}\n"\
-				"h1 a{color:#fff;text-decoration:none}\n"\
-				"h4{color:#777;margin:0px}\n"\
-				"h5{font-style:italic;font-weight:normal;margin:0px}\n"\
-				"hr{border:none;border-bottom:1px dashed #fff}\n"\
-				"pre{counter-reset:line}\n"\
-				".item:hover{background-color:#1a1a1a}\n"\
-				".item td{white-space:nowrap}\n"\
-				"#main{border-collapse:collapse;table-layout:fixed}\n"\
-				"#main td,th{padding-left:5px;padding-right:5px}\n"\
-				"#navigation{color:#fff;font-weight:900;text-align:left}" >> $WWW_DIR/style.css
+		echo "a{color:#8dc}" >> $WWW_DIR/style.css
+		echo "a:hover{color:#8cd}" >> $WWW_DIR/style.css
+		echo "body{background-color:#111;color:#fff;font-family:monospace;margin-top:0px}" >> $WWW_DIR/style.css
+		echo "code{counter-increment:line}" >> $WWW_DIR/style.css
+		echo "code::before{border-right:1px solid #fff;color:#fff;content:counter(line);display:inline-block;margin-right:.5em;padding:0 .5em;width:1.5em;-webkit-user-select:none}" >> $WWW_DIR/style.css
+		echo "h1{margin:0px}" >> $WWW_DIR/style.css
+		echo "h1 a{color:#fff;text-decoration:none}" >> $WWW_DIR/style.css
+		echo "h4{color:#777;margin:0px}" >> $WWW_DIR/style.css
+		echo "h5{font-style:italic;font-weight:normal;margin:0px}" >> $WWW_DIR/style.css
+		echo "hr{border:none;border-bottom:1px dashed #fff}" >> $WWW_DIR/style.css
+		echo "pre{counter-reset:line}" >> $WWW_DIR/style.css
+		echo ".item:hover{background-color:#1a1a1a}" >> $WWW_DIR/style.css
+		echo ".item td{white-space:nowrap}" >> $WWW_DIR/style.css
+		echo "#main{border-collapse:collapse;table-layout:fixed}" >> $WWW_DIR/style.css
+		echo "#main td,th{padding-left:5px;padding-right:5px}" >> $WWW_DIR/style.css
+		echo "#navigation{color:#fff;font-weight:900;text-align:left}" >> $WWW_DIR/style.css
 	fi
 }
 
 generate_index() {
-	echo -e "<!doctype html>\n"\ # todo: fix possible bashism
-			"<link rel=\"stylesheet\" href=\"style.css\">\n"\
-			"<title>Repositories</title>\n"\
-			"<h1><a href=\"index.html\" title=\"Home\">&#8962;&#xFE0E;</a> Repositories</h1>\n"\
-			"<hr>\n"\
-			"<table id=\"main\" cellpadding=\"0\" cellspacing=\"0\">\n"\
-			"<tr id=\"navigation\"><th>Name</th><th>Description</th><th>Owner</th><th>Last commit</th></tr>" >> $WWW_DIR/index.html
+	echo "<!doctype html>" >> $WWW_DIR/index.html
+	echo "<link rel=\"stylesheet\" href=\"style.css\">" >> $WWW_DIR/index.html
+	echo "<title>Repositories</title>" >> $WWW_DIR/index.html
+	echo "<h1><a href=\"index.html\" title=\"Home\">&#8962;&#xFE0E;</a> Repositories</h1>" >> $WWW_DIR/index.html
+	echo "<hr>" >> $WWW_DIR/index.html
+	echo "<table id=\"main\" cellpadding=\"0\" cellspacing=\"0\">" >> $WWW_DIR/index.html
+	echo "<tr id=\"navigation\"><th>Name</th><th>Description</th><th>Owner</th><th>Last commit</th></tr>" >> $WWW_DIR/index.html
 }
 
 generate_repository_index() {
@@ -64,26 +64,26 @@ generate_repository_index() {
 	local REPO_URL=$2
 	local REPO_DESC=${@:3} # todo: fix possible bashism
 	mkdir -p $WWW_DIR/$REPO_NAME/commit
-	echo -e "<!doctype html>\n"\ # todo: fix possible bashism
-			"<link rel=\"stylesheet\" href=\"../style.css\">\n"\
-			"<title>$REPO_NAME</title>\n"\
-			"<h1><a href=\"../index.html\" title=\"Home\">&#8962;&#xFE0E;</a> $REPO_NAME</h1>\n"\
-			"<h4>$REPO_DESC</h4>\n"\
-			"<h5>git clone <a href=\"$REPO_URL\" title=\"$REPO_NAME clone URL\">$REPO_URL</a></h5>\n"\
-			"<hr>\n"\
-			"<table id=\"main\" cellpadding=\"0\" cellspacing=\"0\">\n"\
-			"<tr id=\"navigation\"><th></th><th>Hash</th><th>Commit message</th><th>Author</th><th>Date</th></tr>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<!doctype html>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<link rel=\"stylesheet\" href=\"../style.css\">" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<title>$REPO_NAME</title>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<h1><a href=\"../index.html\" title=\"Home\">&#8962;&#xFE0E;</a> $REPO_NAME</h1>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<h4>$REPO_DESC</h4>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<h5>git clone <a href=\"$REPO_URL\" title=\"$REPO_NAME clone URL\">$REPO_URL</a></h5>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<hr>" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<table id=\"main\" cellpadding=\"0\" cellspacing=\"0\">" >> $WWW_DIR/$REPO_NAME/index.html
+	echo "<tr id=\"navigation\"><th></th><th>Hash</th><th>Commit message</th><th>Author</th><th>Date</th></tr>" >> $WWW_DIR/$REPO_NAME/index.html
 }
 
 generate_commit_index() {
 	local REPO_NAME=$1
 	local COMMIT_HASH=$2
-	echo -e "<!doctype html>\n"\ # todo: fix possible bashism
-			"<link rel=\"stylesheet\" href=\"../../style.css\">\n"\
-			"<title>$REPO_NAME :: $COMMIT_HASH</title>\n"\
-			"<h1><a href=\"../index.html\" title=\"Back to Repository\">&#x1F880;&#xFE0E;</a> $REPO_NAME :: $COMMIT_HASH</h1>\n"\
-			"<hr>\n"\
-			"<pre>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
+	echo "<!doctype html>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
+	echo "<link rel=\"stylesheet\" href=\"../../style.css\">" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
+	echo "<title>$REPO_NAME :: $COMMIT_HASH</title>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
+	echo "<h1><a href=\"../index.html\" title=\"Back to Repository\">&#x1F880;&#xFE0E;</a> $REPO_NAME :: $COMMIT_HASH</h1>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
+	echo "<hr>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
+	echo "<pre>" >> $WWW_DIR/$REPO_NAME/commit/$COMMIT_HASH.html
 }
 
 [ ! -d $REPO_DIR ] && echo "'$REPO_DIR' directory does not exist" && exit 1