From 40d851f42fad2d26414df39e680c5ce52f2d71a9 Mon Sep 17 00:00:00 2001 From: Paweł Zuzelski Date: Mon, 29 Mar 2010 12:21:56 +0200 Subject: 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. --- examples/data/scripts/formfiller.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'examples/data/scripts/formfiller.sh') 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):<}%/' | \ -- cgit v1.2.3