From 4e0284840d7358a311f0a55478afbca792c555d9 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jul 16 2011 20:39:31 +0000 Subject: Rename `texinfo_updateNodes.sh' to `texinfo_updateSectionNodes.sh'. --- diff --git a/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh b/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh index 59a56bb..6432be0 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh @@ -126,7 +126,7 @@ function texinfo_deleteEntry { # Update menu and node definitions from manual sections to # reflect the changes. ${FLAG_BACKEND}_updateSectionMenu "remove-entry" - ${FLAG_BACKEND}_updateNodes + ${FLAG_BACKEND}_updateSectionNodes # Update cross reference definitions from manual to reflect # the changes. diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateNodes.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateNodes.sh deleted file mode 100755 index bf631ec..0000000 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateNodes.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -# -# texinfo_updateNodes.sh -- This function updates chapter's nodes -# definition using the chapter's menu as reference. -# -# 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_updateNodes { - - # Build list of chapter nodes using entries from chapter menu as - # reference. - local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} \ - | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ - | egrep -v '^@(end )?menu$' | sed -r 's! !:!g') - - # Build chapter nodes based on chapter menu. - for NODE in $NODES;do - - NODE=$(echo "${NODE}" | sed -r 's!:! !g') - INCL=$(echo "${NODE}" | sed -r 's! !/!' | sed -r 's! !-!g' | sed -r 's!/(.+)!/\L\1!').${MANUAL_EXTENSION} - SECT=$(echo "${NODE}" | cut -d' ' -f2- ) - CIND=$(echo "${SECT}" | sed -r 's!^([[:alpha:]]+) (.+)!\u\1 \L\2!') - - # Create texinfo section file using templates, only if the - # section file doesn't exist and hasn't been marked for - # deletion. Otherwise, when the files have been marked for - # deletion, they will be created again from texinfo template - # to working copy and that might create confusion. - if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]] \ - && [[ $(cli_getRepoStatus ${MANUAL_BASEDIR}/$INCL) != 'D' ]];then - - # Define absolute path to template assignment file. This - # is the file that controls the way texinfo template files - # are applied to documentation entries once they have been - # created. - local CONFFILE="${MANUAL_TEMPLATE}/manual.conf" - - # Verify existence of configuration file. - cli_checkFiles $CONFFILE - - # Retrive configuration lines from configuration file. Be - # sure no line begining with `#' or space remain in the - # line. Otherwise, it would be difficult to loop through - # configuration lines. - local CONFLINE='' - local CONFLINES=$(cat ${CONFFILE} \ - | egrep -v '^#' \ - | egrep -v '^[[:space:]]*$' \ - | sed -r 's![[:space:]]*!!g') - - # Initialize both left hand side and right hand side - # configuration values. - local CONFLHS='' - local CONFRHS='' - - # Initialize absolute path to final texinfo template. - local TEMPLATE='' - - # Define what section template to apply using - # documentation entry absolute path and values provided by - # configuration line. Be sure to break the loop in the - # first match. - for CONFLINE in $CONFLINES;do - - CONFLHS=$(echo $CONFLINE \ - | gawk 'BEGIN{FS="="}; { print $1 }' \ - | sed -r 's![[:space:]]*!!g') - - CONFRHS=$(echo $CONFLINE \ - | gawk 'BEGIN{FS="="}; { print $2 }' \ - | sed -r 's![[:space:]]*!!g' | sed -r 's!^"(.+)"$!\1!') - - if [[ ${MANUAL_BASEDIR}/${INCL} =~ $CONFRHS ]];then - TEMPLATE="${MANUAL_TEMPLATE_L10N}/${CONFLHS}" - break - fi - - done - - # Verify existence of texinfo template file. If no - # template is found, stop script execution with an error - # message. We cannot continue without it. - cli_checkFiles $TEMPLATE - - # Create documentation entry using texinfo template as - # reference. - svn cp ${TEMPLATE} ${MANUAL_BASEDIR}/$INCL --quiet - - fi - - # Expand common translation markers in documentation entry. - cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL" - - # Replace node, section and concept index definitions already - # defined with node, section and concept index translation - # markers. Otherwise, incorrect sectioning may happen. - sed -i -r \ - -e '/@node/c@node =NODE=' \ - -e '/@section/c@section =SECT=' \ - -e '/@cindex/c@cindex =CIND=' \ - "${MANUAL_BASEDIR}/$INCL" - - # Expand noce, section and concept index translation - # markers in documentation entry. - sed -i -r \ - -e "s!=NODE=!${NODE}!g" \ - -e "s!=SECT=!${SECT}!g" \ - -e "s!=CIND=!${CIND}!g" \ - "${MANUAL_BASEDIR}/$INCL" - - # Verify existence of chapter-nodes template files. If no - # chapter-nodes template is found, stop script execution with - # an error message. We cannot continue without it. - cli_checkFiles ${MANUAL_TEMPLATE_L10N}/Chapters/chapter-nodes.${MANUAL_EXTENSION} - - # Output node information chapter-nodes template file using - # the current texinfo menu information. - cat ${MANUAL_TEMPLATE_L10N}/Chapters/chapter-nodes.${MANUAL_EXTENSION} \ - | sed -r "s!=INCL=!${INCL}!g" - - # Dump node definitions into document structure. - done > $MANUAL_CHAPTER_DIR/chapter-nodes.${MANUAL_EXTENSION} - -} diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh new file mode 100755 index 0000000..3750803 --- /dev/null +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh @@ -0,0 +1,143 @@ +#!/bin/bash +# +# texinfo_updateSectionNodes.sh -- This function updates section's +# nodes definition files using section's menu definition file both +# inside the same chapter. +# +# 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_updateSectionNodes { + + # Build list of chapter nodes using entries from chapter menu as + # reference. + local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${MANUAL_EXTENSION} \ + | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ + | egrep -v '^@(end )?menu$' | sed -r 's! !:!g') + + # Build chapter nodes based on chapter menu. + for NODE in $NODES;do + + NODE=$(echo "${NODE}" | sed -r 's!:! !g') + INCL=$(echo "${NODE}" | sed -r 's! !/!' | sed -r 's! !-!g' | sed -r 's!/(.+)!/\L\1!').${MANUAL_EXTENSION} + SECT=$(echo "${NODE}" | cut -d' ' -f2- ) + CIND=$(echo "${SECT}" | sed -r 's!^([[:alpha:]]+) (.+)!\u\1 \L\2!') + + # Create texinfo section file using templates, only if the + # section file doesn't exist and hasn't been marked for + # deletion. Otherwise, when the files have been marked for + # deletion, they will be created again from texinfo template + # to working copy and that might create confusion. + if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]] \ + && [[ $(cli_getRepoStatus ${MANUAL_BASEDIR}/$INCL) != 'D' ]];then + + # Define absolute path to template assignment file. This + # is the file that controls the way texinfo template files + # are applied to documentation entries once they have been + # created. + local CONFFILE="${MANUAL_TEMPLATE}/manual.conf" + + # Verify existence of configuration file. + cli_checkFiles $CONFFILE + + # Retrive configuration lines from configuration file. Be + # sure no line begining with `#' or space remain in the + # line. Otherwise, it would be difficult to loop through + # configuration lines. + local CONFLINE='' + local CONFLINES=$(cat ${CONFFILE} \ + | egrep -v '^#' \ + | egrep -v '^[[:space:]]*$' \ + | sed -r 's![[:space:]]*!!g') + + # Initialize both left hand side and right hand side + # configuration values. + local CONFLHS='' + local CONFRHS='' + + # Initialize absolute path to final texinfo template. + local TEMPLATE='' + + # Define what section template to apply using + # documentation entry absolute path and values provided by + # configuration line. Be sure to break the loop in the + # first match. + for CONFLINE in $CONFLINES;do + + CONFLHS=$(echo $CONFLINE \ + | gawk 'BEGIN{FS="="}; { print $1 }' \ + | sed -r 's![[:space:]]*!!g') + + CONFRHS=$(echo $CONFLINE \ + | gawk 'BEGIN{FS="="}; { print $2 }' \ + | sed -r 's![[:space:]]*!!g' | sed -r 's!^"(.+)"$!\1!') + + if [[ ${MANUAL_BASEDIR}/${INCL} =~ $CONFRHS ]];then + TEMPLATE="${MANUAL_TEMPLATE_L10N}/${CONFLHS}" + break + fi + + done + + # Verify existence of texinfo template file. If no + # template is found, stop script execution with an error + # message. We cannot continue without it. + cli_checkFiles $TEMPLATE + + # Create documentation entry using texinfo template as + # reference. + svn cp ${TEMPLATE} ${MANUAL_BASEDIR}/$INCL --quiet + + fi + + # Expand common translation markers in documentation entry. + cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL" + + # Replace node, section and concept index definitions already + # defined with node, section and concept index translation + # markers. Otherwise, incorrect sectioning may happen. + sed -i -r \ + -e '/@node/c@node =NODE=' \ + -e '/@section/c@section =SECT=' \ + -e '/@cindex/c@cindex =CIND=' \ + "${MANUAL_BASEDIR}/$INCL" + + # Expand noce, section and concept index translation + # markers in documentation entry. + sed -i -r \ + -e "s!=NODE=!${NODE}!g" \ + -e "s!=SECT=!${SECT}!g" \ + -e "s!=CIND=!${CIND}!g" \ + "${MANUAL_BASEDIR}/$INCL" + + # Verify existence of chapter-nodes template files. If no + # chapter-nodes template is found, stop script execution with + # an error message. We cannot continue without it. + cli_checkFiles ${MANUAL_TEMPLATE_L10N}/Chapters/chapter-nodes.${MANUAL_EXTENSION} + + # Output node information chapter-nodes template file using + # the current texinfo menu information. + cat ${MANUAL_TEMPLATE_L10N}/Chapters/chapter-nodes.${MANUAL_EXTENSION} \ + | sed -r "s!=INCL=!${INCL}!g" + + # Dump node definitions into document structure. + done > $MANUAL_CHAPTER_DIR/chapter-nodes.${MANUAL_EXTENSION} + +} diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh index 54347db..385b4e5 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh @@ -72,7 +72,7 @@ function texinfo_updateStructureSection { # Update menu and node definitions for sections inside manual # in order to reflect the changes. ${FLAG_BACKEND}_updateSectionMenu - ${FLAG_BACKEND}_updateNodes + ${FLAG_BACKEND}_updateSectionNodes # Resotre cross reference definitions inside manual structure. # If a documentation entry has been removed by mistake and