diff --git a/Scripts/Functions/Help/Texinfo/texinfo.sh b/Scripts/Functions/Help/Texinfo/texinfo.sh index b7b9b0c..d5726ca 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo.sh @@ -27,6 +27,17 @@ function texinfo { + # Verify documentation entry to be sure it coincides with + # Texinfo's supported structuring (e.g., texinfo-4.8 doesn't + # support structuring through parts, but chapters and sections + # only). + if [[ $MANUAL_PART_NAME != '' ]];then + cli_printMessage "The documentation entry provided isn't supported." --as-error-line + fi + + # Define file extension used by source files inside manuals. + MANUAL_EXTENSION="${MANUAL_BACKEND}" + # Initialize document structure for new manuals. ${MANUAL_BACKEND}_createStructure diff --git a/Scripts/Functions/Help/Texinfo/texinfo_copyEntry.sh b/Scripts/Functions/Help/Texinfo/texinfo_copyEntry.sh index 5f52d69..2f00d18 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_copyEntry.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_copyEntry.sh @@ -34,15 +34,15 @@ function texinfo_copyEntry { # Execute copying action based on documentation entries passed as # non-option arguments to `centos-art.sh' script in the # command-line. - if [[ ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]} != '' ]];then + if [[ ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} != '' ]];then # In this configuration, the section name is specified in # first non-option argument and optionally in the second # non-option arugment. ${MANUAL_BACKEND}_copyEntrySection - elif [[ ${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} != '' ]] \ - && [[ ${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then + elif [[ ${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]} != '' ]] \ + && [[ ${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then # In this configuration, the section name wasn't specified # neither in first or second non-option argument. So, we diff --git a/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh b/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh index 956729a..31b2f0d 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh @@ -26,10 +26,10 @@ function texinfo_copyEntryChapter { # Redefine documentation entry source's location. - MANUAL_ENTRY_SRC=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} + MANUAL_ENTRY_SRC=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]} # Redefine documentation entry target's location. - MANUAL_ENTRY_DST=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} + MANUAL_ENTRY_DST=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} # Verify entry source and target locations. ${MANUAL_BACKEND}_checkEntrySrcDst "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}" @@ -40,7 +40,7 @@ function texinfo_copyEntryChapter { # define both chapter's directory and chapter's name at this # point. local MANUAL_CHAPTER_DIR=$MANUAL_ENTRY_DST - local MANUAL_CHAPTER_NAME=${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} + local MANUAL_CHAPTER_NAME=${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} # When we are copying chapters, the chapter itself cannot be # copied as we regularly do with sections. Instead, the target diff --git a/Scripts/Functions/Help/Texinfo/texinfo_copyEntrySection.sh b/Scripts/Functions/Help/Texinfo/texinfo_copyEntrySection.sh index 338b24a..2256f4f 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_copyEntrySection.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_copyEntrySection.sh @@ -27,25 +27,25 @@ function texinfo_copyEntrySection { # Define absolute path to section source and target locations # based on non-option arguments passed to `centos-art.sh' script. - if [[ ${MANUAL_SECN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then + if [[ ${MANUAL_SECT[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then # When the section name is specified in first and second # non-option arguments, source and target are set as specified # in first and second non-option arguments respectively. - MANUAL_ENTRY_SRC=$(${MANUAL_BACKEND}_getEntry ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]}) - MANUAL_ENTRY_DST=$(${MANUAL_BACKEND}_getEntry ${MANUAL_SECN[((${MANUAL_DOCENTRY_ID} + 1))]}) + MANUAL_ENTRY_SRC=$(${MANUAL_BACKEND}_getEntry ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]}) + MANUAL_ENTRY_DST=$(${MANUAL_BACKEND}_getEntry ${MANUAL_SECT[((${MANUAL_DOCENTRY_ID} + 1))]}) - elif [[ ${MANUAL_SECN[((${MANUAL_DOCENTRY_ID} + 1))]} == '' ]] \ - && [[ ${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then + elif [[ ${MANUAL_SECT[((${MANUAL_DOCENTRY_ID} + 1))]} == '' ]] \ + && [[ ${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} != '' ]];then # When the section name is specified only in the first # non-option argument and the chapter name has been provided # in the second non-option argument, use the section name # passed in first argument to build the section name that will # be used as target. - MANUAL_ENTRY_SRC=$(${MANUAL_BACKEND}_getEntry ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]}) + MANUAL_ENTRY_SRC=$(${MANUAL_BACKEND}_getEntry ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]}) MANUAL_ENTRY_DST=$(echo $MANUAL_ENTRY_SRC \ - | sed -r "s!${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]}!") + | sed -r "s!${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]}!${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]}!") else cli_printMessage "`gettext "The location provided as target isn't valid."`" --as-error-line @@ -63,7 +63,7 @@ function texinfo_copyEntrySection { # Redefine chapter name using chapter name passed to # `centos-art.sh' script as second non-option argument. - local MANUAL_CHAPTER_NAME=${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} + local MANUAL_CHAPTER_NAME=${MANUAL_CHAP[((${MANUAL_DOCENTRY_ID} + 1))]} # Redefine chapter directory to use the chapter provided to # `centos-art.sh' script as second non-option argument. This is diff --git a/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh b/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh index e0219da..61fe3ff 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_deleteEntry.sh @@ -30,7 +30,7 @@ function texinfo_deleteEntry { # Remove manual, chapter or section based on documentation entry # provided as non-option argument to `centos-art.sh' script. - if [[ ${MANUAL_SECN[$MANUAL_DOCENTRY_ID]} != '' ]];then + if [[ ${MANUAL_SECT[$MANUAL_DOCENTRY_ID]} != '' ]];then # When a section is deleted, documentation entry points to a # section name. In this configuration, documentation entry is @@ -40,7 +40,7 @@ function texinfo_deleteEntry { # consistent state. ${MANUAL_BACKEND}_deleteEntrySection - elif [[ ${MANUAL_CHAN[$MANUAL_DOCENTRY_ID]} != '' ]];then + elif [[ ${MANUAL_CHAP[$MANUAL_DOCENTRY_ID]} != '' ]];then # When a chapter is deleted, documentation entry doesn't point # to a section name but a chapter name. In this configuration, diff --git a/Scripts/Functions/Help/Texinfo/texinfo_renameEntry.sh b/Scripts/Functions/Help/Texinfo/texinfo_renameEntry.sh index d692d61..958c780 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_renameEntry.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_renameEntry.sh @@ -34,7 +34,7 @@ function texinfo_renameEntry { # consideration the manual's main definition file, the chapter's # main definition file and non-option arguments passed to # centos-art.sh script through the command-line. - if [[ ${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]} != '' ]];then + if [[ ${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} != '' ]];then # When a section is renamed, the section source location is # duplicated into the section target location and later @@ -44,8 +44,8 @@ function texinfo_renameEntry { # manual. ${MANUAL_BACKEND}_renameEntrySection - elif [[ ${MANUAL_CHAN[$MANUAL_DOCENTRY_ID]} != '' ]] \ - && [[ ${MANUAL_CHAN[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]];then + elif [[ ${MANUAL_CHAP[$MANUAL_DOCENTRY_ID]} != '' ]] \ + && [[ ${MANUAL_CHAP[(($MANUAL_DOCENTRY_ID + 1))]} != '' ]];then # When a chapter is renamed, the chapter source location is # duplicated into the chapter source location and later diff --git a/Scripts/Functions/Help/help.sh b/Scripts/Functions/Help/help.sh index c21cb0b..06a0061 100755 --- a/Scripts/Functions/Help/help.sh +++ b/Scripts/Functions/Help/help.sh @@ -57,11 +57,12 @@ function help { # Initialize documentation entries arrays. Arrays defined here # contain all the information needed to process documentation - # entries (e.g., manual, chapter, section). + # entries (e.g., manual, part, chapter and section). local -a MANUAL_SLFN local -a MANUAL_DIRN - local -a MANUAL_CHAN - local -a MANUAL_SECN + local -a MANUAL_PART + local -a MANUAL_CHAP + local -a MANUAL_SECT # Initialize documentation entries counter. local MANUAL_DOCENTRY_COUNT=0 @@ -115,15 +116,24 @@ function help { # files in different formats (.info, .pdf, .xml, etc.). MANUAL_BASEFILE="${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}" + # Define part name. + MANUAL_PART_NAME=${MANUAL_PART[${MANUAL_DOCENTRY_ID}]} + + # Define part directory. + MANUAL_PART_DIR="${MANUAL_BASEDIR_L10N}/${MANUAL_PART_NAME}" + # Define chapter name. - MANUAL_CHAPTER_NAME=${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} + MANUAL_CHAPTER_NAME=${MANUAL_CHAP[${MANUAL_DOCENTRY_ID}]} # Define absolute path to chapter's directory. This is the - # place where chapter-specific files are stored in. - MANUAL_CHAPTER_DIR="${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}" + # place where chapter-specific files are stored in. Be sure no + # extra slash be present in the value (e.g., when the part + # name isn't provided). + MANUAL_CHAPTER_DIR="$(echo ${MANUAL_PART_DIR}/${MANUAL_CHAPTER_NAME} \ + | sed -r 's!/{2,}!/!g' )" # Define section name. - MANUAL_SECTION_NAME=${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]} + MANUAL_SECTION_NAME=${MANUAL_SECT[${MANUAL_DOCENTRY_ID}]} # Define absolute path to manual's configuration file. This # is the file that controls the way template files are applied @@ -162,9 +172,6 @@ function help { fi - # Define file extension used by source files inside manuals. - MANUAL_EXTENSION="${MANUAL_BACKEND}" - # Define absolute path to template directory. This is the # place where we store locale directories (e.g., en_US, es_ES, # etc.) used to build manuals in texinfo format. diff --git a/Scripts/Functions/Help/help_getEntries.sh b/Scripts/Functions/Help/help_getEntries.sh index 9ef14c3..aee3f3a 100755 --- a/Scripts/Functions/Help/help_getEntries.sh +++ b/Scripts/Functions/Help/help_getEntries.sh @@ -51,16 +51,17 @@ function help_getEntries { # variables in order to describe their parts (e.g., manual # name, chapter name and section name) that way. # Documentation entries passed as non-opiton arguments must be - # written either in `MANUAL:CHAPTER:SECTION' or `path/to/dir' - # formats in order to be processed correctly here. Empty - # spaces are not permitted. To separate words, use the minus - # sign (e.g., hello-world) or cammel case (e.g., HelloWorld). + # written either in `MANUAL:PART:CHAPTER:SECTION' or + # `path/to/dir' formats in order to be processed correctly + # here. Empty spaces are not permitted. To separate words, use + # the minus sign (e.g., hello-world) or cammel case (e.g., + # HelloWorld). for DOCENTRY in $@;do - if [[ $DOCENTRY =~ '^([A-Za-z0-9-]+)(:[A-Za-z0-9-]+){0,2}$' ]];then + if [[ $DOCENTRY =~ '^([A-Za-z0-9-]+)(:[A-Za-z0-9-]*){0,3}$' ]];then - # When `MANUAL:CHAPTER:SECTION' is used as format to - # documentation entry, you can specify the manual, + # When `MANUAL:PART:CHAPTER:SECTION' is used as format + # to documentation entry, you can specify the manual, # chapter and section where documentation actions will # take place on. @@ -73,13 +74,17 @@ function help_getEntries { MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ $(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $1 }') -d ) - # Manual chapter name. - MANUAL_CHAN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + # Manual part name. + MANUAL_PART[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ $(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $2 }') -d ) + # Manual chapter name. + MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $3 }') -d ) + # Manual section name. - MANUAL_SECN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ - $(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $3 }') -f ) + MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + $(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $4 }') -f ) elif [[ $DOCENTRY =~ '^(trunk|branches|tags)' ]];then @@ -97,11 +102,11 @@ function help_getEntries { MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]='Tcar-fs' # Manual chapter name. - MANUAL_CHAN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + MANUAL_CHAP[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ $(echo "$DOCENTRY" | gawk 'BEGIN { FS="/" }; { if ( NF >= 1 ) print $1 }' ) -d ) # Manual section name. - MANUAL_SECN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ + MANUAL_SECT[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \ $(echo "$DOCENTRY" | gawk 'BEGIN { FS="/" }; { if ( NF >= 2 ) print $0 }' \ | cut -d/ -f2- | tr '/' '-') -f )