diff --git a/Scripts/Functions/Help/Texinfo/texinfo.sh b/Scripts/Functions/Help/Texinfo/texinfo.sh index 2982c29..1ee6930 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo.sh @@ -30,15 +30,6 @@ function texinfo { # Define file extension used by source files inside manuals. MANUAL_EXTENSION='texinfo' - # Define absolute path to directory holding language-specific - # texinfo source files. - MANUAL_BASEDIR="${MANUAL_TLDIR}/${MANUAL_L10N}" - - # Define absolute path to base file. This is the main file name - # (without extension) we use as reference to build output files in - # different formats (.info, .pdf, .xml, etc.). - MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}" - # Verify existence of action names. When no action name is # provided to centos-art.sh script, read manual's output in info # format in order to provide a way for people to get oriented @@ -61,7 +52,7 @@ function texinfo { # Define absolute path to chapter's directory. This is the place # where chapter-specific files are stored in. - MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR}/$(cli_getRepoName \ + MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR_L10N}/$(cli_getRepoName \ "${MANUAL_CHAPTER_NAME}" -d | tr -d ' ' | sed -r 's!/$!!') # Define absolute path to template directory. This is the place @@ -141,7 +132,7 @@ function texinfo { # and define documentation entry based on chapter's main # definition file. - MANUAL_ENTRY="${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME}/chapter.${MANUAL_EXTENSION}" + MANUAL_ENTRY="${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}/chapter.${MANUAL_EXTENSION}" elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME != '' ]];then diff --git a/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh b/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh index 4a1ac28..a763d8f 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_copyEntryChapter.sh @@ -26,14 +26,14 @@ function texinfo_copyEntryChapter { # Define documentation entry source's location. - local MANUAL_ENTRY_SRC=${MANUAL_BASEDIR}/${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} + local MANUAL_ENTRY_SRC=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} # 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))]} # Define documentation entry target's location. - local MANUAL_ENTRY_DST=${MANUAL_BASEDIR}/${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} + local MANUAL_ENTRY_DST=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAN[((${MANUAL_DOCENTRY_ID} + 1))]} # When we are copying chapters, the source location and the target # location must be different in value. They cannot point to the diff --git a/Scripts/Functions/Help/Texinfo/texinfo_copyEntryManual.sh b/Scripts/Functions/Help/Texinfo/texinfo_copyEntryManual.sh index cb77a23..c0e3cff 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_copyEntryManual.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_copyEntryManual.sh @@ -38,16 +38,16 @@ function texinfo_copyEntryManual { # Redefine absolute path to manual directory using manual name # passed to `centos-art.sh' script as second non-option argument. - MANUAL_TLDIR="$(echo $MANUAL_TLDIR \ + MANUAL_BASEDIR="$(echo $MANUAL_BASEDIR \ | sed -r "s!${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}!${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} + 1))]}!")" # Redefine absolute path to manual directory using manual name # passed to `centos-art.sh' script as second non-option argument. - MANUAL_BASEDIR="${MANUAL_TLDIR}/${MANUAL_L10N}" + MANUAL_BASEDIR_L10N="${MANUAL_BASEDIR}/${MANUAL_L10N}" # Redefine absolute path to base file using manual name passed to # `centos-art.sh' script as second non-option argument. - MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}" + MANUAL_BASEFILE="${MANUAL_BASEDIR_L10}/${MANUAL_NAME}" # Create manual structure ${FLAG_BACKEND}_createStructure @@ -60,7 +60,7 @@ function texinfo_copyEntryManual { # Copy chapter directory from source to target using # subversion. - svn cp ${MANUAL_CHAPTER} ${MANUAL_BASEDIR} --quiet + svn cp ${MANUAL_CHAPTER} ${MANUAL_BASEDIR_L10N} --quiet # Define manual chapter name. local MANUAL_CHAPTER_NAME=$(basename ${MANUAL_CHAPTER}) diff --git a/Scripts/Functions/Help/Texinfo/texinfo_createStructure.sh b/Scripts/Functions/Help/Texinfo/texinfo_createStructure.sh index 34a5be3..a7c6d29 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_createStructure.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_createStructure.sh @@ -52,8 +52,8 @@ function texinfo_createStructure { # Create manual's top-level directory using subversion. This is # the place where all texinfo documentation manuals is stored in. - if [[ ! -d ${MANUAL_TLDIR} ]];then - svn mkdir ${MANUAL_TLDIR} --quiet + if [[ ! -d ${MANUAL_BASEDIR} ]];then + svn mkdir ${MANUAL_BASEDIR} --quiet MANUAL_FIRSTTIME_CREATED='true' fi @@ -123,7 +123,7 @@ function texinfo_createStructure { # working copy, but chages in the working copy do are committed up # to repository. if [[ ${MANUAL_FIRSTTIME_CREATED} == 'true' ]];then - cli_commitRepoChanges ${MANUAL_TLDIR} + cli_commitRepoChanges ${MANUAL_BASEDIR} fi } diff --git a/Scripts/Functions/Help/Texinfo/texinfo_createStructureChapters.sh b/Scripts/Functions/Help/Texinfo/texinfo_createStructureChapters.sh index 4ee45ec..32c971f 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_createStructureChapters.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_createStructureChapters.sh @@ -42,7 +42,7 @@ function texinfo_createStructureChapters { for FILE in $FILES;do # Redefine manual's chapter directory based on template files. - MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR}/$(basename $(dirname ${FILE})) + MANUAL_CHAPTER_DIR=${MANUAL_BASEDIR_L10N}/$(basename $(dirname ${FILE})) # Verify texinfo templates used as based to build the chapter. # Be sure they are inside the working copy of CentOS Artwork diff --git a/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh b/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh index ba81431..e6f0aeb 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_deleteCrossReferences.sh @@ -62,8 +62,8 @@ function texinfo_deleteCrossReferences { REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' # Define list of entries to process. - local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} \ - --pattern=".*\.${MANUAL_EXTENSION}") + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern=".+\.${MANUAL_EXTENSION}") # Update node-related cross references. The node-related cross # reference definition, long ones specially, could require more diff --git a/Scripts/Functions/Help/Texinfo/texinfo_getEntry.sh b/Scripts/Functions/Help/Texinfo/texinfo_getEntry.sh index d4d813f..e853c12 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_getEntry.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_getEntry.sh @@ -33,7 +33,7 @@ function texinfo_getEntry { for MANUAL_SECTION_NAME in $MANUAL_SECTION_NAMES;do # Define absolute path to documentation entry. - MANUAL_ENTRY=${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME}/${MANUAL_SECTION_NAME}.${MANUAL_EXTENSION} + MANUAL_ENTRY=${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}/${MANUAL_SECTION_NAME}.${MANUAL_EXTENSION} # Output entry's absolute path. echo ${MANUAL_ENTRY} diff --git a/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh b/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh index 4c10bcb..6863284 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_getNode.sh @@ -35,7 +35,7 @@ function texinfo_getNode { # Define node from documentation entry. local NODE=$(echo "$MANUAL_ENTRY" | sed -r \ - -e "s!^${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME}!!" \ + -e "s!^${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}!!" \ -e "s/(chapter-intro\.${MANUAL_EXTENSION}|\.${MANUAL_EXTENSION})$//" \ -e 's!(/|-)! !g' \ -e 's! ([[:alpha:]])! \u\1!g' \ diff --git a/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh b/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh index 740d167..25b6229 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_renameCrossReferences.sh @@ -36,8 +36,8 @@ function texinfo_renameCrossReferences { local NODE_DST=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_DST") # Define list of entries to process. - local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} \ - --pattern=".*\.${MANUAL_EXTENSION}") + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern=".+\.${MANUAL_EXTENSION}") # Update node-related cross-references. The node-related cross # reference definition, long ones specially, could require more diff --git a/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh b/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh index d9992e9..5a15609 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_restoreCrossReferences.sh @@ -59,8 +59,8 @@ function texinfo_restoreCrossReferences { REPLACE[1]='\1' # Define list of entries to process. - local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} \ - --pattern=".*\.${MANUAL_EXTENSION}") + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR_L10N} \ + --pattern=".+\.${MANUAL_EXTENSION}") # Update node-related cross references. The node-related cross # reference definition, long ones specially, could require more diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh index b5a0cfb..9205958 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh @@ -42,7 +42,7 @@ function texinfo_updateOutputFileXhtml { # Add manual base directory path into directory stack to make it # the current working directory. This is done to reduce the path # information packaged inside `repository.xhtml.tar.bz2' file. - pushd ${MANUAL_BASEDIR} > /dev/null + pushd ${MANUAL_BASEDIR_L10N} > /dev/null # Clean up directory structure where xhtml files will be stored. # We don't want to have unused files inside it. @@ -63,8 +63,8 @@ function texinfo_updateOutputFileXhtml { texi2html --lang=$(cli_getCurrentLocale --langcode-only) \ --init-file=${MANUAL_TEMPLATE}/manual-init.pl \ --init-file=${MANUAL_TEMPLATE_L10N}/manual-init.pl \ - --output=${MANUAL_BASEDIR}/${MANUAL_NAME}-xhtml \ - ${MANUAL_BASEDIR}/${MANUAL_NAME}.${MANUAL_EXTENSION} + --output=${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}-xhtml \ + ${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}.${MANUAL_EXTENSION} # Remove directory where xhtml files are stored from directory # stack. The xhtml files have been already created. diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh index 858935c..c1d4a87 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateSectionNodes.sh @@ -45,8 +45,8 @@ function texinfo_updateSectionNodes { # 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 + if [[ ! -f ${MANUAL_BASEDIR_L10N}/$INCL ]] \ + && [[ $(cli_getRepoStatus ${MANUAL_BASEDIR_L10N}/$INCL) != 'D' ]];then # Define absolute path to template assignment file. This # is the file that controls the way texinfo template files @@ -89,7 +89,7 @@ function texinfo_updateSectionNodes { | gawk 'BEGIN{FS="="}; { print $2 }' \ | sed -r 's![[:space:]]*!!g' | sed -r 's!^"(.+)"$!\1!') - if [[ ${MANUAL_BASEDIR}/${INCL} =~ $CONFRHS ]];then + if [[ ${MANUAL_BASEDIR_L10N}/${INCL} =~ $CONFRHS ]];then TEMPLATE="${MANUAL_TEMPLATE_L10N}/${CONFLHS}" break fi @@ -103,12 +103,12 @@ function texinfo_updateSectionNodes { # Create documentation entry using texinfo template as # reference. - svn cp ${TEMPLATE} ${MANUAL_BASEDIR}/$INCL --quiet + svn cp ${TEMPLATE} ${MANUAL_BASEDIR_L10N}/$INCL --quiet fi # Expand common translation markers in documentation entry. - cli_expandTMarkers "${MANUAL_BASEDIR}/$INCL" + cli_expandTMarkers "${MANUAL_BASEDIR_L10N}/$INCL" # Replace node, section and concept index definitions already # defined with node, section and concept index translation @@ -117,7 +117,7 @@ function texinfo_updateSectionNodes { -e '/@node/c@node =NODE=' \ -e '/@section/c@section =SECT=' \ -e '/@cindex/c@cindex =CIND=' \ - "${MANUAL_BASEDIR}/$INCL" + "${MANUAL_BASEDIR_L10N}/$INCL" # Expand noce, section and concept index translation # markers in documentation entry. @@ -125,7 +125,7 @@ function texinfo_updateSectionNodes { -e "s!=NODE=!${NODE}!g" \ -e "s!=SECT=!${SECT}!g" \ -e "s!=CIND=!${CIND}!g" \ - "${MANUAL_BASEDIR}/$INCL" + "${MANUAL_BASEDIR_L10N}/$INCL" # Verify existence of chapter-nodes template files. If no # chapter-nodes template is found, stop script execution with diff --git a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh index 385b4e5..36dffa9 100755 --- a/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh +++ b/Scripts/Functions/Help/Texinfo/texinfo_updateStructureSection.sh @@ -56,7 +56,7 @@ function texinfo_updateStructureSection { # using it. Don't include manual or chapter definition files # in this list, it would create documentation entries for them # and that shouldn't happen. - MANUAL_ENTRIES=$(cli_getFilesList $(dirname ${MANUAL_BASEDIR}) \ + MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} \ --pattern="$PATTERN" | egrep -v "/(${MANUAL_NAME}|chapter)") fi diff --git a/Scripts/Functions/Help/help.sh b/Scripts/Functions/Help/help.sh index f793835..4a80caa 100755 --- a/Scripts/Functions/Help/help.sh +++ b/Scripts/Functions/Help/help.sh @@ -40,6 +40,25 @@ function help { # Initialize manual's language. local MANUAL_L10N=$(cli_getCurrentLocale) + # Initialize manuals's top-level directory. This is the place + # where the manual will be stored in. To provide flexibility, the + # current directory where the `centos-art.sh' script was called + # from is used as manual's top-level directory. Notice that this + # relaxation is required because we need to create/maintain + # manuals both under `trunk/Manuals/' and `branches/Manuals/' + # directories. + local MANUAL_TLDIR=${PWD} + + # Verify manual's top-level directory. To prevent messing the + # things up, we need to restrict the possible locations + # documentation manuals can be created inside the working copy. + # When manual's top-level location is other but the ones + # permitted, use `trunk/Manuals' directory structure as default + # location to store documentation manuals. + if [[ ! $MANUAL_TLDIR =~ "^${HOME}/artwork/(trunk|branches)/Manuals" ]];then + MANUAL_TLDIR="${HOME}/artwork/trunk/Manuals" + fi + # Initialize arrays related to documentation entries. Arrays # defined here contain all the information needed to process # documentation entries written in texinfo format. @@ -62,11 +81,6 @@ function help { # information related documentation entries from there. ${FUNCNAM}_getEntries - # Syncronize changes between repository and working copy. At this - # point, changes in the repository are merged in the working copy - # and changes in the working copy committed up to repository. - cli_syncroRepoChanges ${MANUAL_BASEDIR} - # Initialize backend functionalities. At this point we load all # functionalities required into the centos-art.sh's execution # environment and make them available, this way, to perform @@ -89,10 +103,18 @@ function help { # Define name used by manual's main definition file. MANUAL_NAME=${MANUAL_SLFN[${MANUAL_DOCENTRY_ID}]} - # Define absolute path to directory holding manual's main - # definition file. - MANUAL_TLDIR="${HOME}/artwork/branches/Manuals/$(cli_getRepoName \ - ${FLAG_BACKEND} -d)/${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}" + # Define absolute path to directory holding language-specific + # directories. + MANUAL_BASEDIR="${MANUAL_TLDIR}/${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]}" + + # Define absolute path to directory holding language-specific + # texinfo source files. + MANUAL_BASEDIR_L10N="${MANUAL_BASEDIR}/${MANUAL_L10N}" + + # Define absolute path to base file. This is the main file + # name (without extension) we use as reference to build output + # files in different formats (.info, .pdf, .xml, etc.). + MANUAL_BASEFILE="${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}" # Define chapter name. MANUAL_CHAPTER_NAME=${MANUAL_CHAN[${MANUAL_DOCENTRY_ID}]} @@ -100,6 +122,20 @@ function help { # Define section name. MANUAL_SECTION_NAME=${MANUAL_SECN[${MANUAL_DOCENTRY_ID}]} + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. Notice that, because we are processing + # non-option arguments one by one, there is no need to + # sycronize changes to the same manual time after time + # (assuming all documentation entries passed as non-option + # arguments refer the same manual directory name). + if [[ ${MANUAL_DOCENTRY_ID} -eq 0 \ + || ( ( ${MANUAL_DOCENTRY_ID} -gt 0 ) && ( \ + ${MANUAL_DIRN[${MANUAL_DOCENTRY_ID}]} != ${MANUAL_DIRN[((${MANUAL_DOCENTRY_ID} - 1))]} ) ) ]];then + cli_syncroRepoChanges ${MANUAL_BASEDIR} + fi + # Execute backend-specific documentation tasks. ${FLAG_BACKEND}