Scripts for working with CSS
This commit is contained in:
parent
46f6d59d2d
commit
60f1729086
3 changed files with 42 additions and 0 deletions
10
bin/css
Executable file
10
bin/css
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo addr=dot | 9p write acme/$winid/ctl
|
||||
echo -n '__MARKER__' | 9p write acme/$winid/data
|
||||
echo -n '/^.*__MARKER__/' | 9p write acme/$winid/addr
|
||||
echo dot=addr | 9p write acme/$winid/ctl
|
||||
in=$(9p read acme/$winid/xdata | sed 's/__MARKER__//')
|
||||
out=$(echo "$in" | cssify)
|
||||
echo addr=dot | 9p write acme/$winid/ctl
|
||||
echo -n "$out" | 9p write acme/$winid/data
|
||||
31
bin/cssify
Executable file
31
bin/cssify
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
awk '
|
||||
BEGIN {
|
||||
css["f"]="font"
|
||||
css["fz"]="font-size"
|
||||
css["w"]="width"
|
||||
css["h"]="height"
|
||||
}
|
||||
|
||||
function cssify(line) {
|
||||
i = match(line, "[a-z]")
|
||||
tabs = ""
|
||||
if (i > 1) {
|
||||
n_tabs = i - 1
|
||||
tabs = ""
|
||||
while (n_tabs-- > 0) {
|
||||
tabs = tabs" "
|
||||
}
|
||||
}
|
||||
gsub("[ ]", "", line)
|
||||
if (line in css) {
|
||||
return tabs css[line] ": ;"
|
||||
}
|
||||
return tabs "?"
|
||||
}
|
||||
|
||||
{
|
||||
print cssify($0)
|
||||
}
|
||||
'
|
||||
Loading…
Add table
Add a link
Reference in a new issue