Scripts for working with HTML

This commit is contained in:
Ev Bogdanov 2018-01-20 23:11:10 +03:00
parent 3b1863798e
commit 46f6d59d2d
3 changed files with 30 additions and 0 deletions

10
bin/htm Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
echo addr=dot | 9p write acme/$winid/ctl
data=$(9p read acme/$winid/xdata)
indentation=$(echo "$data" | sed 1q | sed -E 's/^( *).*$/\1/')
html=$(echo "$data" | sed "s/^$indentation//" | pug --pretty | sed '/^$/d' | s2t 2 | sed "s/^/$indentation/")
echo addr=dot | 9p write acme/$winid/ctl
echo -n "$html" | 9p write acme/$winid/data