3 # Generate the keymap-actions.txt and keymap-defaults.txt for elinkskeys(5)
6 # Copyright (c) Jonas Fonseca <fonseca@diku.dk>, 2005-2006
10 CONFIGDIR
=$
(dirname "$KBDBIND")
13 test -d "$CONFIGDIR" ||
exit
18 echo "$1" |
tr 'a-z' 'A-Z'
19 echo "$1" |
sed 's/[^~]/~/g'
23 print_keymap_actions
()
27 print_title
"$keymap ACTIONS"
29 echo 'ifdef::backend-xhtml11[]'
30 echo '`----------------------------------`----------------------------------------------------------------------------'
31 echo 'Action Description'
32 echo '----------------------------------------------------------------------------------------------------------------'
33 # open-link-in-new-tab-in-background
34 echo 'endif::backend-xhtml11[]'
36 grep ACTION_
"$CONFIGDIR/actions-$keymap.inc" \
39 action
=$
(echo "$entry" |
sed 's/ACTION_([^,]*, "\([^"]*\)".*/\1/')
40 caption
=$
(echo "$entry" |
sed 's/.*N__("\(.*\)").*/\1/')
42 [ "$action" = "none" ] && continue
43 [ "$action" = " *scripting-function*" ] && continue
45 echo 'ifdef::backend-docbook[]'
49 echo 'endif::backend-docbook[]'
50 echo 'ifdef::backend-xhtml11[]'
51 printf "%-34s %s\n" "$action" "$caption"
52 echo 'endif::backend-xhtml11[]'
55 echo 'ifdef::backend-xhtml11[]'
56 echo '---------------------------------------------------------------------------------------------------------------'
57 echo 'endif::backend-xhtml11[]'
60 print_keymap_defaults
()
63 KEYMAP
=$
(echo $1 |
tr '[a-z]' '[A-Z]')
65 print_title
"$keymap KEYS"
67 echo 'ifdef::backend-xhtml11[]'
68 echo '`-----------`-------------------------------------------------------------------------------'
69 echo 'Key Description (Action)'
70 echo '--------------------------------------------------------------------------------------------'
72 echo 'endif::backend-xhtml11[]'
74 grep ACT_
$KEYMAP $KBDBIND |
grep '^[[:space:]]{' |
grep -v '{ "' \
77 entry
=$
(echo "$entry" |
sed 's/.*{ { //')
78 key
=$
(echo "$entry" |
sed "s/\(KBD_[^,]*\|'.*'\),.*/\1/")
79 action
=$
(echo "$entry" |
sed "s/.*,.*\(ACT_$KEYMAP\)_\([A-Z_]*\).*/\2/")
80 # If there are backslashed quotes, remove the backslashes.
81 # (This is not needed in print_keymap_actions because
82 # there the "read" command consumes the backslashes.)
83 action
=$
(grep " $action," "$CONFIGDIR/actions-$keymap.inc" \
84 |
sed "s/.*\"\([^\"]*\)\".*N__(\"\(.*\)\").*/\2 ('\1')/;s/\\\\\"/\"/g")
89 key
=$
(grep $key $KBDBIND \
90 |
grep '^[[:space:]]{ "' \
91 |
sed 's/.*"\([^"]*\)".*/\1/')
97 key
=$
(echo "$key" |
sed "s/^'\(.*\)'$/\1/" \
98 |
sed "s/'/{squote}/")
104 *KBD_MOD_ALT
*) modifier
="Alt-" ;;
105 *KBD_MOD_CTRL
*) modifier
="Ctrl-" ;;
106 *KBD_MOD_SHIFT
*) modifier
="Shift-" ;;
110 echo 'ifdef::backend-docbook[]'
111 echo "'$modifier$q$key$q'::"
114 echo 'endif::backend-docbook[]'
115 echo 'ifdef::backend-xhtml11[]'
116 printf "%-11s %s\n" "$modifier$key" "$action"
117 echo 'endif::backend-xhtml11[]'
120 echo 'ifdef::backend-xhtml11[]'
121 echo '--------------------------------------------------------------------------------------------'
122 echo 'endif::backend-xhtml11[]'
129 *default
*) print_keymap_doc
="print_keymap_defaults" ;;
130 *action
*) print_keymap_doc
="print_keymap_actions" ;;
133 $print_keymap_doc main
134 $print_keymap_doc edit
135 $print_keymap_doc menu