From 5285d60e07bb1d0d1a69b470559cd692dd40590e Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Feb 22 2011 22:27:45 +0000 Subject: Update `manual' functionality: - Update locations of documentation manuals. Manuals are directly stored under trunk/Manuals/ directory structure as described below: Initializing ------------ trunk/Manual/${NAME}/${NAME}-index.texi trunk/Manual/${NAME}/${NAME}-menu.texi trunk/Manual/${NAME}/${NAME}-nodes.texi trunk/Manual/${NAME}/${NAME}.texi Structuring ----------- trunk/Manual/${NAME}/Chapter-${NUM}/chapter-intro.texi trunk/Manual/${NAME}/Chapter-${NUM}/chapter-menu.texi trunk/Manual/${NAME}/Chapter-${NUM}/chapter-nodes.texi trunk/Manual/${NAME}/Chapter-${NUM}/chapter.texi trunk/Manual/${NAME}/Chapter-${NUM}/section-${NUM}.texi Exporting --------- trunk/Manual/${NAME}/${NAME}.info.bz2 trunk/Manual/${NAME}/${NAME}.pdf trunk/Manual/${NAME}/${NAME}.xml trunk/Manual/${NAME}/${NAME}-es_ES.xml trunk/Manual/${NAME}/${NAME}-html/ ... When $NAME is used as directory it follows the convenction used to create directories inside the repository (the first letter is uppercase and the rest letters are in lowercase). Likewise, when $NAME is used as file it follows the convenction used to create files inside the repository (all letters in lowercase). The value of $NUM starts in number one arabic format (i.e., `1') and increments one for each new chapter or section added. At this moment, automation of documentation manual is available for Repository documentation manual only. The Repository documentation manual organization is a bit different compared to that organization we consider to implement on generic documentation manuals under trunk/Manuals directory structure. So, since the organizational point of view, we have two different kinds of documentation manuals. However, these two different organizational structures are handled by the same manual functionality. The main difference between Repository documentation manual organization and generic documentation manual organization is that Repository documentation manual takes its organization from the CentOS Artwork Repository directory structure itself, while generic documentation manuals take their organization from what the writer considers better for the purpose of the very specific documentation manual she/he is planning to write on. The Repository documentation manual documents directory structures of CentOS Artwork Repository only, while generic documentation manuals can cover very different topics that could be or not related to CentOS Artwork Repository (e.g., release notes, planification manuals, etc.). - Remove localization from new sections created from template files. All information is produced in English language. Translations are made through XML output, xml2po and gettext. - Add manual_updateOutputFileXml.sh. The --docbook option of makeinfo seems to produced not very well formed DocBook documents at this moment. However, the --xml option of makeinfo produces beautiful xml documents we could use to produce translated xml files through xml2po and gettext. - Update variable names. Array variables are no longer used to store path information. Most of needs are covered by MANUAL_BASEDIR, MANUAL_DIR, MANUAL_BASEFILE, MANUAL_CHA_NAME and MANUAL_DIR_CHAPTER variables. --- diff --git a/Scripts/Bash/Functions/Manual/manual.sh b/Scripts/Bash/Functions/Manual/manual.sh index 73b55ee..ff211a9 100755 --- a/Scripts/Bash/Functions/Manual/manual.sh +++ b/Scripts/Bash/Functions/Manual/manual.sh @@ -27,44 +27,15 @@ function manual { + # Define manuals base directory. This is the place where + # documentation manuals base directory structures are stored and + # organized in. + MANUAL_BASEDIR="${HOME}/artwork/trunk/Manuals" + # Define default value to target flag. The target flag (--to) # controls final destination used by copy related actions. local FLAG_TO='' - # Define documentation base directory structure. - MANUALS_DIR[0]='/home/centos/artwork/trunk/Manuals' - MANUALS_DIR[1]=${MANUALS_DIR[0]}/Repository/$(cli_getCurrentLocale) - MANUALS_DIR[2]=${MANUALS_DIR[1]}/Texinfo - MANUALS_DIR[3]=${MANUALS_DIR[1]}/Info - MANUALS_DIR[4]=${MANUALS_DIR[1]}/Html - MANUALS_DIR[5]=${MANUALS_DIR[1]}/Plaintext - MANUALS_DIR[7]=${MANUALS_DIR[1]}/Pdf - - # Define storing directory of Texinfo template files. Texinfo - # template files are set inside English directory structure and - # reused by other languages by means of translation markers and - # gettext translation messages. - MANUALS_DIR[6]=${MANUALS_DIR[0]}/Repository/en/Texinfo/Tpl - - # Define location for texinfo files. - MANUALS_FILE[1]=${MANUALS_DIR[2]}/repository.texi - MANUALS_FILE[2]=${MANUALS_DIR[2]}/repository-chapter-menu.texi - MANUALS_FILE[3]=${MANUALS_DIR[2]}/repository-chapter-nodes.texi - - # Define location for texinfo output files. - MANUALS_FILE[4]=${MANUALS_DIR[3]}/repository.info - MANUALS_FILE[5]=${MANUALS_DIR[5]}/repository.txt - - # Define chapter's file names. - MANUALS_FILE[6]=chapter.texi - MANUALS_FILE[7]=chapter-intro.texi - MANUALS_FILE[8]=chapter-menu.texi - MANUALS_FILE[9]=chapter-nodes.texi - - # Define texinfo template to initialize new sections. - MANUALS_FILE[10]=${MANUALS_DIR[6]}/repository-chapter-section.texi - MANUALS_FILE[11]=${MANUALS_DIR[2]}/repository-chapter-index.texi - # Define command-line interface. manual_getActions diff --git a/Scripts/Bash/Functions/Manual/manual_checkChapter.sh b/Scripts/Bash/Functions/Manual/manual_checkChapter.sh index 6e60275..afb57de 100755 --- a/Scripts/Bash/Functions/Manual/manual_checkChapter.sh +++ b/Scripts/Bash/Functions/Manual/manual_checkChapter.sh @@ -28,10 +28,10 @@ function manual_checkChapter { # Check chapter's directory existence. - if [[ ! -d $ENTRYCHAPTER ]];then + if [[ ! -d $MANUAL_DIR_CHAPTER ]];then cli_printMessage "`gettext "The following documentation chapter will be created:"`" - cli_printMessage "$ENTRYCHAPTER" "AsResponseLine" + cli_printMessage "$MANUAL_DIR_CHAPTER" "AsResponseLine" cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" manual_updateChaptersFiles diff --git a/Scripts/Bash/Functions/Manual/manual_deleteCrossReferences.sh b/Scripts/Bash/Functions/Manual/manual_deleteCrossReferences.sh index 3bb727f..53f4c65 100755 --- a/Scripts/Bash/Functions/Manual/manual_deleteCrossReferences.sh +++ b/Scripts/Bash/Functions/Manual/manual_deleteCrossReferences.sh @@ -36,9 +36,9 @@ function manual_deleteCrossReferences { # Build the node string using global entry (ENTRY) variable being # processed currently. local NODE=$(echo "$ENTRY" \ - | cut -d / -f10- \ + | cut -d / -f8- \ | tr '/' ' ' \ - | sed -r "s/(${MANUALS_FILE[7]}|\.texi)$//") + | sed -r "s/(chapter-intro\.texi|\.texi)$//") # Define regular expression patterns for texinfo cross reference # commands. @@ -64,9 +64,12 @@ function manual_deleteCrossReferences { # sanitate missing cross refereces before info file is created, # errors are displayed since makeinfo don't produce info output # with broken cross refereces. - sed -r -i \ - -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ - -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ - $(find ${MANUALS_DIR[2]} -mindepth 3 -name '*.texi') + local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi') + if [[ $ENTRIES != '' ]];then + sed -r -i \ + -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ + -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ + $ENTRIES + fi } diff --git a/Scripts/Bash/Functions/Manual/manual_deleteEntry.sh b/Scripts/Bash/Functions/Manual/manual_deleteEntry.sh index 9a371a1..e9f4bb3 100755 --- a/Scripts/Bash/Functions/Manual/manual_deleteEntry.sh +++ b/Scripts/Bash/Functions/Manual/manual_deleteEntry.sh @@ -1,7 +1,7 @@ #!/bin/bash # # manual_deleteEntry.sh -- This function removes a documentation entry -# from your working copy documentation structure. +# from documentation directory structure. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -26,49 +26,59 @@ function manual_deleteEntry { - # Define variables as local to avoid conflicts outside. local ENTRIES='' + local ENTRYSTATUS='' local LOCATION='' # Check if the entry has been already removed. cli_checkFiles $ENTRY 'f' - # Define entries. Start with the one being processed currently. - ENTRIES=$ENTRY - # Define root location to look for entries. LOCATION=$(echo $ENTRY | sed -r 's!\.texi$!!') # Redefine location to match the chapter's root directory. This # applies when you try to remove the whole chapter from the # working copy (e.g., centos-art manual --delete=/home/centos/artwork/trunk/). - if [[ $ENTRY =~ "${MANUALS_FILE[7]}$" ]];then + if [[ $ENTRY =~ "chapter-intro\.texi$" ]];then LOCATION=$(dirname "$ENTRY") fi - # Look for dependent entries. In this context, dependent entries - # are all files ending in .texi which have a directory name that - # matches the file name (without .texi extension) of the entry - # being processed currently. See LOCATION default definition - # above. If location directory doesn't exist it is probably - # because there is no dependent entries. + # Define list of dependent entries. Dependent entries are stored + # inside a directory with the same name of the entry you are + # trying to remove. If such directory location doesn't exists, the + # related entry doesn't have dependent entries either. if [[ -d $LOCATION ]];then - for ENTRY in $(find $LOCATION -name '*.texi');do - ENTRIES="$ENTRIES $ENTRY $(dirname "$ENTRY")" - done + ENTRIES=$(cli_getFilesList $LOCATION ".*\.texi") fi - - # Remove duplicated lines from entries list. + + # Add entry being currently processed to list of files to precess. + ENTRIES="${ENTRIES} ${ENTRY}" + + # Remove duplicated lines from entries list, be sure there is just + # one path per line and they are ordered in reverse. At this + # point, it is hard to find duplicated lines since the list of + # entries is built from files and it is not possible to have two + # files in the very same directory using the same name exactly, so + # this could be considered a bit paranoid. ~:-) ENTRIES=$(echo "$ENTRIES" | tr ' ' "\n" | sort -r | uniq) # Print action preamble. cli_printActionPreamble "$ENTRIES" 'doDelete' 'AsResponseLine' - # Redefine ENTRY using affected entries as reference. + # Process list of entries. for ENTRY in $ENTRIES;do + # Define the versioning status of entry. + if [[ -d $(dirname $ENTRY)/.svn ]];then + ENTRYSTATUS=$(cli_getRepoStatus "$ENTRY") + else + # At this point we don't know what the entry versioning + # status is, so consider the entry an unversion file. + ENTRYSTATUS='?' + fi + # Verify entry inside the working copy. - if [[ $(cli_getRepoStatus "$ENTRY") =~ '^(\?)?$' ]];then + if [[ "$ENTRYSTATUS" =~ '^(\?)?$' ]];then # Print action message. cli_printMessage "$ENTRY" "AsDeletingLine" @@ -87,14 +97,14 @@ function manual_deleteEntry { # entry can be under version control or not versioned at all. # Here we need to decide how to remove documentation entries # based on whether they are under version control or not. - if [[ "$(cli_getRepoStatus "$ENTRY")" == '' ]];then + if [[ "$ENTRYSTATUS" == ' ' ]];then # Documentation entry is under version control and there # is no change to be committed up to central repository. # We are safe to schedule it for deletion. svn del "$ENTRY" --quiet - elif [[ "$(cli_getRepoStatus "$ENTRY")" == '?' ]];then + elif [[ "$ENTRYSTATUS" == '?' ]];then # Documentation entry is not under version control, so we # don't care about changes inside it. If you say @@ -118,9 +128,12 @@ function manual_deleteEntry { # Update chapter's menu and nodes in the master texinfo document. # This is mainly applied when one of the chapters (e.g., trunk/, # tags/, or branches/) is removed. - if [[ ! -d $ENTRYCHAPTER ]];then + if [[ ! -d $MANUAL_DIR_CHAPTER ]];then manual_updateChaptersMenu 'remove-entry' manual_updateChaptersNodes fi + # Update documentation output-related files. + manual_updateOutputFiles + } diff --git a/Scripts/Bash/Functions/Manual/manual_getActions.sh b/Scripts/Bash/Functions/Manual/manual_getActions.sh index df99a44..5b7f2f3 100755 --- a/Scripts/Bash/Functions/Manual/manual_getActions.sh +++ b/Scripts/Bash/Functions/Manual/manual_getActions.sh @@ -26,14 +26,11 @@ function manual_getActions { - # Verify language layout. - manual_checkLanguageLayout - # Define short options we want to support. local ARGSS="" # Define long options we want to support. - local ARGSL="read:,search:,edit:,delete:,update,copy:,to:" + local ARGSL="read:,search:,edit:,delete:,update:,copy:,to:" # Parse arguments using getopt(1) command parser. cli_doParseArguments @@ -47,82 +44,43 @@ function manual_getActions { case "$1" in --read ) - - # Define action value passed through the command-line. ACTIONVAL="$2" - - # Define action name using action value as reference. ACTIONNAM="${FUNCNAM}_searchNode" - - # Rotate positional parameters. shift 2 ;; --search ) - - # Define action value passed through the command-line. ACTIONVAL="$2" - - # Define action name using action value as reference. ACTIONNAM="${FUNCNAM}_searchIndex" - - # Rotate positional parameters. shift 2 ;; --edit ) - - # Define action value passed through the command-line. ACTIONVAL="$2" - - # Define action name using action value as reference. ACTIONNAM="${FUNCNAM}_editEntry" - - # Rotate positional parameters. shift 2 ;; --delete ) - - # Define action value passed through the command-line. ACTIONVAL="$2" - - # Define action name. ACTIONNAM="${FUNCNAM}_deleteEntry" - - # Rotate positional parameters. shift 2 ;; --update ) - - # Execute action name. There is no need of action - # value here, so let's execute the action right now. - manual_updateOutputFiles - - # End script execution flow. There is nothing else to - # do after updating documentation output. - exit + ACTIONVAL="$2" + ACTIONNAM="${FUNCNAM}_updateOutputFiles" + shift 2 ;; --copy ) - - # Define action value passed through the command-line. ACTIONVAL="$2" - - # Define action name using action value as reference. ACTIONNAM="${FUNCNAM}_copyEntry" - - # Rotate positional parameters. shift 2 ;; --to ) - - # Redefine target flag. FLAG_TO="$2" - - # Rotate positional parameters. shift 2 ;; @@ -139,25 +97,37 @@ function manual_getActions { # Define documentation entry. ENTRY=$(manual_getEntry) - # Define directory used to store chapter's documentation entries. - # At this point, we need to take a desition about - # documentation-design, in order to answer the question: How do we - # assign chapters, sections and subsections automatically, based - # on the repository structure? + # Define directory for documentation manual. This is the place the + # specific documentation manual we are working with is stored in. + MANUAL_DIR=$(echo $ENTRY | cut -d / -f-7) + + # Define directory to store documentation entries. At this point, + # we need to take a desition about documentation design, in order + # to answer the question: How do we assign chapters, sections and + # subsections automatically, based on the repository structure? + # and also, how such design could be adapted to changes in the + # repository structure? # - # One solution would be: to use three chapters only to represent - # the repository's first level structure (i.e., trunk, - # branches, and tags) and handle everything else as sections. Sub + # One solution would be: represent the repository's first level + # structure in three chapters only (i.e., trunk, branches, and + # tags) and handle everything else inside them as sections. Sub # and subsub section will not have their own files, they will be # written inside section files instead. - ENTRYCHAPTER=$(echo $ENTRY | cut -d / -f-10) + MANUAL_DIR_CHAPTER=$(echo $ENTRY | cut -d / -f-8) + + # Define chapter name for the documentation entry we are working + # with. + MANUAL_CHA_NAME=$(basename "$MANUAL_DIR_CHAPTER") - # Define chapter name for this documentation entry. - CHAPTERNAME=$(basename "$ENTRYCHAPTER") + # Define base name for documentation manual files. This is the + # main file name used to build texinfo related files (.info, .pdf, + # .xml, etc.). + MANUAL_BASEFILE=$(echo $ENTRY | cut -d / -f-7) + MANUAL_BASEFILE=${MANUAL_BASEFILE}/$(cli_getRepoName "${MANUAL_BASEFILE}" 'f') # Syncronize changes between the working copy and the central # repository to bring down changes. - cli_commitRepoChanges ${MANUALS_DIR[0]} + cli_commitRepoChanges ${MANUAL_DIR} # Execute action name. if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then @@ -169,6 +139,6 @@ function manual_getActions { # Syncronize changes between the working copy and the central # repository to commit up changes. - cli_commitRepoChanges "${MANUALS_DIR[0]}" + cli_commitRepoChanges ${MANUAL_DIR} } diff --git a/Scripts/Bash/Functions/Manual/manual_getEntry.sh b/Scripts/Bash/Functions/Manual/manual_getEntry.sh index 146e456..f974b32 100755 --- a/Scripts/Bash/Functions/Manual/manual_getEntry.sh +++ b/Scripts/Bash/Functions/Manual/manual_getEntry.sh @@ -29,8 +29,6 @@ function manual_getEntry { # Define variables as local to avoid conflicts outside. - local DIR='' - local FILE='' local ENTRY='' local LOCATION='' @@ -43,48 +41,41 @@ function manual_getEntry { LOCATION="$ACTIONVAL" fi - # Build directory to store documenation entry. - DIR=$(echo $LOCATION | sed -r 's!^/home/centos/artwork/!!') - DIR=$(dirname "$DIR") - DIR=${MANUALS_DIR[2]}/$DIR + # Define relative path of entry, from trunk directory on. + ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") - # Build file for documentation entry. Notice that directory - # structure convenction is not used here through cli_getRepoName. - # This is because documentation structures mirror other directory - # structures inside the repository. So, if we are documenting - # trunk/Identity/Brands/ directory we don't want to have the - # trunk/Identity/brands.texi documentation entry, but - # trunk/Identity/Brands.texi in order to reflect the fact that we - # are documenting a directory structure. Something similar occurs - # with files, but using repository file convenction instead. This - # way we just use basename to find out the last component in the - # path without sanitation. We assume it has been already - # sanitated. - FILE=$(basename "$LOCATION").texi + # Verify the entry relative path to find out which documentation + # manual we are acting on. As convenction, whatever documentation + # entry you provide outside trunk/Manuals/ directory structure is + # considered as you are documenting the repository directory + # structure. Otherwise, if an entry inside trunk/Manuals/ is + # provided, the directory structure provided is used as default + # documentation manual for actions like `--create' and `--update' + # to take place on. Other options like `--edit', `--delete' and + # `--read' cannot be applied to paths provided is inside + # trunk/Manuals/ such actions made manually. + if [[ ${ENTRY} =~ '^trunk/Manuals/.+$' ]];then + ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/!!') + else + ENTRY=$(dirname Repository/${ENTRY})/$(basename $LOCATION).texi + fi - # Combine both directory (DIR) and file (FILE) to build entry's - # absolute path. When the entry's absolute path is built for the - # current location, the string "." is returned by cli_getRepoName - # and used as current directory to store the .texi file. This is - # not desirable because we are using absolute path already and the - # "." string adds another level in the path (e.g., - # /home/centos/artwork/trunk/Manuals/Texinfo/en/./trunk/chapter.texi). - # This extra level in the path confuses the script when it tries - # to find out where the chapter's directory is. In the example - # above, the chapter's directory is "trunk/" not "./". So, remove - # the string './' from entry's absolute path in order to build the - # entry's absolute path correctly. - ENTRY=$(echo $DIR/$FILE | sed -r 's!\./!!') + # Re-define entry to set absolute path to manuals base directory + # structure. + ENTRY=${MANUAL_BASEDIR}/${ENTRY} - # Re-define documentation entry if it is the chapter entry. + # Re-define documentation entry to handle chapter entries. Chapter + # entries are handled inside the chapter it refers to, not outside + # it. To store chapter-specific information, the special file + # chapter-intro.texi is used inside the chapter. # TODO: automate the verification, in order to accept any other # structure in the first level. - if [[ $ENTRY =~ "(trunk|branches|tags)\.texi$" ]];then - ENTRY=$(echo $ENTRY \ - | sed -r "s/(trunk|branches|tags)\.texi$/\1\/${MANUALS_FILE[7]}/") + if [[ ${ENTRY} =~ "(trunk|branches|tags)\.texi$" ]];then + ENTRY=$(echo ${ENTRY} \ + | sed -r "s/(trunk|branches|tags)\.texi$/\1\/chapter-intro.texi/") fi # Output entry's absolute path. - echo $ENTRY + echo ${ENTRY} } diff --git a/Scripts/Bash/Functions/Manual/manual_restoreCrossReferences.sh b/Scripts/Bash/Functions/Manual/manual_restoreCrossReferences.sh index febda70..fb8ece9 100755 --- a/Scripts/Bash/Functions/Manual/manual_restoreCrossReferences.sh +++ b/Scripts/Bash/Functions/Manual/manual_restoreCrossReferences.sh @@ -40,7 +40,7 @@ function manual_restoreCrossReferences { # Build the node string using global entry (ENTRY) variable being # processed currently. local NODE=$(echo "$ENTRY" \ - | cut -d / -f10- \ + | cut -d / -f8- \ | tr '/' ' ' \ | sed -r "s/(${MANUALS_FILE[7]}|\.texi)$//") @@ -67,9 +67,12 @@ function manual_restoreCrossReferences { # documentation entry, they represent, can be recreated in the # future and, at that time, the link wouldn't be broken any more, # so we need to be aware of this. - sed -r -i \ - -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ - -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ - $(find ${MANUALS_DIR[2]} -mindepth 3 -name '*.texi') + local ENTRIES=$(cli_getFilesList "${MANUAL_DIR}" '.*\.texi') + if [[ $ENTRIES != '' ]];then + sed -r -i \ + -e "s!${PATTERN[0]}!${REPLACE[0]}!Mg" \ + -e "s!${PATTERN[1]}!${REPLACE[1]}!g" \ + $ENTRIES + fi } diff --git a/Scripts/Bash/Functions/Manual/manual_searchIndex.sh b/Scripts/Bash/Functions/Manual/manual_searchIndex.sh index 812529f..09b9238 100644 --- a/Scripts/Bash/Functions/Manual/manual_searchIndex.sh +++ b/Scripts/Bash/Functions/Manual/manual_searchIndex.sh @@ -26,51 +26,6 @@ function manual_searchIndex { - # Define search pattern format. - local PATTERN='^[[:alnum:],]+$' - - # Define default search string. - local SEARCH='' - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="filter:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - --filter ) - SEARCH="$2" - shift 2 - ;; - * ) - break - esac - done - - # Re-define default SEARCH value. If the search string is not - # provided as `--filter' argument, ask user to provide one. - if [[ ! $SEARCH =~ $PATTERN ]];then - cli_printMessage "`gettext "Enter the search pattern"`" "AsRequestLine" - read SEARCH - fi - - # Validate search string using search pattern. - if [[ ! "$SEARCH" =~ $PATTERN ]];then - cli_printMessage "`gettext "The search pattern is not valid."`" 'AsErrorLine' - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - - # Perform index search inside documentation info file. - /usr/bin/info --index-search="$SEARCH" --file=${MANUALS_FILE[4]} + /usr/bin/info --index-search="$FLAG_FILTER" --file=${MANUAL_BASEFILE}.info.bz2 } diff --git a/Scripts/Bash/Functions/Manual/manual_searchNode.sh b/Scripts/Bash/Functions/Manual/manual_searchNode.sh index d7269ed..e3adba5 100755 --- a/Scripts/Bash/Functions/Manual/manual_searchNode.sh +++ b/Scripts/Bash/Functions/Manual/manual_searchNode.sh @@ -30,7 +30,7 @@ function manual_searchNode { # exits use the info reader to open the info file at the # specified node. Otherwise, ask the user for create it. if [[ -f "$ENTRY" ]];then - /usr/bin/info --node="$(manual_getNode)" --file=${MANUALS_FILE[4]} + /usr/bin/info --node="$(manual_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 else manual_editEntry fi diff --git a/Scripts/Bash/Functions/Manual/manual_updateChaptersFiles.sh b/Scripts/Bash/Functions/Manual/manual_updateChaptersFiles.sh index a0fe763..6a38b6e 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateChaptersFiles.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateChaptersFiles.sh @@ -28,34 +28,29 @@ function manual_updateChaptersFiles { # Define chapter's generic structure. local CHAPTERBODY="\ - @node $CHAPTERNAME - @chapter $CHAPTERNAME - @cindex $(echo $CHAPTERNAME | tr '[[:upper:]]' '[[:lower:]]') - @include $CHAPTERNAME/${MANUALS_FILE[7]} - @include $CHAPTERNAME/${MANUALS_FILE[8]} - @include $CHAPTERNAME/${MANUALS_FILE[9]}" + @node $MANUAL_CHA_NAME + @chapter $MANUAL_CHA_NAME + @cindex $(echo $MANUAL_CHA_NAME | tr '[[:upper:]]' '[[:lower:]]') + @include $MANUAL_CHA_NAME/chapter-intro.texi + @include $MANUAL_CHA_NAME/chapter-menu.texi + @include $MANUAL_CHA_NAME/chapter-nodes.texi" # Remove any space/tabs at the begining of @... lines. CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') # Create directory to store chapter files. - if [[ ! -d $ENTRYCHAPTER ]];then - mkdir $ENTRYCHAPTER + if [[ ! -d $MANUAL_DIR_CHAPTER ]];then + mkdir $MANUAL_DIR_CHAPTER fi # Create files to store chapter information. If chapter files # already exist, they will be re-written and any previous # information inside them will be lost. - echo "$CHAPTERBODY" > $ENTRYCHAPTER/${MANUALS_FILE[6]} - echo "" > $ENTRYCHAPTER/${MANUALS_FILE[8]} - echo "" > $ENTRYCHAPTER/${MANUALS_FILE[9]} + echo "$CHAPTERBODY" > $MANUAL_DIR_CHAPTER/chapter.texi + echo "" > $MANUAL_DIR_CHAPTER/chapter-menu.texi + echo "" > $MANUAL_DIR_CHAPTER/chapter-nodes.texi # Initialize chapter instroduction using template file. - cp ${MANUALS_DIR[6]}/repository-chapter-intro.texi $ENTRYCHAPTER/${MANUALS_FILE[7]} - sed -r -i \ - -e "s!=GOALS=!`gettext "Goals"`!g" \ - -e "s!=USAGE=!`gettext "Usage"`!g" \ - -e "s!=CONCEPTS=!`gettext "Concepts"`!g" \ - -e "s!=DIRECTORIES=!`gettext "Directories"`!g" \ - $ENTRYCHAPTER/${MANUALS_FILE[7]} + cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_DIR_CHAPTER/chapter-intro.texi + } diff --git a/Scripts/Bash/Functions/Manual/manual_updateChaptersMenu.sh b/Scripts/Bash/Functions/Manual/manual_updateChaptersMenu.sh index ed8095c..c3ec336 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateChaptersMenu.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateChaptersMenu.sh @@ -33,46 +33,46 @@ function manual_updateChaptersMenu { # file (repository.texi). To create the final .info file # correctly, the Index line in the menu should remain, even no # other node exist. - if [[ -f ${MANUALS_FILE[2]} ]];then - MENUCHAPTERS=$(cat ${MANUALS_FILE[2]} \ - | egrep -v "^(@(end )?menu$|\* `gettext "Index"`::.*)$") + if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then + MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | egrep -v "^(@(end )?menu$|\* Index::.*)$") fi # Re-defined menu of chapters based on action. case $ACTION in 'remove-entry' ) # Remove chapter from menu. - MENUCHAPTERS=$(echo "$MENUCHAPTERS" \ - | egrep -v "^\* ${CHAPTERNAME}::[[:print:]]*$") + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ + | egrep -v "^\* ${MANUAL_CHA_NAME}::[[:print:]]*$") ;; 'update-entry' | * ) # Update chapter menu using texinfo format. - MENUCHAPTERS="$MENUCHAPTERS - * $CHAPTERNAME::" + MENUCHAPTERS="${MENUCHAPTERS} + * ${MANUAL_CHA_NAME}::" ;; esac # Remove opening spaces/tabs and empty line from the menu of # chapters. Empty lines may occur the first time the menu of # chapters is created. - MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sed -r 's!^[[:space:]]+!!' \ + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ | egrep -v '^[[:space:]]*$') # Organize menu of chapters alphabetically and verify that no # duplicated line be included on the list. - MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sort | uniq ) + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq ) # Give format to final menu output. MENUCHAPTERS="@menu - $MENUCHAPTERS - * `gettext "Index"`:: + ${MENUCHAPTERS} + * Index:: @end menu" # Strip opening space/tabs from final menu of chapters. - MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sed -r 's!^[[:space:]]+!!' \ + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ | egrep -v '^[[:space:]]*$') # Dump organized menu of chapters into file. - echo "$MENUCHAPTERS" > ${MANUALS_FILE[2]} + echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.texi } diff --git a/Scripts/Bash/Functions/Manual/manual_updateChaptersNodes.sh b/Scripts/Bash/Functions/Manual/manual_updateChaptersNodes.sh index 146718d..7ebfe77 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateChaptersNodes.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateChaptersNodes.sh @@ -27,7 +27,7 @@ function manual_updateChaptersNodes { # Build list "nodes of chapters" based on menu of chapters. - local CHAPTERNODES=$(cat ${MANUALS_FILE[2]} \ + local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ | egrep -v '^@(end )?menu$' \ | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ @@ -35,9 +35,9 @@ function manual_updateChaptersNodes { # Build list of texinfo inclusions to load chapters' nodes. local FILENODE=$(\ - for CHAPTERNODE in $CHAPTERNODES;do + for CHAPTERNODE in ${CHAPTERNODES};do - INCL=$(echo $CHAPTERNODE | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") + INCL=$(echo ${CHAPTERNODE} | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") # Output inclusion line using texinfo format. echo "@include $INCL" @@ -45,6 +45,6 @@ function manual_updateChaptersNodes { done) # Dump organized nodes of chapters into file. - echo "$FILENODE" > ${MANUALS_FILE[3]} + echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.texi } diff --git a/Scripts/Bash/Functions/Manual/manual_updateMenu.sh b/Scripts/Bash/Functions/Manual/manual_updateMenu.sh index e9766c0..b147742 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateMenu.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateMenu.sh @@ -38,16 +38,16 @@ function manual_updateMenu { # Build the menu line related to the entry being processed # currently. local MENULINE=$(echo "$ENTRY" \ - | cut -d / -f10- \ + | cut -d / -f8- \ | tr '/' ' ' \ - | sed -r "s/(${MANUALS_FILE[7]}|\.texi)$//") + | sed -r "s/(chapter-intro\.texi|\.texi)$//") # Give format to menu line using texinfo style. MENULINE="* $MENULINE::" # Define chapter's menu. Remove `@menu', `@end menu', and empty lines # from output. - local MENU=$(cat $ENTRYCHAPTER/${MANUALS_FILE[8]} \ + local MENU=$(cat $MANUAL_DIR_CHAPTER/chapter-menu.texi \ | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') # Re-defined chapter's menu based on action. @@ -80,6 +80,6 @@ function manual_updateMenu { MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') # Dump final menu structure back into chapter's menu file. - echo "$MENU" > $ENTRYCHAPTER/${MANUALS_FILE[8]} + echo "$MENU" > $MANUAL_DIR_CHAPTER/chapter-menu.texi } diff --git a/Scripts/Bash/Functions/Manual/manual_updateNodes.sh b/Scripts/Bash/Functions/Manual/manual_updateNodes.sh index 6232193..9f5bf43 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateNodes.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateNodes.sh @@ -27,7 +27,7 @@ function manual_updateNodes { # Retrive nodes' entries from chapter-menu.texi file. - local NODES=$(cat $ENTRYCHAPTER/${MANUALS_FILE[8]} \ + local NODES=$(cat $MANUAL_DIR_CHAPTER/chapter-menu.texi \ | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) @@ -39,24 +39,14 @@ function manual_updateNodes { INCL=$(echo "$NODE" | sed -r 's! !/!g').texi CIND=$(echo "$NODE") - # Create an emtpy directory to store texinfo files. - if [[ ! -d ${MANUALS_DIR[2]}/$(dirname "$INCL") ]];then - mkdir -p ${MANUALS_DIR[2]}/$(dirname "$INCL") + # Create an empty directory to store texinfo files. + if [[ ! -d ${MANUAL_DIR}/$(dirname "$INCL") ]];then + mkdir -p ${MANUAL_DIR}/$(dirname "$INCL") fi # Create texinfo section file using its template. - if [[ ! -f ${MANUALS_DIR[2]}/$INCL ]];then - - cp ${MANUALS_FILE[10]} ${MANUALS_DIR[2]}/$INCL - - # Translate template instance. - sed -r -i \ - -e "s!=GOALS=!`gettext "Goals"`!g" \ - -e "s!=USAGE=!`gettext "Usage"`!g" \ - -e "s!=DESCRIPTION=!`gettext "Description"`!g" \ - -e "s!=SEEALSO=!`gettext "See also"`!g" \ - ${MANUALS_DIR[2]}/$INCL - + if [[ ! -f ${MANUAL_DIR}/$INCL ]];then + cp ${FUNCCONFIG}/manual-section.texi ${MANUAL_DIR}/$INCL fi # Output node information based on texinfo menu. @@ -67,7 +57,7 @@ function manual_updateNodes { echo "" # Dump node information into chapter node file. - done > $ENTRYCHAPTER/${MANUALS_FILE[9]} + done > $MANUAL_DIR_CHAPTER/chapter-nodes.texi } diff --git a/Scripts/Bash/Functions/Manual/manual_updateOutputFileHtml.sh b/Scripts/Bash/Functions/Manual/manual_updateOutputFileHtml.sh index 5c84f29..326ac00 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateOutputFileHtml.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateOutputFileHtml.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# manual_updateOutputFileHtml.sh -- This function updates manuals' html -# related output files. +# manual_updateOutputFileHtml.sh -- This function exports +# documentation manual to HTML format. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -26,20 +26,20 @@ function manual_updateOutputFileHtml { - # Output action message - cli_printMessage "`gettext "Updating manual's html output"`" 'AsResponseLine' + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}-html" 'AsUpdatingLine' # Check html output directory - [[ ! -d ${MANUALS_DIR[4]} ]] && mkdir -p ${MANUALS_DIR[4]} + [[ ! -d ${MANUAL_BASEFILE}-html ]] && mkdir -p ${MANUAL_BASEFILE}-html # Add html output directory into directory stack to make it the # current working directory. Otherwise texi2html may produce # incorrect paths to images included. - pushd ${MANUALS_DIR[4]} > /dev/null + pushd ${MANUAL_BASEFILE}-html > /dev/null # Update html files. Use texi2html to export from texinfo file # format to html using CentOS Web default visual style. - texi2html ${MANUALS_FILE[1]} --output=${MANUALS_DIR[4]} --split section \ + texi2html ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}-html --split section \ --nosec-nav \ --css-include=/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ -I=/home/centos/artwork @@ -51,7 +51,7 @@ function manual_updateOutputFileHtml { # Texi2html default html output. sed -r -i \ -f /home/centos/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ - ${MANUALS_DIR[4]}/*.html + ${MANUAL_BASEFILE}-html/*.html # Remove html output directory from directory stack. popd > /dev/null diff --git a/Scripts/Bash/Functions/Manual/manual_updateOutputFileInfo.sh b/Scripts/Bash/Functions/Manual/manual_updateOutputFileInfo.sh index 2e3f57e..0dd59b7 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateOutputFileInfo.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateOutputFileInfo.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# manual_updateOutputFileInfo.sh -- This function updates manual's info -# output related file. +# manual_updateOutputFileInfo.sh -- This function exports +# documentation manual to info format. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -27,21 +27,14 @@ function manual_updateOutputFileInfo { # Output action message. - cli_printMessage "`gettext "Updating manual's info output"`" 'AsResponseLine' - - # Check info output directory. - [[ ! -d ${MANUALS_DIR[3]} ]] && mkdir -p ${MANUALS_DIR[3]} + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsUpdatingLine' # Update info file. - /usr/bin/makeinfo ${MANUALS_FILE[1]} --output=${MANUALS_FILE[4]} - - # Check info file. If the info file was not created then there are - # errors to fix. - if [[ ! -f ${MANUALS_FILE[4]} ]];then - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi + /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info # Compress info file. - bzip2 -f ${MANUALS_FILE[4]} + if [[ $? -eq 0 ]];then + bzip2 -f ${MANUAL_BASEFILE}.info + fi } diff --git a/Scripts/Bash/Functions/Manual/manual_updateOutputFilePdf.sh b/Scripts/Bash/Functions/Manual/manual_updateOutputFilePdf.sh index 8b0a78a..ff2caac 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateOutputFilePdf.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateOutputFilePdf.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# manual_updateOutputFilePdf.sh -- This function updates manuals' pdf -# related output file. +# manual_updateOutputFilePdf.sh -- This function exports documentation +# manual to PDF format. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -27,11 +27,10 @@ function manual_updateOutputFilePdf { # Output action message. - cli_printMessage "`gettext "Updating manual's pdf output"`" 'AsResponseLine' - - # Check plaintext output directory. - [[ ! -d ${MANUALS_DIR[7]} ]] && mkdir -p ${MANUALS_DIR[7]} + cli_printMessage "${MANUAL_BASEFILE}.pdf" 'AsUpdatingLine' # Update plaintext output directory. - /usr/bin/texi2pdf ${MANUALS_FILE[1]} --output=${MANUALS_DIR[7]} --quiet + /usr/bin/texi2pdf --quiet \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf + } diff --git a/Scripts/Bash/Functions/Manual/manual_updateOutputFilePlaintext.sh b/Scripts/Bash/Functions/Manual/manual_updateOutputFilePlaintext.sh index 6adae1f..9847825 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateOutputFilePlaintext.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateOutputFilePlaintext.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# manual_updateOutputFilePlaintext.sh -- This function updates manuals' -# plaintext related output file. +# manual_updateOutputFilePlaintext.sh -- This function exports +# documentation manual to plain-text format. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -27,13 +27,10 @@ function manual_updateOutputFilePlaintext { # Output action message. - cli_printMessage "`gettext "Updating manual's plaintext output"`" 'AsResponseLine' - - # Check plaintext output directory. - [[ ! -d ${MANUALS_DIR[5]} ]] && mkdir -p ${MANUALS_DIR[5]} + cli_printMessage "${MANUAL_BASEFILE}.txt" 'AsUpdatingLine' # Update plaintext output directory. - /usr/bin/makeinfo ${MANUALS_FILE[1]} --output=${MANUALS_FILE[5]} \ - --plaintext + /usr/bin/makeinfo --plaintext \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt } diff --git a/Scripts/Bash/Functions/Manual/manual_updateOutputFileXml.sh b/Scripts/Bash/Functions/Manual/manual_updateOutputFileXml.sh new file mode 100755 index 0000000..e6e70ab --- /dev/null +++ b/Scripts/Bash/Functions/Manual/manual_updateOutputFileXml.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# manual_updateOutputFileXml.sh -- This function exports documentation +# manual to XML format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function manual_updateOutputFileXml { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.xml" 'AsUpdatingLine' + + # Update plaintext output directory. + /usr/bin/makeinfo --xml \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ + +} diff --git a/Scripts/Bash/Functions/Manual/manual_updateOutputFiles.sh b/Scripts/Bash/Functions/Manual/manual_updateOutputFiles.sh index 48f2d3a..9535ccb 100755 --- a/Scripts/Bash/Functions/Manual/manual_updateOutputFiles.sh +++ b/Scripts/Bash/Functions/Manual/manual_updateOutputFiles.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# manual_updateOutputFiles.sh -- This function updates manuals' related -# output files. +# manual_updateOutputFiles.sh -- This function exports documentation +# manual to different output formats. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -26,7 +26,10 @@ function manual_updateOutputFiles { - # Add division line to differentiate action output visually. + # Verify documentation manual base file structure. + cli_checkFiles ${MANUAL_BASEFILE}.texi 'f' + + # Ouput separator line. cli_printMessage '-' 'AsSeparatorLine' # Add the working copy root directory to directory stack to make @@ -36,10 +39,14 @@ function manual_updateOutputFiles { manual_updateOutputFileInfo manual_updateOutputFileHtml + manual_updateOutputFileXml manual_updateOutputFilePdf manual_updateOutputFilePlaintext # Remove the working copy root directory from directory stack. popd > /dev/null + # Output separator. + cli_printMessage "-" 'AsSeparatorLine' + }