diff --git a/Scripts/Bash/Functions/Help/help.sh b/Scripts/Bash/Functions/Help/help.sh deleted file mode 100755 index f0f33d3..0000000 --- a/Scripts/Bash/Functions/Help/help.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -# -# help.sh -- This function provides documentation features to -# centos-art.sh script. Here we initialize documentation variables and -# call help_getActions functions. -# -# Copyright (C) 2009, 2010 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 help { - - # Define documentation base directory structure. - MANUALS_DIR[0]='/home/centos/artwork/trunk/Manuals' - MANUALS_DIR[1]=${MANUALS_DIR[0]}/$(cli_getCurrentLocale) - MANUALS_DIR[2]=${MANUALS_DIR[1]}/Texinfo/Repository - MANUALS_DIR[3]=${MANUALS_DIR[1]}/Info/Repository - MANUALS_DIR[4]=${MANUALS_DIR[1]}/Html/Repository - MANUALS_DIR[5]=${MANUALS_DIR[1]}/Plaintext/Repository - - # Define template directory for texinfo files. - MANUALS_DIR[6]=${MANUALS_DIR[0]}/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 documentation entry. - ENTRY=$(help_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? - # - # 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 - # and subsub section will not have their own files, they will be - # written inside section files instead. - ENTRYCHAPTER=$(echo $ENTRY | cut -d / -f-10) - - # Define chapter name for this documentation entry. - CHAPTERNAME=$(basename $ENTRYCHAPTER) - - # Initialize documentation functions and path patterns. - help_getActions - -} diff --git a/Scripts/Bash/Functions/Help/help_checkChapter.sh b/Scripts/Bash/Functions/Help/help_checkChapter.sh deleted file mode 100755 index 6422bac..0000000 --- a/Scripts/Bash/Functions/Help/help_checkChapter.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# help_checkChapter.sh -- This function checks chapter structure. If -# it doesn't exist, create it. Inside CentOS Artwork Repository -# chapters are the base structure used to organize documentation. -# -# Copyright (C) 2009, 2010 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 help_checkChapter { - - # Check chapter's directory existence. - if [[ ! -d $ENTRYCHAPTER ]];then - - cli_printMessage "`gettext "The following documentation chapter will be created:"`" - cli_printMessage "$ENTRYCHAPTER" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - help_updateChaptersFiles - help_updateChaptersMenu - help_updateChaptersNodes - - fi - -} diff --git a/Scripts/Bash/Functions/Help/help_checkEntry.sh b/Scripts/Bash/Functions/Help/help_checkEntry.sh deleted file mode 100755 index 4ad11d0..0000000 --- a/Scripts/Bash/Functions/Help/help_checkEntry.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# help_checkEntry.sh -- This function checks the documentation entry -# existence. -# -# Copyright (C) 2009, 2010 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 help_checkEntry { - - # Check entry to edit and create it if it doesn't exist. - if [[ ! -f $ENTRY ]];then - - cli_printMessage "`gettext "The following documentation section will be created:"`" - cli_printMessage "$ENTRY" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - help_createEntry - - fi - -} diff --git a/Scripts/Bash/Functions/Help/help_checkLanguageLayout.sh b/Scripts/Bash/Functions/Help/help_checkLanguageLayout.sh deleted file mode 100755 index e75b9e4..0000000 --- a/Scripts/Bash/Functions/Help/help_checkLanguageLayout.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# help_checkLanguageLayout.sh -- This function checks the language -# layout used to store texinfo documentation inside CentOS Artwork -# Repository. If the language layout doesn't exists inside the -# documentation structure, ask the user to create it. -# -# Copyright (C) 2009, 2010 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 help_checkLanguageLayout { - - if [[ ! -d ${MANUALS_DIR[2]} ]];then - - cli_printMessage "`gettext "The following documentation entry will be created:"`" - cli_printMessage "${MANUALS_DIR[2]}" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - help_createLanguageLayout - cli_commitRepoChanges - - fi - -} diff --git a/Scripts/Bash/Functions/Help/help_createEntry.sh b/Scripts/Bash/Functions/Help/help_createEntry.sh deleted file mode 100755 index 820ffc5..0000000 --- a/Scripts/Bash/Functions/Help/help_createEntry.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# help_createEntry.sh -- This function creates a new documentation -# entry based on action value (ACTIONVAL). -# -# Copyright (C) 2009, 2010 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 help_createEntry { - - # Check chapter structure for this entry. - help_checkChapter - - # Update chapter-menu for this entry. - help_updateMenu - - # Update chapter-nodes (based on chapter-menu). - help_updateNodes - -} diff --git a/Scripts/Bash/Functions/Help/help_createLanguageLayout.sh b/Scripts/Bash/Functions/Help/help_createLanguageLayout.sh deleted file mode 100755 index a194ad8..0000000 --- a/Scripts/Bash/Functions/Help/help_createLanguageLayout.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# -# help_createLanguageLayout.sh -- This function creates texinfo's main -# documentation structure for an specific language. -# -# Copyright (C) 2009, 2010 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. -# -# ---------------------------------------------------------------------- - -function help_createLanguageLayout { - - # Define variables as local to avoid conflicts outside - local COUNTER=0 - local MESSAGE='' - - # Initialize translation markers for texinfo manual template. - local DOCTPL[0]="`gettext "Set the document's title"`" - local DOCTPL[1]="`gettext "Set the document's subtitle"`" - local DOCTPL[2]="`gettext "Set the document's description"`" - local DOCTPL[3]="`gettext "Set the document's author"`" - - # Request texinfo document initial information. Since the main - # texinfo documentation file (repository.texi) requires language - # specific values (e.g., document title, subtitle, description, - # author, etc.) before they can be used, there is no way to create - # those files automatically without requesting the user for those - # initial information on his/her own language. The requesting - # process is done in English language. - for MESSAGE in "${DOCTPL[@]}";do - cli_printMessage "`gettext "Step"` ${COUNTER}: $MESSAGE:" "AsRequestLine" - read DOCTPL[${COUNTER}] - if [[ ! $DOCTPL[${COUNTER}] =~ '[[:print:]]+' ]];then - cli_printMessage "`gettext "The string entered isn't valid."`" - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - COUNTER=$(($COUNTER + 1)) - done - - # At this point all information required to build texinfo document - # has been collected. Leave a message and start creating texinfo - # files based on template. - local LANGNAME=$(cli_getLangName $(cli_getCurrentLocale)) - - # Create language directory to store texinfo document structure. - if [[ ! -d ${MANUALS_DIR[2]} ]];then - mkdir -p ${MANUALS_DIR[2]} - fi - - # Fill texinfo template with entered values and store the result - # as new texinfo document structure. - cat ${MANUALS_DIR[6]}/repository.texi \ - | sed -r "s!=TITLE=!${DOCTPL[0]}!g" \ - | sed -r "s!=SUBTITLE=!${DOCTPL[1]}!g" \ - | sed -r "s!=DESCRIPTION=!${DOCTPL[2]}!g" \ - | sed -r "s!=AUTHOR=!${DOCTPL[3]}!g" \ - | sed -r "s!=LANGUAGE=!$(cli_getLangCodes $(cli_getCurrentLocale))!g" \ - > ${MANUALS_DIR[2]}/repository.texi - - # Copy menu and nodes from template to texinfo document structure. - cp ${MANUALS_DIR[6]}/$(basename ${MANUALS_FILE[2]}) ${MANUALS_DIR[2]}/ - cp ${MANUALS_DIR[6]}/$(basename ${MANUALS_FILE[3]}) ${MANUALS_DIR[2]}/ - cp ${MANUALS_DIR[6]}/$(basename ${MANUALS_FILE[11]}) ${MANUALS_DIR[2]}/ - - # Translate English words. As we are creating texinfo - # documentation from an English template, it is needed to - # translate some words from English to the current language we are - # creating texinfo documentation for. - sed -r -i "s!Index!`gettext "Index"`!" ${MANUALS_FILE[11]} ${MANUALS_FILE[2]} - - # Output action message. - cli_printMessage "`eval_gettext "The \\\"\\\$LANGNAME\\\" documentation structure has been created."`" - -} diff --git a/Scripts/Bash/Functions/Help/help_editEntry.sh b/Scripts/Bash/Functions/Help/help_editEntry.sh deleted file mode 100755 index faa3d03..0000000 --- a/Scripts/Bash/Functions/Help/help_editEntry.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# help_editEntry.sh -- This function edits documentation entry based -# on entry pattern. -# -# Copyright (C) 2009, 2010 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 help_editEntry { - - # Check chapter existence. In order to create/edit a section the - # chapter of that section needs to exist first. If the chapter - # hasn't been created, where are you going to store the section - # files? Put the chapter's checker here. - help_checkChapter - - # Check section existence. - help_checkEntry - - # Use default text editor to edit the documentation entry. - eval $EDITOR $ENTRY - - # Re-build output files to propagate recent changes. - help_updateOutputFiles - -} diff --git a/Scripts/Bash/Functions/Help/help_getActions.sh b/Scripts/Bash/Functions/Help/help_getActions.sh deleted file mode 100755 index 0316987..0000000 --- a/Scripts/Bash/Functions/Help/help_getActions.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# help_getActions.sh -- This function initializes documentation -# functionalities, using action value as reference. -# -# Copyright (C) 2009, 2010 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 help_getActions { - - help_checkLanguageLayout - - case $ACTIONNAM in - - --search ) - help_searchIndex - ;; - - --edit ) - help_editEntry - ;; - - --remove ) - help_removeEntry - ;; - - --update ) - help_updateOutputFiles - ;; - - --read ) - help_searchNode - ;; - - * ) - cli_printMessage "`gettext "The option provided is not valid."`" - cli_printMessage "$(caller)" "AsToKnowMoreLine" - ;; - - esac - -} diff --git a/Scripts/Bash/Functions/Help/help_getEntry.sh b/Scripts/Bash/Functions/Help/help_getEntry.sh deleted file mode 100755 index 5b83bd4..0000000 --- a/Scripts/Bash/Functions/Help/help_getEntry.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# -# help_getEntry.sh -- This function builds a documentation entry based -# on action value (ACTIONVAL) variable. -# -# Copyright (C) 2009, 2010 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 help_getEntry { - - # Define variables as local to avoid conflicts outside. - local DIR='' - local FILE='' - local ENTRY='' - - # Build directory for documenation entry. - DIR=$(echo $ACTIONVAL | sed -r 's!^/home/centos/artwork/!!') - DIR=$(dirname $DIR) - DIR=${MANUALS_DIR[2]}/$DIR - - # Build file for documentation entry. - FILE=$(basename $ACTIONVAL).texi - - # 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 dirname 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 documentation entry if it is the chapter entry. - # 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]}/") - fi - - # Output entry's absolute path. - echo $ENTRY - -} diff --git a/Scripts/Bash/Functions/Help/help_getNode.sh b/Scripts/Bash/Functions/Help/help_getNode.sh deleted file mode 100755 index 8799ba4..0000000 --- a/Scripts/Bash/Functions/Help/help_getNode.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# help_getNode.sh -- This function cleans up the action value -# (ACTIONVAL) directory to make a node name from it. -# -# Copyright (C) 2009, 2010 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 help_getNode { - - local NODE=$(echo "$ACTIONVAL" \ - | sed -r 's!^/home/centos/artwork/!!' \ - | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') - - echo "$NODE" -} - diff --git a/Scripts/Bash/Functions/Help/help_removeEntry.sh b/Scripts/Bash/Functions/Help/help_removeEntry.sh deleted file mode 100755 index 6dc779d..0000000 --- a/Scripts/Bash/Functions/Help/help_removeEntry.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -# -# help_removeEntry.sh -- This function removes a documentation entry -# from your working copy documentation structure. -# -# Copyright (C) 2009, 2010 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 help_removeEntry { - - # Define variables as local to avoid conflicts outside. - local ENTRIES='' - local ENTRIES_COUNTER=0 - local LOCATION='' - - # Check if the entry has been already removed. - if [[ ! -f $ENTRY ]];then - cli_printMessage "`gettext "The following entry doesn't exist:"`" - cli_printMessage "$ENTRY" "AsResponseLine" - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - - # 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$!!') - - # Re-define 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 help --remove=/home/centos/artwork/trunk/). - if [[ $ENTRY =~ "${MANUALS_FILE[7]}$" ]];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. - if [[ -d $LOCATION ]];then - for ENTRY in $(find $LOCATION -name '*.texi');do - ENTRIES="$ENTRIES $ENTRY $(dirname $ENTRY)" - ENTRIES_COUNTER=$(($ENTRIES_COUNTER + 1)) - done - fi - - # Remove duplicated lines from entries list. - ENTRIES=$(echo "$ENTRIES" | tr ' ' "\n" | sort -r | uniq) - - # Show a verification message before doing anything. - cli_printMessage "`ngettext "The following entry will be removed:" \ - "The following entries will be removed:" \ - $ENTRIES_COUNTER`" - - # Show list of affected entries. - for ENTRY in $ENTRIES;do - cli_printMessage "$ENTRY" "AsResponseLine" - done - - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - # Re-define ENTRY using affected entries as reference. - for ENTRY in $ENTRIES;do - - # Show which entry is being removed. - cli_printMessage "$ENTRY" "AsRemovingLine" - - # Remove documentation entry. At this point, documentation - # 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 - - # Documentation entry is under version control and clean - # of changes. Only if documentation entry is clean of - # changes we can mark it for deletion. So use subversion's - # `del' command to do so. - eval svn del "$ENTRY" --quiet - - elif [[ "$(cli_getRepoStatus "$ENTRY")" == '?' ]] \ - || [[ "$(cli_getRepoStatus "$ENTRY")" == '' ]] ;then - - # Documentation entry is not under version control, so we - # don't care about changes inside unversioned - # documentation entries at all. If you say centos-art.sh - # script to remove an unversion documentation entry it - # will do so, using convenctional `rm' command. - if [[ -d "$ENTRY" ]];then - rm -r "$ENTRY" - else - rm "$ENTRY" - fi - - else - - # Documentation entry is under version control and it does - # have changes. We don't remove a versioned documentation - # entry with changes. So print a message about it and stop - # script execution. - cli_printMessage "`gettext "The documentation entry cannot be removed."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - - fi - - # Update section's menu and nodes to reflect the fact that - # documentation entry has been removed. - help_updateMenu "remove-entry" - help_updateNodes - - done - - # 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 - help_updateChaptersMenu 'remove-entry' - help_updateChaptersNodes - fi - - # Update manuals' related output files. - help_updateOutputFiles - -} diff --git a/Scripts/Bash/Functions/Help/help_searchIndex.sh b/Scripts/Bash/Functions/Help/help_searchIndex.sh deleted file mode 100644 index c18db53..0000000 --- a/Scripts/Bash/Functions/Help/help_searchIndex.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# -# help_searchIndex.sh -- This function does an index search inside the -# info document. -# -# Copyright (C) 2009, 2010 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 help_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]} - -} diff --git a/Scripts/Bash/Functions/Help/help_searchNode.sh b/Scripts/Bash/Functions/Help/help_searchNode.sh deleted file mode 100755 index 0b20a6c..0000000 --- a/Scripts/Bash/Functions/Help/help_searchNode.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# help_searchNode.sh -- This function does a node search inside the -# info document. -# -# Copyright (C) 2009, 2010 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 help_searchNode { - - # Check entry inside documentation structure. If the entry - # 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="$(help_getNode)" --file=${MANUALS_FILE[4]} - else - help_editEntry - fi - -} diff --git a/Scripts/Bash/Functions/Help/help_updateChaptersFiles.sh b/Scripts/Bash/Functions/Help/help_updateChaptersFiles.sh deleted file mode 100755 index d857e36..0000000 --- a/Scripts/Bash/Functions/Help/help_updateChaptersFiles.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# help_updateChaptersFiles.sh -- This function updates chapter related -# files. -# -# Copyright (C) 2009, 2010 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 help_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]}" - - # 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 - 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]} - - # 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]} -} diff --git a/Scripts/Bash/Functions/Help/help_updateChaptersMenu.sh b/Scripts/Bash/Functions/Help/help_updateChaptersMenu.sh deleted file mode 100755 index d3a61b4..0000000 --- a/Scripts/Bash/Functions/Help/help_updateChaptersMenu.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# help_updateChaptersMenu.sh - This function updates chapter menu. -# -# Copyright (C) 2009, 2010 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 help_updateChaptersMenu { - - local ACTION=$1 - local MENUCHAPTERS='' - - # Build menu of chapters. The Index node is not included as other - # nodes are. The Index node is defined insde the master texinfo - # 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"`::.*)$") - 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:]]*$") - ;; - 'update-entry' | * ) - # Update chapter menu using texinfo format. - MENUCHAPTERS="$MENUCHAPTERS - * $CHAPTERNAME::" - ;; - 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:]]+!!' \ - | egrep -v '^[[:space:]]*$') - - # Organize menu of chapters alphabetically and verify that no - # duplicated line be included on the list. - MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sort | uniq ) - - # Give format to final menu output. - MENUCHAPTERS="@menu - $MENUCHAPTERS - * `gettext "Index"`:: - @end menu" - - # Strip opening space/tabs from final menu of chapters. - MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sed -r 's!^[[:space:]]+!!' \ - | egrep -v '^[[:space:]]*$') - - # Dump organized menu of chapters into file. - echo "$MENUCHAPTERS" > ${MANUALS_FILE[2]} - -} diff --git a/Scripts/Bash/Functions/Help/help_updateChaptersNodes.sh b/Scripts/Bash/Functions/Help/help_updateChaptersNodes.sh deleted file mode 100755 index 2459151..0000000 --- a/Scripts/Bash/Functions/Help/help_updateChaptersNodes.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# help_updateChaptersNodes.sh - This function updates nodes of -# chapters based on menu of chapters. -# -# Copyright (C) 2009, 2010 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 help_updateChaptersNodes { - - # Build list "nodes of chapters" based on menu of chapters. - local CHAPTERNODES=$(cat ${MANUALS_FILE[2]} \ - | egrep -v '^@(end )?menu$' \ - | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ - | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ - | sed -r 's! !_!g' | sort | uniq ) - - # Build list of texinfo inclusions to load chapters' nodes. - local FILENODE=$(\ - for CHAPTERNODE in $CHAPTERNODES;do - - INCL=$(echo $CHAPTERNODE | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") - - # Output inclusion line using texinfo format. - echo "@include $INCL" - - done) - - # Dump organized nodes of chapters into file. - echo "$FILENODE" > ${MANUALS_FILE[3]} - -} diff --git a/Scripts/Bash/Functions/Help/help_updateMenu.sh b/Scripts/Bash/Functions/Help/help_updateMenu.sh deleted file mode 100755 index 625a04d..0000000 --- a/Scripts/Bash/Functions/Help/help_updateMenu.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -# -# help_updateMenu.sh -- This function updates menu lines inside -# texinfo chapters. If this function is called with the -# 'remove-entry' string as first argument, then the menu line related -# to the entry being processed is removed. If this function is called -# with the 'update-entry' string as first argument, then the menu line -# related to the entry being processed is added to the menu. If no -# argument is passed to this function, the 'update-entry' action is -# assumed. -# -# Copyright (C) 2009, 2010 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 help_updateMenu { - - # Specify which action to do inside chapter's menu. - local ACTION="$1" - - # Build the menu line related to the entry being processed - # currently. - local MENULINE=$(echo "$ENTRY" \ - | cut -d / -f10- \ - | tr '/' ' ' \ - | sed -r "s/(${MANUALS_FILE[7]}|\.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]} \ - | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') - - # Re-defined chapter's menu based on action. - case $ACTION in - 'remove-entry' ) - # Remove menu line from chapter's menu. - MENU=$(echo "$MENU" | egrep -v "$MENULINE") - ;; - 'update-entry' | * ) - # Add menu line to chapter's menu. This is the default - # behaivour if no argument is passed to help_updateMenu - # function. - MENU="$MENU - $MENULINE" - ;; - esac - - # Organize menu alphabetically, remove empty and duplicated lines. - # At this point, empty line may occur the first time the menu is - # created, don't let them to scape. - MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$' | sort | uniq ) - - # Rebuild chapter's menu structure adding '@menu' and '@end menu' - # lines back in menu. - MENU="@menu - $MENU - @end menu" - - # Remove opening spaces/tabs from final menu structure. - MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') - - # Dump final menu structure back into chapter's menu file. - echo "$MENU" > $ENTRYCHAPTER/${MANUALS_FILE[8]} - -} diff --git a/Scripts/Bash/Functions/Help/help_updateNodes.sh b/Scripts/Bash/Functions/Help/help_updateNodes.sh deleted file mode 100755 index 4e127ea..0000000 --- a/Scripts/Bash/Functions/Help/help_updateNodes.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# -# help_updateNodes.sh -- This function updates chapter's nodes -# definition using the chapter's menu as reference. -# -# Copyright (C) 2009, 2010 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 help_updateNodes { - - # Retrive nodes' entries from chapter-menu.texi file. - local NODES=$(cat $ENTRYCHAPTER/${MANUALS_FILE[8]} \ - | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ - | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) - - # Re-build node structure based on menu information. - for NODE in $NODES;do - - NODE=$(echo $NODE | sed -r 's!:! !g') - SECT=$(echo $NODE | sed -r 's! !/!g') - 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) - 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 - - fi - - # Output node information based on texinfo menu. - echo "@node $NODE" - echo "@section $SECT" - echo "@cindex $CIND" - echo "@include $INCL" - echo "" - - # Dump node information into chapter node file. - done > $ENTRYCHAPTER/${MANUALS_FILE[9]} - -} - diff --git a/Scripts/Bash/Functions/Help/help_updateOutputFileHtml.sh b/Scripts/Bash/Functions/Help/help_updateOutputFileHtml.sh deleted file mode 100755 index ef961a4..0000000 --- a/Scripts/Bash/Functions/Help/help_updateOutputFileHtml.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFileHtml.sh -- This function updates manuals' html -# related output files. -# -# Copyright (C) 2009, 2010 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 help_updateOutputFileHtml { - - # Output action message - cli_printMessage "`gettext "Updating manual's html output"`" 'AsResponseLine' - - # Check html output directory - [[ ! -d ${MANUALS_DIR[4]} ]] && mkdir -p ${MANUALS_DIR[4]} - - # 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 - - # 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 \ - --nosec-nav \ - --css-include=/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ - -I=/home/centos/artwork - - # Apply html transformations. Html transformations rely on - # Texi2html default html output. The main goal of these html - # transformations is to build specific html structures that match - # specific css definitions. This way we extend the visual style of - # Texi2html default html output. - sed -r -i \ - -f /home/centos/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ - ${MANUALS_DIR[4]}/*.html - - # Remove html output directory from directory stack. - popd > /dev/null - -} diff --git a/Scripts/Bash/Functions/Help/help_updateOutputFileInfo.sh b/Scripts/Bash/Functions/Help/help_updateOutputFileInfo.sh deleted file mode 100755 index 43f7951..0000000 --- a/Scripts/Bash/Functions/Help/help_updateOutputFileInfo.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFileInfo.sh -- This function updates manual's info -# output related file. -# -# Copyright (C) 2009, 2010 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 help_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]} - - # 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 - - # Compress info file. - bzip2 -f ${MANUALS_FILE[4]} - -} diff --git a/Scripts/Bash/Functions/Help/help_updateOutputFilePlaintext.sh b/Scripts/Bash/Functions/Help/help_updateOutputFilePlaintext.sh deleted file mode 100755 index b6bdb1b..0000000 --- a/Scripts/Bash/Functions/Help/help_updateOutputFilePlaintext.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFilePlaintext.sh -- This function updates manuals' -# plaintext related output file. -# -# Copyright (C) 2009, 2010 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 help_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]} - - # Update plaintext output directory. - /usr/bin/makeinfo ${MANUALS_FILE[1]} --output=${MANUALS_FILE[5]} \ - --plaintext - -} diff --git a/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh b/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh deleted file mode 100755 index 6a95ed0..0000000 --- a/Scripts/Bash/Functions/Help/help_updateOutputFiles.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFiles.sh -- This function updates manuals' related -# output files. -# -# Copyright (C) 2009, 2010 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 help_updateOutputFiles { - - # Add division line to differentiate action output visually. - echo '----------------------------------------------------------------------' - - # Add the working copy root directory to directory stack to make - # path construction correctly. Otherwise, makeinfo may produce - # paths incorrectly. - pushd /home/centos/artwork > /dev/null - - help_updateOutputFileInfo - help_updateOutputFileHtml - help_updateOutputFilePlaintext - - # Remove the working copy root directory from directory stack. - popd > /dev/null - - # Re-define output variable in order for cli_commitRepoChanges - # functionality to receive the correct location to apply - # subversion commands. Inside `help' functionality, the correct - # place to commit changes is not the initial value of ACTIONVAL - # but the directory path where documentation changes take place - # under. - ACTIONVAL=${MANUALS_DIR[0]} - - # Update central repository. Be sure this is the last action - # you perform inside centos-art.sh script flow. - cli_commitRepoChanges - -} diff --git a/Scripts/Bash/Functions/Manual/help.sh b/Scripts/Bash/Functions/Manual/help.sh new file mode 100755 index 0000000..f0f33d3 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# help.sh -- This function provides documentation features to +# centos-art.sh script. Here we initialize documentation variables and +# call help_getActions functions. +# +# Copyright (C) 2009, 2010 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 help { + + # Define documentation base directory structure. + MANUALS_DIR[0]='/home/centos/artwork/trunk/Manuals' + MANUALS_DIR[1]=${MANUALS_DIR[0]}/$(cli_getCurrentLocale) + MANUALS_DIR[2]=${MANUALS_DIR[1]}/Texinfo/Repository + MANUALS_DIR[3]=${MANUALS_DIR[1]}/Info/Repository + MANUALS_DIR[4]=${MANUALS_DIR[1]}/Html/Repository + MANUALS_DIR[5]=${MANUALS_DIR[1]}/Plaintext/Repository + + # Define template directory for texinfo files. + MANUALS_DIR[6]=${MANUALS_DIR[0]}/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 documentation entry. + ENTRY=$(help_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? + # + # 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 + # and subsub section will not have their own files, they will be + # written inside section files instead. + ENTRYCHAPTER=$(echo $ENTRY | cut -d / -f-10) + + # Define chapter name for this documentation entry. + CHAPTERNAME=$(basename $ENTRYCHAPTER) + + # Initialize documentation functions and path patterns. + help_getActions + +} diff --git a/Scripts/Bash/Functions/Manual/help_checkChapter.sh b/Scripts/Bash/Functions/Manual/help_checkChapter.sh new file mode 100755 index 0000000..6422bac --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_checkChapter.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# help_checkChapter.sh -- This function checks chapter structure. If +# it doesn't exist, create it. Inside CentOS Artwork Repository +# chapters are the base structure used to organize documentation. +# +# Copyright (C) 2009, 2010 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 help_checkChapter { + + # Check chapter's directory existence. + if [[ ! -d $ENTRYCHAPTER ]];then + + cli_printMessage "`gettext "The following documentation chapter will be created:"`" + cli_printMessage "$ENTRYCHAPTER" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + help_updateChaptersFiles + help_updateChaptersMenu + help_updateChaptersNodes + + fi + +} diff --git a/Scripts/Bash/Functions/Manual/help_checkEntry.sh b/Scripts/Bash/Functions/Manual/help_checkEntry.sh new file mode 100755 index 0000000..4ad11d0 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_checkEntry.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# help_checkEntry.sh -- This function checks the documentation entry +# existence. +# +# Copyright (C) 2009, 2010 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 help_checkEntry { + + # Check entry to edit and create it if it doesn't exist. + if [[ ! -f $ENTRY ]];then + + cli_printMessage "`gettext "The following documentation section will be created:"`" + cli_printMessage "$ENTRY" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + help_createEntry + + fi + +} diff --git a/Scripts/Bash/Functions/Manual/help_checkLanguageLayout.sh b/Scripts/Bash/Functions/Manual/help_checkLanguageLayout.sh new file mode 100755 index 0000000..e75b9e4 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_checkLanguageLayout.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# help_checkLanguageLayout.sh -- This function checks the language +# layout used to store texinfo documentation inside CentOS Artwork +# Repository. If the language layout doesn't exists inside the +# documentation structure, ask the user to create it. +# +# Copyright (C) 2009, 2010 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 help_checkLanguageLayout { + + if [[ ! -d ${MANUALS_DIR[2]} ]];then + + cli_printMessage "`gettext "The following documentation entry will be created:"`" + cli_printMessage "${MANUALS_DIR[2]}" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + help_createLanguageLayout + cli_commitRepoChanges + + fi + +} diff --git a/Scripts/Bash/Functions/Manual/help_createEntry.sh b/Scripts/Bash/Functions/Manual/help_createEntry.sh new file mode 100755 index 0000000..820ffc5 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_createEntry.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# help_createEntry.sh -- This function creates a new documentation +# entry based on action value (ACTIONVAL). +# +# Copyright (C) 2009, 2010 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 help_createEntry { + + # Check chapter structure for this entry. + help_checkChapter + + # Update chapter-menu for this entry. + help_updateMenu + + # Update chapter-nodes (based on chapter-menu). + help_updateNodes + +} diff --git a/Scripts/Bash/Functions/Manual/help_createLanguageLayout.sh b/Scripts/Bash/Functions/Manual/help_createLanguageLayout.sh new file mode 100755 index 0000000..a194ad8 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_createLanguageLayout.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# help_createLanguageLayout.sh -- This function creates texinfo's main +# documentation structure for an specific language. +# +# Copyright (C) 2009, 2010 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. +# +# ---------------------------------------------------------------------- + +function help_createLanguageLayout { + + # Define variables as local to avoid conflicts outside + local COUNTER=0 + local MESSAGE='' + + # Initialize translation markers for texinfo manual template. + local DOCTPL[0]="`gettext "Set the document's title"`" + local DOCTPL[1]="`gettext "Set the document's subtitle"`" + local DOCTPL[2]="`gettext "Set the document's description"`" + local DOCTPL[3]="`gettext "Set the document's author"`" + + # Request texinfo document initial information. Since the main + # texinfo documentation file (repository.texi) requires language + # specific values (e.g., document title, subtitle, description, + # author, etc.) before they can be used, there is no way to create + # those files automatically without requesting the user for those + # initial information on his/her own language. The requesting + # process is done in English language. + for MESSAGE in "${DOCTPL[@]}";do + cli_printMessage "`gettext "Step"` ${COUNTER}: $MESSAGE:" "AsRequestLine" + read DOCTPL[${COUNTER}] + if [[ ! $DOCTPL[${COUNTER}] =~ '[[:print:]]+' ]];then + cli_printMessage "`gettext "The string entered isn't valid."`" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + COUNTER=$(($COUNTER + 1)) + done + + # At this point all information required to build texinfo document + # has been collected. Leave a message and start creating texinfo + # files based on template. + local LANGNAME=$(cli_getLangName $(cli_getCurrentLocale)) + + # Create language directory to store texinfo document structure. + if [[ ! -d ${MANUALS_DIR[2]} ]];then + mkdir -p ${MANUALS_DIR[2]} + fi + + # Fill texinfo template with entered values and store the result + # as new texinfo document structure. + cat ${MANUALS_DIR[6]}/repository.texi \ + | sed -r "s!=TITLE=!${DOCTPL[0]}!g" \ + | sed -r "s!=SUBTITLE=!${DOCTPL[1]}!g" \ + | sed -r "s!=DESCRIPTION=!${DOCTPL[2]}!g" \ + | sed -r "s!=AUTHOR=!${DOCTPL[3]}!g" \ + | sed -r "s!=LANGUAGE=!$(cli_getLangCodes $(cli_getCurrentLocale))!g" \ + > ${MANUALS_DIR[2]}/repository.texi + + # Copy menu and nodes from template to texinfo document structure. + cp ${MANUALS_DIR[6]}/$(basename ${MANUALS_FILE[2]}) ${MANUALS_DIR[2]}/ + cp ${MANUALS_DIR[6]}/$(basename ${MANUALS_FILE[3]}) ${MANUALS_DIR[2]}/ + cp ${MANUALS_DIR[6]}/$(basename ${MANUALS_FILE[11]}) ${MANUALS_DIR[2]}/ + + # Translate English words. As we are creating texinfo + # documentation from an English template, it is needed to + # translate some words from English to the current language we are + # creating texinfo documentation for. + sed -r -i "s!Index!`gettext "Index"`!" ${MANUALS_FILE[11]} ${MANUALS_FILE[2]} + + # Output action message. + cli_printMessage "`eval_gettext "The \\\"\\\$LANGNAME\\\" documentation structure has been created."`" + +} diff --git a/Scripts/Bash/Functions/Manual/help_editEntry.sh b/Scripts/Bash/Functions/Manual/help_editEntry.sh new file mode 100755 index 0000000..faa3d03 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_editEntry.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# help_editEntry.sh -- This function edits documentation entry based +# on entry pattern. +# +# Copyright (C) 2009, 2010 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 help_editEntry { + + # Check chapter existence. In order to create/edit a section the + # chapter of that section needs to exist first. If the chapter + # hasn't been created, where are you going to store the section + # files? Put the chapter's checker here. + help_checkChapter + + # Check section existence. + help_checkEntry + + # Use default text editor to edit the documentation entry. + eval $EDITOR $ENTRY + + # Re-build output files to propagate recent changes. + help_updateOutputFiles + +} diff --git a/Scripts/Bash/Functions/Manual/help_getActions.sh b/Scripts/Bash/Functions/Manual/help_getActions.sh new file mode 100755 index 0000000..0316987 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_getActions.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# help_getActions.sh -- This function initializes documentation +# functionalities, using action value as reference. +# +# Copyright (C) 2009, 2010 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 help_getActions { + + help_checkLanguageLayout + + case $ACTIONNAM in + + --search ) + help_searchIndex + ;; + + --edit ) + help_editEntry + ;; + + --remove ) + help_removeEntry + ;; + + --update ) + help_updateOutputFiles + ;; + + --read ) + help_searchNode + ;; + + * ) + cli_printMessage "`gettext "The option provided is not valid."`" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + ;; + + esac + +} diff --git a/Scripts/Bash/Functions/Manual/help_getEntry.sh b/Scripts/Bash/Functions/Manual/help_getEntry.sh new file mode 100755 index 0000000..5b83bd4 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_getEntry.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# +# help_getEntry.sh -- This function builds a documentation entry based +# on action value (ACTIONVAL) variable. +# +# Copyright (C) 2009, 2010 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 help_getEntry { + + # Define variables as local to avoid conflicts outside. + local DIR='' + local FILE='' + local ENTRY='' + + # Build directory for documenation entry. + DIR=$(echo $ACTIONVAL | sed -r 's!^/home/centos/artwork/!!') + DIR=$(dirname $DIR) + DIR=${MANUALS_DIR[2]}/$DIR + + # Build file for documentation entry. + FILE=$(basename $ACTIONVAL).texi + + # 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 dirname 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 documentation entry if it is the chapter entry. + # 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]}/") + fi + + # Output entry's absolute path. + echo $ENTRY + +} diff --git a/Scripts/Bash/Functions/Manual/help_getNode.sh b/Scripts/Bash/Functions/Manual/help_getNode.sh new file mode 100755 index 0000000..8799ba4 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_getNode.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# help_getNode.sh -- This function cleans up the action value +# (ACTIONVAL) directory to make a node name from it. +# +# Copyright (C) 2009, 2010 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 help_getNode { + + local NODE=$(echo "$ACTIONVAL" \ + | sed -r 's!^/home/centos/artwork/!!' \ + | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') + + echo "$NODE" +} + diff --git a/Scripts/Bash/Functions/Manual/help_removeEntry.sh b/Scripts/Bash/Functions/Manual/help_removeEntry.sh new file mode 100755 index 0000000..6dc779d --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_removeEntry.sh @@ -0,0 +1,143 @@ +#!/bin/bash +# +# help_removeEntry.sh -- This function removes a documentation entry +# from your working copy documentation structure. +# +# Copyright (C) 2009, 2010 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 help_removeEntry { + + # Define variables as local to avoid conflicts outside. + local ENTRIES='' + local ENTRIES_COUNTER=0 + local LOCATION='' + + # Check if the entry has been already removed. + if [[ ! -f $ENTRY ]];then + cli_printMessage "`gettext "The following entry doesn't exist:"`" + cli_printMessage "$ENTRY" "AsResponseLine" + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + + # 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$!!') + + # Re-define 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 help --remove=/home/centos/artwork/trunk/). + if [[ $ENTRY =~ "${MANUALS_FILE[7]}$" ]];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. + if [[ -d $LOCATION ]];then + for ENTRY in $(find $LOCATION -name '*.texi');do + ENTRIES="$ENTRIES $ENTRY $(dirname $ENTRY)" + ENTRIES_COUNTER=$(($ENTRIES_COUNTER + 1)) + done + fi + + # Remove duplicated lines from entries list. + ENTRIES=$(echo "$ENTRIES" | tr ' ' "\n" | sort -r | uniq) + + # Show a verification message before doing anything. + cli_printMessage "`ngettext "The following entry will be removed:" \ + "The following entries will be removed:" \ + $ENTRIES_COUNTER`" + + # Show list of affected entries. + for ENTRY in $ENTRIES;do + cli_printMessage "$ENTRY" "AsResponseLine" + done + + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + # Re-define ENTRY using affected entries as reference. + for ENTRY in $ENTRIES;do + + # Show which entry is being removed. + cli_printMessage "$ENTRY" "AsRemovingLine" + + # Remove documentation entry. At this point, documentation + # 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 + + # Documentation entry is under version control and clean + # of changes. Only if documentation entry is clean of + # changes we can mark it for deletion. So use subversion's + # `del' command to do so. + eval svn del "$ENTRY" --quiet + + elif [[ "$(cli_getRepoStatus "$ENTRY")" == '?' ]] \ + || [[ "$(cli_getRepoStatus "$ENTRY")" == '' ]] ;then + + # Documentation entry is not under version control, so we + # don't care about changes inside unversioned + # documentation entries at all. If you say centos-art.sh + # script to remove an unversion documentation entry it + # will do so, using convenctional `rm' command. + if [[ -d "$ENTRY" ]];then + rm -r "$ENTRY" + else + rm "$ENTRY" + fi + + else + + # Documentation entry is under version control and it does + # have changes. We don't remove a versioned documentation + # entry with changes. So print a message about it and stop + # script execution. + cli_printMessage "`gettext "The documentation entry cannot be removed."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + + fi + + # Update section's menu and nodes to reflect the fact that + # documentation entry has been removed. + help_updateMenu "remove-entry" + help_updateNodes + + done + + # 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 + help_updateChaptersMenu 'remove-entry' + help_updateChaptersNodes + fi + + # Update manuals' related output files. + help_updateOutputFiles + +} diff --git a/Scripts/Bash/Functions/Manual/help_searchIndex.sh b/Scripts/Bash/Functions/Manual/help_searchIndex.sh new file mode 100644 index 0000000..c18db53 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_searchIndex.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# help_searchIndex.sh -- This function does an index search inside the +# info document. +# +# Copyright (C) 2009, 2010 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 help_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]} + +} diff --git a/Scripts/Bash/Functions/Manual/help_searchNode.sh b/Scripts/Bash/Functions/Manual/help_searchNode.sh new file mode 100755 index 0000000..0b20a6c --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_searchNode.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# help_searchNode.sh -- This function does a node search inside the +# info document. +# +# Copyright (C) 2009, 2010 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 help_searchNode { + + # Check entry inside documentation structure. If the entry + # 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="$(help_getNode)" --file=${MANUALS_FILE[4]} + else + help_editEntry + fi + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateChaptersFiles.sh b/Scripts/Bash/Functions/Manual/help_updateChaptersFiles.sh new file mode 100755 index 0000000..d857e36 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateChaptersFiles.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# help_updateChaptersFiles.sh -- This function updates chapter related +# files. +# +# Copyright (C) 2009, 2010 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 help_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]}" + + # 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 + 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]} + + # 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]} +} diff --git a/Scripts/Bash/Functions/Manual/help_updateChaptersMenu.sh b/Scripts/Bash/Functions/Manual/help_updateChaptersMenu.sh new file mode 100755 index 0000000..d3a61b4 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateChaptersMenu.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# help_updateChaptersMenu.sh - This function updates chapter menu. +# +# Copyright (C) 2009, 2010 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 help_updateChaptersMenu { + + local ACTION=$1 + local MENUCHAPTERS='' + + # Build menu of chapters. The Index node is not included as other + # nodes are. The Index node is defined insde the master texinfo + # 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"`::.*)$") + 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:]]*$") + ;; + 'update-entry' | * ) + # Update chapter menu using texinfo format. + MENUCHAPTERS="$MENUCHAPTERS + * $CHAPTERNAME::" + ;; + 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:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Organize menu of chapters alphabetically and verify that no + # duplicated line be included on the list. + MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sort | uniq ) + + # Give format to final menu output. + MENUCHAPTERS="@menu + $MENUCHAPTERS + * `gettext "Index"`:: + @end menu" + + # Strip opening space/tabs from final menu of chapters. + MENUCHAPTERS=$(echo "$MENUCHAPTERS" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Dump organized menu of chapters into file. + echo "$MENUCHAPTERS" > ${MANUALS_FILE[2]} + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateChaptersNodes.sh b/Scripts/Bash/Functions/Manual/help_updateChaptersNodes.sh new file mode 100755 index 0000000..2459151 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateChaptersNodes.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# help_updateChaptersNodes.sh - This function updates nodes of +# chapters based on menu of chapters. +# +# Copyright (C) 2009, 2010 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 help_updateChaptersNodes { + + # Build list "nodes of chapters" based on menu of chapters. + local CHAPTERNODES=$(cat ${MANUALS_FILE[2]} \ + | egrep -v '^@(end )?menu$' \ + | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ + | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ + | sed -r 's! !_!g' | sort | uniq ) + + # Build list of texinfo inclusions to load chapters' nodes. + local FILENODE=$(\ + for CHAPTERNODE in $CHAPTERNODES;do + + INCL=$(echo $CHAPTERNODE | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") + + # Output inclusion line using texinfo format. + echo "@include $INCL" + + done) + + # Dump organized nodes of chapters into file. + echo "$FILENODE" > ${MANUALS_FILE[3]} + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateMenu.sh b/Scripts/Bash/Functions/Manual/help_updateMenu.sh new file mode 100755 index 0000000..625a04d --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateMenu.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# help_updateMenu.sh -- This function updates menu lines inside +# texinfo chapters. If this function is called with the +# 'remove-entry' string as first argument, then the menu line related +# to the entry being processed is removed. If this function is called +# with the 'update-entry' string as first argument, then the menu line +# related to the entry being processed is added to the menu. If no +# argument is passed to this function, the 'update-entry' action is +# assumed. +# +# Copyright (C) 2009, 2010 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 help_updateMenu { + + # Specify which action to do inside chapter's menu. + local ACTION="$1" + + # Build the menu line related to the entry being processed + # currently. + local MENULINE=$(echo "$ENTRY" \ + | cut -d / -f10- \ + | tr '/' ' ' \ + | sed -r "s/(${MANUALS_FILE[7]}|\.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]} \ + | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') + + # Re-defined chapter's menu based on action. + case $ACTION in + 'remove-entry' ) + # Remove menu line from chapter's menu. + MENU=$(echo "$MENU" | egrep -v "$MENULINE") + ;; + 'update-entry' | * ) + # Add menu line to chapter's menu. This is the default + # behaivour if no argument is passed to help_updateMenu + # function. + MENU="$MENU + $MENULINE" + ;; + esac + + # Organize menu alphabetically, remove empty and duplicated lines. + # At this point, empty line may occur the first time the menu is + # created, don't let them to scape. + MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$' | sort | uniq ) + + # Rebuild chapter's menu structure adding '@menu' and '@end menu' + # lines back in menu. + MENU="@menu + $MENU + @end menu" + + # Remove opening spaces/tabs from final menu structure. + MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') + + # Dump final menu structure back into chapter's menu file. + echo "$MENU" > $ENTRYCHAPTER/${MANUALS_FILE[8]} + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateNodes.sh b/Scripts/Bash/Functions/Manual/help_updateNodes.sh new file mode 100755 index 0000000..4e127ea --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateNodes.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# help_updateNodes.sh -- This function updates chapter's nodes +# definition using the chapter's menu as reference. +# +# Copyright (C) 2009, 2010 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 help_updateNodes { + + # Retrive nodes' entries from chapter-menu.texi file. + local NODES=$(cat $ENTRYCHAPTER/${MANUALS_FILE[8]} \ + | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ + | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) + + # Re-build node structure based on menu information. + for NODE in $NODES;do + + NODE=$(echo $NODE | sed -r 's!:! !g') + SECT=$(echo $NODE | sed -r 's! !/!g') + 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) + 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 + + fi + + # Output node information based on texinfo menu. + echo "@node $NODE" + echo "@section $SECT" + echo "@cindex $CIND" + echo "@include $INCL" + echo "" + + # Dump node information into chapter node file. + done > $ENTRYCHAPTER/${MANUALS_FILE[9]} + +} + diff --git a/Scripts/Bash/Functions/Manual/help_updateOutputFileHtml.sh b/Scripts/Bash/Functions/Manual/help_updateOutputFileHtml.sh new file mode 100755 index 0000000..ef961a4 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateOutputFileHtml.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# help_updateOutputFileHtml.sh -- This function updates manuals' html +# related output files. +# +# Copyright (C) 2009, 2010 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 help_updateOutputFileHtml { + + # Output action message + cli_printMessage "`gettext "Updating manual's html output"`" 'AsResponseLine' + + # Check html output directory + [[ ! -d ${MANUALS_DIR[4]} ]] && mkdir -p ${MANUALS_DIR[4]} + + # 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 + + # 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 \ + --nosec-nav \ + --css-include=/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ + -I=/home/centos/artwork + + # Apply html transformations. Html transformations rely on + # Texi2html default html output. The main goal of these html + # transformations is to build specific html structures that match + # specific css definitions. This way we extend the visual style of + # Texi2html default html output. + sed -r -i \ + -f /home/centos/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ + ${MANUALS_DIR[4]}/*.html + + # Remove html output directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateOutputFileInfo.sh b/Scripts/Bash/Functions/Manual/help_updateOutputFileInfo.sh new file mode 100755 index 0000000..43f7951 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateOutputFileInfo.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# help_updateOutputFileInfo.sh -- This function updates manual's info +# output related file. +# +# Copyright (C) 2009, 2010 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 help_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]} + + # 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 + + # Compress info file. + bzip2 -f ${MANUALS_FILE[4]} + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateOutputFilePlaintext.sh b/Scripts/Bash/Functions/Manual/help_updateOutputFilePlaintext.sh new file mode 100755 index 0000000..b6bdb1b --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateOutputFilePlaintext.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# help_updateOutputFilePlaintext.sh -- This function updates manuals' +# plaintext related output file. +# +# Copyright (C) 2009, 2010 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 help_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]} + + # Update plaintext output directory. + /usr/bin/makeinfo ${MANUALS_FILE[1]} --output=${MANUALS_FILE[5]} \ + --plaintext + +} diff --git a/Scripts/Bash/Functions/Manual/help_updateOutputFiles.sh b/Scripts/Bash/Functions/Manual/help_updateOutputFiles.sh new file mode 100755 index 0000000..6a95ed0 --- /dev/null +++ b/Scripts/Bash/Functions/Manual/help_updateOutputFiles.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# help_updateOutputFiles.sh -- This function updates manuals' related +# output files. +# +# Copyright (C) 2009, 2010 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 help_updateOutputFiles { + + # Add division line to differentiate action output visually. + echo '----------------------------------------------------------------------' + + # Add the working copy root directory to directory stack to make + # path construction correctly. Otherwise, makeinfo may produce + # paths incorrectly. + pushd /home/centos/artwork > /dev/null + + help_updateOutputFileInfo + help_updateOutputFileHtml + help_updateOutputFilePlaintext + + # Remove the working copy root directory from directory stack. + popd > /dev/null + + # Re-define output variable in order for cli_commitRepoChanges + # functionality to receive the correct location to apply + # subversion commands. Inside `help' functionality, the correct + # place to commit changes is not the initial value of ACTIONVAL + # but the directory path where documentation changes take place + # under. + ACTIONVAL=${MANUALS_DIR[0]} + + # Update central repository. Be sure this is the last action + # you perform inside centos-art.sh script flow. + cli_commitRepoChanges + +}