about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-03-18 10:49:03 -0500
committerCase Duckworth2024-03-18 10:49:03 -0500
commite09fae637a6d1ea3346c1cf0c2fa7703ec9739af (patch)
treecf7b96a9b34c4b014cb94d15a27bb47b98fc4000
parentChange repo link color (diff)
downloadschwa-e09fae637a6d1ea3346c1cf0c2fa7703ec9739af.tar.gz
schwa-e09fae637a6d1ea3346c1cf0c2fa7703ec9739af.zip
Add ROOT template variable
-rw-r--r--example/template.html2
-rwxr-xr-xschwa.awk2
2 files changed, 3 insertions, 1 deletions
diff --git a/example/template.html b/example/template.html index c67ae0d..4bf3d2a 100644 --- a/example/template.html +++ b/example/template.html
@@ -14,7 +14,7 @@
14 <!--NORMAL--> 14 <!--NORMAL-->
15 <nav> 15 <nav>
16 <ul> 16 <ul>
17 <li><a href="/">index</a></li> 17 <li><a href="{{ROOT}}">index</a></li>
18 <li><a href="{{RAWFILE}}">source</a></li> 18 <li><a href="{{RAWFILE}}">source</a></li>
19 </ul> 19 </ul>
20 </nav> 20 </nav>
diff --git a/schwa.awk b/schwa.awk index 946a2cf..cdc558e 100755 --- a/schwa.awk +++ b/schwa.awk
@@ -14,6 +14,8 @@ BEGIN {
14 else TMPLV["CLONE"] = "" 14 else TMPLV["CLONE"] = ""
15 if (desc) TMPLV["DESCRIPTION"] = "<p class=\"desc\">" desc "</p>" 15 if (desc) TMPLV["DESCRIPTION"] = "<p class=\"desc\">" desc "</p>"
16 else TMPLV["DESCRIPTION"] = "" 16 else TMPLV["DESCRIPTION"] = ""
17 if (root) TMPLV["ROOT"] = root
18 else TMPLV["ROOT"] = "/"
17 "pwd" | getline TMPLV["DIRECTORY"]; close("pwd") 19 "pwd" | getline TMPLV["DIRECTORY"]; close("pwd")
18 TMPLV["DIRECTORY"] = outfn(TMPLV["DIRECTORY"], 3) 20 TMPLV["DIRECTORY"] = outfn(TMPLV["DIRECTORY"], 3)
19} 21}