ref: cac95f38711f382d0a56c8ff87c6302636dac338
parent: c43ab6e0f3a1b4122b6263351cf58a9724a22396
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Nov 9 23:38:39 EST 2022
view: add navigation bar, slashes on directories
--- a/view
+++ b/view
@@ -27,8 +27,21 @@
user_prelude $gituser $repo $hash
echo ' <p>
- <b>ref:</b> <a href="'/$gituser/$repo/$hash/files.html'">'$hash'</a><br/>
- </p>'
+ <b>ref:</b> <a href="'/$gituser/$repo/$hash/files.html'">'$hash'</a><br/>'
+echo $file | htcat | awk -F/ '{
+ user = ENVIRON["gituser"]
+ repo = ENVIRON["repo"]
+ hash = ENVIRON["hash"]
+ url="/" user "/" repo "/" hash
+ printf("<b>dir:</b> <a href=\"%s/f.html\">/</a>", url);
+ for(i = 1; i <= NF; i++){
+ if($i != "."){
+ url=url"/"$i
+ printf("<a href=\"%s/f.html\">%s</a>/", url, $i)
+ }
+ }
+ printf("</p>")
+}'
if(test -f $file){
echo ' <a href="'/$gituser/$repo/$hash/$file'/raw">View raw version</a>'
type=`{file -m $file}
@@ -49,8 +62,10 @@
for(f in `$nl{ls}){
url=`$nl{echo -n $f/f.html | urlencode}
fname=`$nl{echo -n $f | htcat}
- echo '<a href="'$url'">'$fname'</a><br/>'
- }
+ echo -n '<a href="'$url'">'$fname
+ if (test -d $f) echo '/'
+ echo '</a><br/>'
+ }
echo ' </div>'
}
echo ' </body>