git3html

git clone https://orangeshoelaces.net/git/git3html.git

a05fbd64411e74cedc61149bbe03555869eae0aa

Author: Vasilii Kolobkov on 01/14/2019

Committer: Vasilii Kolobkov on 01/14/2019

Dump <pre>'s in directory listings and elsewhere

Stats

git3html | 18 ++++----
1 file changed, 8 insertions(+), 10 deletions(-)

Patch

diff --git a/git3html b/git3html
index b41bf01..447ccb5 100755
--- a/git3html
+++ b/git3html
@@ -154,13 +154,11 @@ commit() (
 		header "${projname} commit ${shortid}" ..
 		printf '<h2>%s<span class="id-suffix">%s</h2>\n' "$shortid" \
 			"$(echo "$id" | cut -c "$(expr ${#shortid} + 1)-")"
-		printf '<pre><code>'
 		for v in an ae ad cn ce cd; do
 			IFS= read -r "$v"
 		done
-		printf 'Author:    <a href="mailto:%s">%s</a> on %s\n' "$ae" "$an" "$ad"
-		printf 'Committer: <a href="mailto:%s">%s</a> on %s' "$ce" "$cn" "$cd"
-		printf '</code></pre>\n'
+		printf '<p>Author: <a href="mailto:%s">%s</a> on %s</p>\n' "$ae" "$an" "$ad"
+		printf '<p>Committer: <a href="mailto:%s">%s</a> on %s</p>\n' "$ce" "$cn" "$cd"
 	}
 	printf '<h3>Stats</h3>\n'
 	printf '<pre><code>'
@@ -221,7 +219,7 @@ log() (
 )
 
 dirent() {
-	printf "<li><pre><code>d <a href=\"%s\">%s</a></code></pre></li>\n" \
+	printf '<li><span class="sigil">d</span> <a href="%s">%s</a></li>\n' \
 		"$(echo "$2" | escape)" "$(echo "$1" | escape)"
 }
 
@@ -237,18 +235,18 @@ blobent() (
 	type="$(expr \( $mode - $mode % 10000 \) / 10000)"
 	if [ "$type" -eq 10 ]; then	# regular file
 		if [ "$(g cat-file -p "$blob" | isbinary)" = y ]; then
-			printf '<li><pre><code>b %s</code></pre></li>\n' \
+			printf '<li><span class="sigil">b</span> %s</li>\n' \
 				"$(echo "$name" | escape)"
 		else
 			textfile "$blob" "$reppath" "$relbaseoutdir" > "${outdir%/}/${name}.html"
-			printf '<li><pre><code>f <a href="%s">%s</a></code></pre></li>\n' \
+			printf '<li><span class="sigil">t</span> <a href="%s">%s</a></li>\n' \
 				"$(echo "${relout%/}/${name}.html" | escape)" \
 				"$(echo "$name" | escape)"
 		fi
 	elif [ "$type" -eq 12 ]; then	# link
-		printf "<li><pre><code>l %s</code></pre></li>\n" "$(echo "$name" | escape)"
+		printf "<li><span class="sigil">l</span> %s</li>\n" "$(echo "$name" | escape)"
 	else
-		printf "<li><pre><code>o %s</code></pre></li>\n" "$(echo "$name" | escape)"
+		printf "<li><span class="sigil">o</span> %s</li>\n" "$(echo "$name" | escape)"
 	fi
 )
 
@@ -280,7 +278,7 @@ files() (
 	{
 		header "${reppath}:" "$relbaseoutdir"
 		printf '<h2>%s</h2>\n' "$(echo "$reppath" | escape)"
-		echo '<ul>'
+		echo '<ul class="dir">'
 		if [ -n "$relparidx" ]; then
 			dirent '..' "$relparidx"
 		fi