4 # Script used to generate doc/book/config/cmdoptions.xml
5 # and hopefully other in the future.
7 # Updated by option handlind via --elinks=path/to/elinks option
11 # Option handling {{{1
17 filter
="sed 0,/^Options:/d"
21 filter
="sed 0,/^Configuration/d"
26 print_description_line
()
36 line
="$(echo $line | sed 's,\(-touch-files\|-no-connect\|-session-ring\|-dump\|-default-mime-type\|text/html\|~/\.elinks\),\`\1\`,g')"
37 line
=$
(echo $line |
sed "s,'\([^']*\)',\\\'\1\\\',")
38 line
=$
(echo $line |
sed "s,ELinks,'ELinks',g")
39 line
=$
(echo $line |
sed "s,HOME,'HOME',g")
40 line
="$(echo $line | sed 's/^\([a-zA-Z]*([^)]*)\).*:/- \`\1\`:/')"
63 if test -n "$typeid" && test "$typeid" != "$path";
65 if test "$typeid" = "(alias";
67 typestring
="$typestring ($default)"
70 typestring
="$typestring $typeid"
73 if test -n "$default" && test "$default" != "$path";
75 typestring
="$typestring ($default)"
77 if test "$default" = "-?, -h, -help";
93 "$elinks" $option |
$filter |
while read line
95 if test -n "$parse_description"
97 # If the line is empty it is our clue that
98 # the desciption is over.
107 line
=`echo "$line" | sed -e "s/[ ]*(DISABLED)//"`
108 line
=`echo "$line" | sed 's/\([{}]\)/\\\\\1/g'`
110 if test -n "$parse_int_option";
114 number
="`echo $line | sed -e 's/\(-[0-9-]*\).*/\1/'`"
115 line
=`echo "$line" | sed -e "s/$number[ ]*//"`
119 number
="`echo $line | sed -e 's/\([0-9-]*\).*/\1/'`"
120 line
=`echo "$line" | sed -e "s/$number[ ]*//"`
125 print_description_line
"$line" "$number"
134 title
="`echo $line | sed -e 's/\([A-Z]*\):.*/\1/'`"
135 path
="`echo $line | sed -e 's/.*: (\([a-z_].*\))/\1/'`"
136 print_option_tree
"$title" "$path"
141 path
="$(echo "$line" | sed -e 's/\([a-z-][^ ]*\).*/\1/')"
142 typeid
="$(echo "$line" | sed -n 's/[ ]*[a-z-][^ ]* \([^ ]*\).*/\1/p')"
143 default
="$(echo "$line" | sed -n 's/.*[^(]*(\(.*\))/\1/p')"
144 print_option_type
"$path" "$typeid" "$default"
145 if test "$typeid" = "<num>";
156 version
="`$elinks -version | head -n 1 | sed -e 's/ELinks \([0-9][^ ]*\).*/\1/'`"
157 echo "Generated using output from ELinks version $version."
160 # vim: tabstop=4 shiftwidth=4