Scripts for working with CSS
This commit is contained in:
parent
46f6d59d2d
commit
60f1729086
3 changed files with 42 additions and 0 deletions
|
|
@ -75,6 +75,7 @@ Who is who in **bin** directory:
|
||||||
- `b` create an indented C-like block `{ ... }`
|
- `b` create an indented C-like block `{ ... }`
|
||||||
- `c SYMBOL`/`uc SYMBOL` comment/uncomment selection
|
- `c SYMBOL`/`uc SYMBOL` comment/uncomment selection
|
||||||
- `commit MESSAGE` commit and push to master
|
- `commit MESSAGE` commit and push to master
|
||||||
|
- `css` and `cssify` transform abbreviations into CSS properties
|
||||||
- `f TEXT` find TEXT using The Silver Searcher
|
- `f TEXT` find TEXT using The Silver Searcher
|
||||||
- `hd SYMBOL` draw a pretty heading
|
- `hd SYMBOL` draw a pretty heading
|
||||||
- `htm` feed selection to [Pug](https://github.com/pugjs/pug)
|
- `htm` feed selection to [Pug](https://github.com/pugjs/pug)
|
||||||
|
|
|
||||||
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