diff options
author | Paweł Zuzelski <pawelz@pld-linux.org> | 2010-03-29 12:21:56 +0200 |
---|---|---|
committer | Paweł Zuzelski <pawelz@pld-linux.org> | 2010-03-29 12:21:56 +0200 |
commit | 40d851f42fad2d26414df39e680c5ce52f2d71a9 (patch) | |
tree | 112e725102adfe6eda0ead2841cd23638bf58be2 /examples/data/scripts | |
parent | b9b1422173211d50edb273f93fe3fcc025646dc6 (diff) |
remove comments, add modeline
Treat lines begining with '>' as comments. '>' not '#', because '>' is not a
valid character in XML tags/argument names.
Add modeline to generated file. May be useful to autoload syntax file.
Diffstat (limited to 'examples/data/scripts')
-rwxr-xr-x | examples/data/scripts/formfiller.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 9bac495..86bb3bf 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -27,6 +27,8 @@ # or leave it blank, even without spaces # otherwise it will be considered as checked # +# All lines starting with '>' are ignored as comments +# # user arg 1: # edit: force editing the file (falls back to new if not found) # new: start with a new file. @@ -51,6 +53,7 @@ else fi PROMPT="Choose profile" +MODELINE="> vim:ft=formfiller" keydir=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/dforms @@ -181,10 +184,13 @@ then printf 'js %s dump(); \n' "$dumpFunction" | \ socat - unix-connect:$socket | \ sed -n '/^[^(]\+([^)]\+):/p' > $tmpfile + echo "$MODELINE" >> $tmpfile ${editor} $tmpfile [ -e $tmpfile ] || exit 2 + # Remove comments + sed '/^>/d' -i $tmpfile sed 's/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):\(off\|no\|false\|unchecked\|0\|$\)/\1{\2}(\3):0/I;s/^\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[^0]\+/\1{\2}(\3):1/I' -i $tmpfile fields=`cat $tmpfile | \ sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|textarea\|password\)):/%{>\1\2):<}%/' | \ |