diff --git a/Scripts/Functions/Help/Texinfo/texinfo_createChapter.sh b/Scripts/Functions/Help/Texinfo/texinfo_createChapter.sh index 8f88f78..f0b5645 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_createChapter.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_createChapter.sh @@ -38,16 +38,26 @@ function texinfo_createChapter { cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line fi - # Initialize chapter information (e.g., title). + local MANUAL_CHAPTER_NODE='' local MANUAL_CHAPTER_TITLE='' + local MANUAL_CHAPTER_CIND='' - # Retrive manual's information from standard input. - cli_printMessage "`gettext "Enter chapter's title"`" --as-request-line + # Define chapter title asking user for it. + cli_printMessage "`gettext "Chapter Title"`" --as-request-line read MANUAL_CHAPTER_TITLE + # Define chapter node using chapter name as reference. + MANUAL_CHAPTER_NODE=$(${FLAG_BACKEND}_getEntryNode "$MANUAL_CHAPTER_NAME") + + # Define chapter title based value entered and the style provided. + MANUAL_CHAPTER_TITLE=$(${FLAG_BACKEND}_getEntryTitle "$MANUAL_CHAPTER_TITLE") + + # Define chapter concept index using chapter node as reference. + MANUAL_CHAPTER_CINDX=$(${FLAG_BACKEND}_getEntryIndex "$MANUAL_CHAPTER_NODE") + # Print action message. cli_printMessage "-" --as-separator-line - cli_printMessage "`gettext "Creating chapter's files."`" --as-response-line + cli_printMessage "`gettext "Creating chapter files."`" --as-response-line # Define list of template files used to build chapter's main # definition files. @@ -82,8 +92,10 @@ function texinfo_createChapter { # fail. sed -i -r \ -e 's/ \// \\\//g' \ - -e "s/=CHAPTER_NAME=/${MANUAL_CHAPTER_NAME}/" \ + -e "s/=CHAPTER_NODE=/${MANUAL_CHAPTER_NODE}/" \ -e "s/=CHAPTER_TITLE=/${MANUAL_CHAPTER_TITLE}/" \ + -e "s/=CHAPTER_CIND=/${MANUAL_CHAPTER_CIND}/" \ + -e "s/=CHAPTER_NAME=/${MANUAL_CHAPTER_NAME}/" \ ${MANUAL_CHAPTER_DIR}/chapter.${MANUAL_EXTENSION} # Remove content from `chapter-nodes.texinfo' file to start with a diff --git a/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh b/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh index 6bfb96e..839e2bd 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh @@ -42,7 +42,7 @@ function texinfo_deleteCrossReferences { fi # Build the node string using entry location. - local NODE="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY")" + local NODE="$(${FLAG_BACKEND}_getEntryNode "$MANUAL_ENTRY")" # Define regular expression patterns for texinfo cross reference # commands. diff --git a/Scripts/Functions/Help/Texinfo/texinfo_getEntryNode.sh b/Scripts/Functions/Help/Texinfo/texinfo_getEntryNode.sh new file mode 100755 index 0000000..6b0ff2e --- /dev/null +++ b/Scripts/Functions/Help/Texinfo/texinfo_getEntryNode.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# texinfo_getEntryNode.sh -- This function cleans up the action value +# (ACTIONVAL) directory to make a node name from it. +# +# 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_getEntryNode { + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Define node from documentation entry. + local NODE=$(echo "$MANUAL_ENTRY" | sed -r \ + -e "s!^${MANUAL_BASEDIR_L10N}/!!" \ + -e "s/\.${MANUAL_EXTENSION}$//" \ + -e "s/chapter//" \ + -e 's!(/|-)! !g' \ + -e 's!\<([[:alpha:]])\>!\u\1!g' \ + -e 's!^[[:space:]]+!!') + + echo "$NODE" + +} + diff --git a/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh b/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh deleted file mode 100755 index b5f0a6f..0000000 --- a/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# -# texinfo_getNode.sh -- This function cleans up the action value -# (ACTIONVAL) directory to make a node name from it. -# -# 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_getNode { - - # Define documentation entry. - local MANUAL_ENTRY="$1" - - # Verify documentation entry. - if [[ $MANUAL_ENTRY == '' ]];then - cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line - fi - - # Define node from documentation entry. - local NODE=$(echo "$MANUAL_ENTRY" | sed -r \ - -e "s!^${MANUAL_BASEDIR_L10N}/!!" \ - -e "s/\.${MANUAL_EXTENSION}$//" \ - -e "s/chapter//" \ - -e 's!(/|-)! !g' \ - -e 's!\<([[:alpha:]])\>!\u\1!g' \ - -e 's!^[[:space:]]+!!') - - echo "$NODE" - -} - diff --git a/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh b/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh index d43fd01..f4ea6a6 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh @@ -30,8 +30,8 @@ function texinfo_renameCrossReferences { local -a REPLACE # Build source and target node definitions. - local NODE_SRC="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_SRC")" - local NODE_DST="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_DST")" + local NODE_SRC="$(${FLAG_BACKEND}_getEntryNode "$MANUAL_ENTRY_SRC")" + local NODE_DST="$(${FLAG_BACKEND}_getEntryNode "$MANUAL_ENTRY_DST")" # Define regular expression pattern and its replacement for node # definitions that have been previously removed. diff --git a/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh b/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh index 2ba3885..367ffb4 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh @@ -46,7 +46,7 @@ function texinfo_restoreCrossReferences { fi # Build the node string using entry location. - local NODE="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY")" + local NODE="$(${FLAG_BACKEND}_getEntryNode "$MANUAL_ENTRY")" # Define regular expression patterns to match removed message # format produced by message_removeCrossReferences function. diff --git a/Scripts/Functions/Help/Texinfo/texinfo_searchNode.sh b/Scripts/Functions/Help/Texinfo/texinfo_searchNode.sh index 2bb3259..000c528 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_searchNode.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_searchNode.sh @@ -43,6 +43,6 @@ function texinfo_searchNode { cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line # Use info reader to present manual's info output. - info --node="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY")" --file=${MANUAL_BASEFILE}.info.bz2 + info --node="$(${FLAG_BACKEND}_getEntryNode "$MANUAL_ENTRY")" --file=${MANUAL_BASEFILE}.info.bz2 } diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh index 17caafe..a65c2c3 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionMenu.sh @@ -36,7 +36,7 @@ function texinfo_updateSectionMenu { local ACTION="$1" # Build node information used inside chapter menu. - local MENUNODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") + local MENUNODE=$(${FLAG_BACKEND}_getEntryNode "$MANUAL_ENTRY") # Define menu entry using texinfo style and node information as # reference.