summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-07-25 21:22:59 -0400
committerrsiddharth <s@ricketyspace.net>2020-07-25 21:22:59 -0400
commitc010ab8b8842c3b4c4d861147b78e79be63bf5ee (patch)
tree8e760c9fe756b2c79021194a7f12fe40e619d9dd /bin
parenta44d5fe53e3c8f273da90c5724c8536ff7bac383 (diff)
bin/html: add langhtml.
* bin/html (langhtml): New function.
Diffstat (limited to 'bin')
-rw-r--r--bin/html12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/html b/bin/html
index 91d59d2..14adba3 100644
--- a/bin/html
+++ b/bin/html
@@ -146,6 +146,18 @@ def lhref(sec, s, l):
return '<a href="/{}/{}/{}">{}</a>'.format(sec, s, l, l)
+def langhtml(sec, s, lng, lngs):
+ lsh = []
+
+ for l in lngs:
+ if (l == 'en' and lng is None) or (l == lng):
+ lsh.append(l)
+ else:
+ lsh.append(lhref(sec, s, l))
+
+ return template('lang').replace(PH['lang'], ' | '.join(lsh), 1)
+
+
def html(sec, f):
c = read(f.path)
s, l = slug(f.path)