diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh index af1fcaf..9516e27 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh @@ -27,20 +27,41 @@ function texinfo_updateStructureSection { + # Print separator line. + cli_printMessage "-" --as-separator-line + local PATTERN='' local MANUAL_ENTRY='' local MANUAL_ENTRIES='' local ACTIONNAM_SECMENU='' local ACTIONNAM_CROSREF='' - # Define find's regular expression pattern. + # Define regular expression pattern used to build the list of + # section entries that will be processed. if [[ "$1" != '' ]];then + + # Define pattern from first position parameter. PATTERN="$1" + + # Verify the pattern value considering both the chapter and + # section names. This is required when no chapter or section + # name is provided to `centos-art.sh' script, as non-option + # argument in the command-line (e.g., `centos-art help + # --update-structure'). + if [[ $PATTERN =~ "${MANUAL_NAME}\.${MANUAL_EXTENSION}$" ]] \ + || [[ $PATTERN =~ "chapter\.${MANUAL_EXTENSION}$" ]];then + PATTERN="$(dirname ${MANUAL_ENTRY})/.+\.${MANUAL_EXTENSION}" + fi + else + + # Define pattern default value. PATTERN=".+\.${MANUAL_EXTENSION}" + fi - # Define action to perform on definitions. + # Define action to perform on menu, nodes and cross references + # definitions. case "$2" in --delete ) @@ -86,7 +107,7 @@ function texinfo_updateStructureSection { # definitions (i.e., all those section definition file that match # the pattern you specified). MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ - --pattern="$PATTERN" | egrep -v "/(${MANUAL_NAME}|chapter)") + --pattern="${PATTERN}" | egrep -v "/(${MANUAL_NAME}|chapter)") # Verify list of target entries. Assuming is is empty, define # list of target documentation entries using pattern as reference @@ -100,22 +121,36 @@ function texinfo_updateStructureSection { # the absolute path to that documentation entry which doesn't # exist and we want to update menu, nodes and cross references # information for. - if [[ $MANUAL_ENTRIES == '' ]];then - MANUAL_ENTRIES=$PATTERN + if [[ $MANUAL_ENTRIES == '' ]] && [[ $PATTERN =~ '^[[:alnum:]-./]+$' ]];then + MANUAL_ENTRIES=${PATTERN} fi - # Print action message. - cli_printMessage "`gettext "Updating section menus, nodes and cross references."`" --as-response-line + # Verify list of target entries. Assumming it is empty, there is + # nothing else to do here but print an error message describing + # the fact that no entry was found to process. + if [[ $MANUAL_ENTRIES == '' ]];then + cli_printMessage "`gettext "No section entry found to process."`" --as-error-line + fi # Loop through target documentation entries in order to update # the documentation structure (e.g., It is not enough with copying # documentation entry files, it is also needed to update menu, # nodes and related cross-references). for MANUAL_ENTRY in ${MANUAL_ENTRIES};do + + # Print action message. These actions might consume some time + # to finish. The more section entries the pattern defined + # matches, the more time it takes to finish. To avoid boring + # you waiting something to happen out to the screen, the + # action message is printed for each section entry processed. + cli_printMessage "$MANUAL_ENTRY" --as-updating-line + + # Execute actualization of section structure. ${FLAG_BACKEND}_${ACTIONNAM_SECMENU} ${FLAG_BACKEND}_updateSectionNodes - ${FLAG_BACKEND}_makeSeeAlso "$MANUAL_ENTRY" + ${FLAG_BACKEND}_makeSeeAlso "${MANUAL_ENTRY}" ${FLAG_BACKEND}_${ACTIONNAM_CROSREF} ${MANUAL_ENTRY} + done }