diff --git a/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh b/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh index 53e11a2..59a56bb 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh @@ -125,7 +125,7 @@ function texinfo_deleteEntry { # Update menu and node definitions from manual sections to # reflect the changes. - ${FLAG_BACKEND}_updateMenu "remove-entry" + ${FLAG_BACKEND}_updateSectionMenu "remove-entry" ${FLAG_BACKEND}_updateNodes # Update cross reference definitions from manual to reflect diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateMenu.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateMenu.sh deleted file mode 100755 index c2add7f..0000000 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateMenu.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# -# texinfo_updateMenu.sh -- This function updates chapter's menu -# definition file. If this function is called with the 'remove-entry' -# string as first argument, the menu line related to the entry being -# processed is removed. Otherwise, if this function is called with the -# 'update-entry' string as first argument, the menu line related to -# the entry being processed is added to menu's bottom. If no argument -# is passed to this function, the 'update-entry' action is assumed. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function texinfo_updateMenu { - - # Specify which action to do with documentation entry inside the - # chapter menu. - local ACTION="$1" - - # Build node information used inside chapter menu. - local MENUNODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") - - # Define menu entry using texinfo style and node information as - # reference. - local MENULINE="* ${MANUAL_CHAPTER_NAME} ${MENUNODE}::" - - # Retrive list of menu entries from chapter menu and exclude - # `@menu', `@end menu' and empty lines from output. - local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} \ - | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') - - # Re-defined chapter menu entries based on action provided to this - # function as first positional parameter. - case $ACTION in - - 'remove-entry' ) - # Remove menu entry from chapter menu. - MENU=$(echo "$MENU" | egrep -v "$MENULINE") - ;; - - 'update-entry' | * ) - # Add menu entry to chapter menu list as last entry. - MENU="$MENU - $MENULINE" - ;; - - esac - - # Remove empty lines from chapter menu entries. Don't order - # alphabetically. That would suppress the idea of putting the - # last entry added as last entry in the chapter menu entries. - MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$') - - # Rebuild list of chapter menu entries including '@menu' and '@end - # menu' lines back into chapter menu. - MENU="@menu - $MENU - @end menu" - - # Remove opening spaces/tabs from final menu structure. - MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') - - # Dump chapter menu entries back into chapter's menu definition - # file. - echo "$MENU" > $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} - -} diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh new file mode 100755 index 0000000..cacdfaf --- /dev/null +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# texinfo_updateSectionMenu.sh -- This function updates the section's +# menu definition file of a chapter. If this function is called with +# the 'remove-entry' string as first argument, the menu line related +# to the entry being processed is removed. Otherwise, if this function +# is called with the 'update-entry' string as first argument, the menu +# line related to the entry being processed is added to menu's bottom. +# If no argument is passed to this function, the 'update-entry' action +# is assumed. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function texinfo_updateSectionMenu { + + # Specify which action to do with documentation entry inside the + # chapter menu. + local ACTION="$1" + + # Build node information used inside chapter menu. + local MENUNODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") + + # Define menu entry using texinfo style and node information as + # reference. + local MENULINE="* ${MANUAL_CHAPTER_NAME} ${MENUNODE}::" + + # Retrive list of menu entries from chapter menu and exclude + # `@menu', `@end menu' and empty lines from output. + local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} \ + | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') + + # Re-defined chapter menu entries based on action provided to this + # function as first positional parameter. + case $ACTION in + + 'remove-entry' ) + # Remove menu entry from chapter menu. + MENU=$(echo "$MENU" | egrep -v "$MENULINE") + ;; + + 'update-entry' | * ) + # Add menu entry to chapter menu list as last entry. + MENU="$MENU + $MENULINE" + ;; + + esac + + # Remove empty lines from chapter menu entries. Don't order + # alphabetically. That would suppress the idea of putting the + # last entry added as last entry in the chapter menu entries. + MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$') + + # Rebuild list of chapter menu entries including '@menu' and '@end + # menu' lines back into chapter menu. + MENU="@menu + $MENU + @end menu" + + # Remove opening spaces/tabs from final menu structure. + MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') + + # Dump chapter menu entries back into chapter's menu definition + # file. + echo "$MENU" > $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} + +} diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh index e2c853e..54347db 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh @@ -71,7 +71,7 @@ function texinfo_updateStructureSection { # Update menu and node definitions for sections inside manual # in order to reflect the changes. - ${FLAG_BACKEND}_updateMenu + ${FLAG_BACKEND}_updateSectionMenu ${FLAG_BACKEND}_updateNodes # Resotre cross reference definitions inside manual structure.