if display_entry ; then
setopt noglob
if [ -n "$LINE" ] ; then
+ LINE=$(echo "$LINE" | sed 's#\([^\]\)/\([[:alnum:]_-]*\)/#\1${HIGHLIGHT_NAME}\2${NORMAL}#g')
+ LINE=$(echo "$LINE" | sed 's#\([^\]\)^\([[:alnum:]]\)#\1${HIGHLIGHT}\2${NORMAL}#g')
+ LINE=$(echo "$LINE" | sed 's#\\\([^/]\)#\1#g')
info+="$(eval $LINE)"
fi
.TP
.B Example
print_line "Configure ${HIGHLIGHT}n${NORMAL}etwork"
+
+.SS Shortcuts
+As highlighting the name as well as the keyboard shortcuts is common
+in a menu entry there are two shortcuts for highlighting.
+.SS Highlight a single character
+To highlight a single character, for example the shortcut, use
+.B ^
+and the next character will be highlighted. If you want to just write ^ escape the
+character with a backslash.
+ print_line "Configure ^network \\^ is nice"
+.SS Highlight a word
+To highlight a range, for example the command, use
+.B /word/
+and the text between / wll be highlighted. If you want to just write / escape the
+character with a backslash.
+ print_line "Configure ^network (/grml-network/)"
.SS MUST Provide
.TP
.B display_entry
.RS
.B \ Example
# print Configure network (grml-network)
- LINE='print_line "Configure ${HIGHLIGHT}n${NORMAL}etwork (${HIGHLIGHT_NAME}grml-network${NORMAL})"'
+ LINE='print_line "Configure ^network (/grml-network/)"'
.RE 1
.SS Optional entries
The following variables are optional and can be defined in a script but do not have to.
.SS Complete Example
# language module for grml-quickconfig
- LINE='print_line "Set keyboard layout (${HIGHLIGHT_NAME}grml-lang${NORMAL}): \\
- ${HIGHLIGHT}d${NORMAL}e ${HIGHLIGHT}a${NORMAL}t ${HIGHLIGHT}c${NORMAL}h e${HIGHLIGHT}s${NORMAL} ${HIGHLIGHT}u${NORMAL}s"'
+ LINE='print_line "Set keyboard layout (/grml-lang/): ^de ^at ^ch e^s ^us"'
typeset -A lang_mapping
# print the heading
LINE='print_line "Welcome to grml-quickconfig";
print_line "Press a highlighted key to perform an action, or press";
-print_line "${HIGHLIGHT}Return${NORMAL} or ${HIGHLIGHT}q${NORMAL} to go back to the shell.";
+print_line "/Return/ or ^q to go back to the shell.";
print_delim;
'
# language module for grml-quickconfig
-LINE='print_line "Set keyboard layout (${HIGHLIGHT_NAME}grml-lang${NORMAL}): \
-${HIGHLIGHT}d${NORMAL}e ${HIGHLIGHT}a${NORMAL}t ${HIGHLIGHT}c${NORMAL}h e${HIGHLIGHT}s${NORMAL} ${HIGHLIGHT}u${NORMAL}s"'
+LINE='print_line "Set keyboard layout (/grml-lang/): ^de ^at ^ch e^s ^us"'
typeset -A lang_mapping
# grml-network module for grml-quickconfig
-LINE='print_line "Configure ${HIGHLIGHT}n${NORMAL}etwork (${HIGHLIGHT_NAME}grml-network${NORMAL})"'
+LINE='print_line "Configure ^network (/grml-network/)"'
KEY=(n)
FUNCTION='run grml-network'
# netcardconfig module for grml-quickconfig
-LINE='print_line "-> Configure ${HIGHLIGHT}e${NORMAL}thernet card directly (${HIGHLIGHT_NAME}netcardconfig${NORMAL})"'
+LINE='print_line "-> Configure ^ethernet card directly (/netcardconfig/)"'
KEY=(e)
FUNCTION='run netcardconfig'
# grml-info module for grml-quickconfig
-LINE='print_line "Show ${HIGHLIGHT}i${NORMAL}nformation about grml (${HIGHLIGHT_NAME}grml-info${NORMAL})"'
+LINE='print_line "Show ^information about grml (/grml-info/)"'
KEY=(i)
FUNCTION="run grml-info"
# window manager module for grml-quickconfig
-LINE='print_line "Start ${HIGHLIGHT}x${NORMAL} (${HIGHLIGHT_NAME}grml-x${NORMAL})"'
+LINE='print_line "Start ^x (/grml-x/)"'
KEY=(x)
FUNCTION='wm_menu'
# application menu module for grml-quickconfig
-LINE='print_line "Show an application ${HIGHLIGHT}m${NORMAL}enu (${HIGHLIGHT_NAME}pdmenu${NORMAL})"'
+LINE='print_line "Show an application ^menu (/pdmenu/)"'
KEY=(m)
MENU_PROGNAME=pdmenu
FUNCTION="run $MENU_PROGNAME"
-LINE='print_line "Install Debian to ${HIGHLIGHT}h${NORMAL}ard disk (${HIGHLIGHT_NAME}grml-debootstrap${NORMAL})"'
+LINE='print_line "Install Debian to ^hard disk (/grml-debootstrap/)"'
KEY=(h)
HD_APP=grml-debootstrap
FUNCTION="run $HD_APP"