From deaa5451f74e3b77ce50a10d53533346fd0419e6 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: May 26 2011 14:08:41 +0000 Subject: Update `help' functionality: - Start using `help_texinfo' suffix on files to identify them as files that manipulate the repository documentation manual in Texinfo format. This is required to avoid confusion with other files that manipulate the repository documentation manual in other formats (e.g., Docbook, LinuxDoc, etc.) - Add the `--format' option (FLAG_FORMAT) to control the backend format used to manipulate the repository documentation manual. By default Docbook is used. --- diff --git a/Scripts/Functions/Help/help.sh b/Scripts/Functions/Help/help.sh index 8f3e1ec..9759434 100755 --- a/Scripts/Functions/Help/help.sh +++ b/Scripts/Functions/Help/help.sh @@ -35,20 +35,15 @@ function help { # search is perform. FLAG_SEARCH="" - # Define manuals base directory. This is the place where - # documentation manuals base directory structures are stored and - # organized in. - MANUAL_BASEDIR="${HOME}/artwork/trunk/Manuals/Texinfo" + # Initialize the format option. The format option (`--format') + # specifies the backend format used to manipulate the repository + # documentation manual. + FLAG_FORMAT="docbook" # Define file name (without extension) for documentation manual. MANUAL_NAME=repository - # Define base name for documentation manual files (without - # extension). This is the main file name used to build texinfo - # related files (.info, .pdf, .xml, etc.). - MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}" - - # Interpret option arguments passed through command-line. + # Interpret option arguments passed through the command-line. help_getOptions # Redefine positional parameters using ARGUMENTS. At this point, @@ -65,7 +60,7 @@ function help { for ACTIONVAL in "$@";do ACTIONVALS[((++${#ACTIONVALS[*]}))]="$ACTIONVAL" done - + # Enforce conditions against remaining non-option arguments before # processing them. if [[ ${ACTIONNAM} == ${FUNCNAM}_copyEntry ]];then @@ -141,12 +136,6 @@ function help { ARGUMENTS=${MANUAL_BASEDIR} fi - # Define action name. It does matter what option be passed to - # centos-art, there are many different actions to perform based on - # the option passed (e.g., `--edit', `--read', `--search', etc.). - # In that sake, we defined action name inside help_getArguments, - # at the moment of interpreting options. - # Define action value. As convenction, we use non-option arguments # to define the action value (ACTIONVAL) variable. for ACTIONVAL in $ARGUMENTS;do @@ -154,9 +143,19 @@ function help { # Check action value passed through the command-line using # source directory definition as reference. cli_checkRepoDirSource + + # Define manuals base directory. This is the place where + # documentation manuals base directory structures are stored + # and organized in. + MANUAL_BASEDIR="$(cli_getRepoTLDir)/Manuals/$(cli_getRepoName ${FLAG_FORMAT} -d)" + + # Define base name for documentation manual files (without + # extension). This is the main file name used to build texinfo + # related files (.info, .pdf, .xml, etc.). + MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}" # Define documentation entry. - ENTRY=$(help_getEntry) + ENTRY=$(${FUNCNAM}_getEntry) # Define documentation entry directory. This is the directory # where the entry file is stored. @@ -191,7 +190,7 @@ function help { cli_syncroRepoChanges ${MANUAL_CHAPTER_DIR} # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + if [[ -f ${FUNCDIR}/${FUNCNAM}/${ACTIONNAM}.sh ]];then eval $ACTIONNAM else cli_printMessage "`gettext "A valid action is required."`" --as-error-line diff --git a/Scripts/Functions/Help/help_copyEntry.sh b/Scripts/Functions/Help/help_copyEntry.sh deleted file mode 100755 index b6af30c..0000000 --- a/Scripts/Functions/Help/help_copyEntry.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -# -# help_copyEntry.sh -- This function copies documentation entries and -# updates documentation structure to reflect changes. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_copyEntry { - - # Print separator line. - cli_printMessage '-' --as-separator-line - - local ENTRY_SRC="$ENTRY" - local ENTRIES='' - local ENTRY='' - - # Verify parent directory of entry destination. If its parent - # directory doesn't exist, create it and add it to the repository. - if [[ ! -d $(dirname ${ENTRY_DST}) ]];then - mkdir -p $(dirname ${ENTRY_DST}) - svn add $(dirname ${ENTRY_DST}) --quiet - fi - - # Copy main documentation entry. - if [[ -a ${ENTRY_SRC} ]] && [[ ! -a ${ENTRY_DST} ]];then - cli_printMessage "${ENTRY_DST}" --as-creating-line - svn cp "${ENTRY_SRC}" "${ENTRY_DST}" --quiet - fi - - # Define target location of directory holding dependent - # documentation entries. - ENTRY_DST=$(echo ${ENTRY_DST} | sed -r 's!\.texi$!!') - - # Copy dependent documentation entries, if any. - if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]] && [[ ! -d ${ENTRY_DST} ]];then - cli_printMessage "${ENTRY_DST}" --as-creating-line - svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DST}" --quiet - fi - - # Define list of files to process. - ENTRIES=$(cli_getFilesList $(dirname ${ENTRY_DST}) --pattern=".*$(basename ${ENTRY_DST}).*\.texi") - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Print action message. - cli_printMessage "Updating menus, nodes and cross-references." --as-response-line - - # Redefine ENTRY variable in order to update documentation - # structure, taking recently created entries as reference. - for ENTRY in ${ENTRIES};do - - # Update menu and node definitions from manual sections to - # reflect the changes. - help_updateMenu - help_updateNodes - - # Update cross reference definitions from manual to reflect - # the changes. - help_restoreCrossReferences - - done - -} diff --git a/Scripts/Functions/Help/help_deleteCrossReferences.sh b/Scripts/Functions/Help/help_deleteCrossReferences.sh deleted file mode 100755 index 2a218f0..0000000 --- a/Scripts/Functions/Help/help_deleteCrossReferences.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# -# help_deleteCrossReferences.sh -- This function looks inside -# texinfo source files, from section level on, and removes all cross -# referece definitions related to a documentation entry. Use this -# function in coordination with help_deleteEntry function, in order -# to keep cross reference information, inside the documentation -# manual, syncronized. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_deleteCrossReferences { - - local -a PATTERN - local -a REPLACE - local LOCATION='' - - # Define entry location. Verify first argument to make this - # function reusable. If no value is passed as first argument use - # entry global information value as default value instead. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ENTRY" - fi - - # Build the node string using entry location. - local NODE=$(echo "$LOCATION" \ - | cut -d / -f7- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//" \ - -e 's! !( |\\n)!g') - - # Define regular expression patterns for texinfo cross reference - # commands. - PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" - PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$" - - # Define replacement string for missing entries. It is convenient - # to keep missing entries in documentation for documentation team - # to know. Removing the missing cross reference may intorudce - # confussion. Imagine that! you are spending lots of hours in an - # article and suddenly one of your cross refereces disappears with - # no visible reason, with the next working copy update you - # perform. That's frustrating. Instead, when centos-art.sh script - # finds a missing cross reference it removes the link and remark - # the issue for you to act on it. - REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' - REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' - - # Define list of entries to process. - local ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern='.*\.texi') - - # Update node-related cross references. The node-related cross - # reference definition, long ones specially, could require more - # than one line to be set. By default, GNU sed does not matches - # newline characters in the pattern space, so we need to make use - # of `label' feature and the `N' command in order to build a - # pattern space that includes the newline character in it. Here we - # use the `a' letter to name the label we use, followed by N - # command to add a newline to the pattern space, the s command to - # make the pattern replacement using the `g' flag to make it - # global and finaly the command `b' to branch label named `a'. - sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} - - # Update menu-related cross references. Menu-related cross - # references hardly appear in more than one line, so there is no - # need to complicate the replacement command. - sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} - -} diff --git a/Scripts/Functions/Help/help_deleteEntry.sh b/Scripts/Functions/Help/help_deleteEntry.sh deleted file mode 100755 index 78d68ef..0000000 --- a/Scripts/Functions/Help/help_deleteEntry.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash -# -# help_deleteEntry.sh -- This function removes a documentation entry -# from documentation directory structure. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_deleteEntry { - - # Print separator line. - cli_printMessage '-' --as-separator-line - - local ENTRY_SRC=${ENTRY} - local ENTRIES='' - local ENTRY='' - local ENTRY_DEP='' - - # Initiate list of entries to remove using the entry specified in - # the command line. - ENTRIES=${ENTRY_SRC} - - # Verify existence of dependent entries. Dependent entries are - # stored inside a directory with the same name of the entry you - # are trying to remove. - if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]];then - - # Add dependent files to list of entries. - ENTRIES="${ENTRIES} $(cli_getFilesList ${ENTRY_DIR}/${ENTRY_FILE} --pattern=".*\.texi")" - - # Add dependent directories to list of entries. Be aware of - # nested directories. - for ENTRY in ${ENTRIES};do - ENTRY_DEP=$(echo $ENTRY | sed -r "s/\.texi$//") - if [[ -d $ENTRY_DEP ]];then - ENTRIES="${ENTRIES} ${ENTRY_DEP}" - fi - done - - fi - - # Prepare list of entries for action preamble. - ENTRIES=$(echo ${ENTRIES} | tr ' ' "\n" | sort -r | uniq) - - # Print action preamble. - cli_printActionPreamble $ENTRIES --to-delete - - # Remove documentation entry using Subversion's `delete' command - # to know when the action took place. Do not use regular `rm' - # command here. - svn del ${ENTRIES} --quiet - - # Verify exit status from subversion command to be sure everything - # went well. Otherwhise stop script execution. - if [[ $? -ne 0 ]];then - cli_printMessage "${FUNCDIRNAM}" --as-toknowmore-line - fi - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Print action message. - cli_printMessage "Updating menus, nodes and cross-references." '--as-response-line' - - # Process list of entries in order to update menus, nodes and - # cross references. Since we are verifying entry status before - # remove the we cannot update the information in the same loop we - # remove files. This would modify some file before be removed and - # that would stop script execution. Similary, if we do update - # menus, nodes and cross references before removing files it would - # be needed to remove farther status verification in order for the - # script to continue its execution. Thereby, I can't see a - # different way but removing files first using status verification - # and later go through entries list again to update menus, nodes - # and cross references in remaining files. - for ENTRY in ${ENTRIES};do - - # Update menu and node definitions from manual sections to - # reflect the changes. - help_updateMenu "remove-entry" - help_updateNodes - - # Update cross reference definitions from manual to reflect - # the changes. - help_deleteCrossReferences - - done - - # Rebuild output files to propagate recent changes. - help_updateOutputFiles - -} diff --git a/Scripts/Functions/Help/help_doTexinfoSeealso.sh b/Scripts/Functions/Help/help_doTexinfoSeealso.sh deleted file mode 100755 index 87cbe09..0000000 --- a/Scripts/Functions/Help/help_doTexinfoSeealso.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# help_doTexinfoSeealso.sh -- This function creates an itemized list -# of links to refer parent documentation entries. This list of links -# is expanded wherever the =TEXINFO_SEEALSO= translation marker be -# placed in the documentation entry. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_doTexinfoSeealso { - - local FILE="$1" - local NODE="$2" - local NODECOMP='' - local NODECOMPS_TOTAL='' - local -a NODECOMPS - local SEEALSO_LIST='' - - # Stript out the node information in order to retrive its - # components individually. - for NODECOMP in $(echo $NODE);do - NODECOMPS[((++${#NODECOMPS[*]}))]=$NODECOMP - done - - # Define how many components does the node have. - local NODECOMPS_TOTAL=$((${#NODECOMPS[*]})) - - # Define the list content. This list should contain all the parent - # documentation entries under the same chapter, using the current - # documentation entry as reference. Assuming no parent directory - # exist for the current documentation entry, print just one item - # with three dots as content so as to let the user deside what the - # most appropriate content for this section would be. - if [[ $NODECOMPS_TOTAL -gt 2 ]];then - SEEALSO_LIST=$(\ - until [[ ${NODECOMPS_TOTAL} -eq 2 ]];do - echo "@item @ref{$NODE" \ - | cut -d ' ' -f-"$NODECOMPS_TOTAL" \ - | sed -r -e 's!^[:space:]*!\\n!' -e 's!$!}!'; - NODECOMPS_TOTAL=$(($NODECOMPS_TOTAL - 1)) - done) - else - SEEALSO_LIST=$(echo "@item @dots{}") - fi - - # Define the list type and merge its content. - SEEALSO_LIST="$(echo '@itemize'$SEEALSO_LIST'\n@end itemize')" - - # Expand translation marker in the documentation entry. - sed -i -e "/=TEXINFO_SEEALSO=/c\\$SEEALSO_LIST" $FILE - -} diff --git a/Scripts/Functions/Help/help_editEntry.sh b/Scripts/Functions/Help/help_editEntry.sh deleted file mode 100755 index a850a7d..0000000 --- a/Scripts/Functions/Help/help_editEntry.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# help_editEntry.sh -- This function implements the edition flow of -# documentation entries inside the working copy. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_editEntry { - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Verify chapter definition inside manual. - if [[ ! -d $MANUAL_CHAPTER_DIR ]];then - - # Print confirmation question. - cli_printMessage "`gettext "The following documentation chapter will be created:"`" - cli_printMessage "$MANUAL_CHAPTER_DIR" --as-response-line - cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line - - # Update manual chapter related files. - help_updateChaptersFiles - - # Update manual chapter related menu. - help_updateChaptersMenu - - # Update manual chapter related nodes (based on chapter - # related menu). - help_updateChaptersNodes - - fi - - # Verify section definition inside chapters. - if [[ ! -f $ENTRY ]];then - - # Print confirmation question. - cli_printMessage "`gettext "The following documentation section will be created:"`" - cli_printMessage "$ENTRY" --as-response-line - cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line - - # Update chapter section related menu. - help_updateMenu - - # Update chapter section related nodes (based on chapter - # section related menu). - help_updateNodes - - # Update old missing cross references. If for some reason a - # documentation entry is removed by mistake, and that mistake - # is fixing by adding the removed documentation entry back - # into the repository, rebuild the missing cross reference - # message to use the correct link to the documentation - # section. - help_restoreCrossReferences - - else - - # Print action message. - cli_printMessage "$ENTRY" --as-updating-line - - fi - - # Use default text editor to edit the documentation entry. - eval $EDITOR $ENTRY - - # Rebuild output files to propagate recent changes. - help_updateOutputFiles - -} diff --git a/Scripts/Functions/Help/help_getEntry.sh b/Scripts/Functions/Help/help_getEntry.sh deleted file mode 100755 index a5577b4..0000000 --- a/Scripts/Functions/Help/help_getEntry.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# -# help_getEntry.sh -- This function builds a documentation entry based -# on a location specified. Location specification can be both action -# value (ACTIONVAL) variable or a value passed as first positional -# parameter. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_getEntry { - - # Define variables as local to avoid conflicts outside. - local ENTRY='' - local LOCATION='' - - # Redefine location in order to make this function reusable not - # just for action value variable but whatever value passed as - # first possitional argument. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ACTIONVAL" - fi - - # Define relative path of entry, from trunk directory on. - ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") - - # Verify the entry relative path to find out which documentation - # manual we are acting on. As convenction, whatever documentation - # entry you provide outside trunk/Manuals/ directory structure is - # considered as you are documenting the repository directory - # structure. Otherwise, if an entry inside trunk/Manuals/ is - # provided, the directory structure provided is used as default - # documentation manual for actions like `--create' and `--update' - # to take place on. Other options like `--edit', `--delete' and - # `--read' cannot be applied to paths provided inside - # trunk/Manuals/ such actions need to be performed manually. - if [[ ${ENTRY} =~ '\.texi$' ]];then - ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/!!') - else - ENTRY=$(dirname Directories/${ENTRY})/$(basename $LOCATION).texi - fi - - # Re-define entry to set absolute path to manuals base directory - # structure. - ENTRY=${MANUAL_BASEDIR}/${ENTRY} - - # Output entry's absolute path. - echo ${ENTRY} - -} diff --git a/Scripts/Functions/Help/help_getNode.sh b/Scripts/Functions/Help/help_getNode.sh deleted file mode 100755 index 67b2f93..0000000 --- a/Scripts/Functions/Help/help_getNode.sh +++ /dev/null @@ -1,34 +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, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_getNode { - - local NODE=$(echo "$ACTIONVAL" \ - | sed -r "s!^${HOME}/artwork/!!" \ - | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') - - echo "$NODE" -} - diff --git a/Scripts/Functions/Help/help_getOptions.sh b/Scripts/Functions/Help/help_getOptions.sh index 466e249..cde3907 100755 --- a/Scripts/Functions/Help/help_getOptions.sh +++ b/Scripts/Functions/Help/help_getOptions.sh @@ -29,7 +29,7 @@ function help_getOptions { local ARGSS="" # Define long options we want to support. - local ARGSL="quiet,answer-yes,dont-commit-changes,read,search:,edit,update,copy,delete,rename" + local ARGSL="quiet,answer-yes,dont-commit-changes,read,search:,edit,update,copy,delete,rename,format:" # Parse arguments using getopt(1) command parser. cli_parseArguments @@ -67,41 +67,49 @@ function help_getOptions { ;; --search ) - ACTIONNAM="${FUNCNAM}_searchIndex" + ACTIONNAM="searchIndex" FLAG_SEARCH="$2" shift 2 ;; --edit ) - ACTIONNAM="${FUNCNAM}_editEntry" + ACTIONNAM="editEntry" shift 1 ;; --copy ) - ACTIONNAM="${FUNCNAM}_copyEntry" + ACTIONNAM="copyEntry" shift 1 ;; --delete ) - ACTIONNAM="${FUNCNAM}_deleteEntry" + ACTIONNAM="deleteEntry" shift 1 ;; --rename ) - ACTIONNAM="${FUNCNAM}_renameEntry" + ACTIONNAM="renameEntry" shift 1 ;; --update ) - ACTIONNAM="${FUNCNAM}_updateOutputFiles" + ACTIONNAM="updateOutputFiles" shift 1 ;; --read ) - ACTIONNAM="${FUNCNAM}_searchNode" + ACTIONNAM="searchNode" FLAG_DONT_COMMIT_CHANGES='true' shift 1 ;; + + --format ) + FLAG_FORMAT="$(cli_getRepoName $2 -f)" + if [[ ! $FLAG_FORMAT =~ '^(docbook|texinfo)$' ]];then + cli_printMessage "`gettext "The format provided is not supported."`" --as-error-line + fi + shift 2 + ;; -- ) # Remove the `--' argument from the list of arguments @@ -119,6 +127,12 @@ function help_getOptions { esac done + # Redefine function name to include the flag format in it. + FUNCNAM="${FUNCNAM}_${FLAG_FORMAT}" + + # Redefine action name using function name. + ACTIONNAM="${FUNCNAM}_${ACTIONNAM}" + # Redefine ARGUMENTS variable using current positional parameters. cli_parseArgumentsReDef "$@" diff --git a/Scripts/Functions/Help/help_renameCrossReferences.sh b/Scripts/Functions/Help/help_renameCrossReferences.sh deleted file mode 100755 index d113115..0000000 --- a/Scripts/Functions/Help/help_renameCrossReferences.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# help_renameCrossReferences.sh -- This function replaces a node -# pattern with a node replacement and updates cross-reference -# definitions to reflect the changes. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_renameCrossReferences { - - local NODE='' - local COUNT=1 - local ENTRIES='' - local NODE_SRC='' - local NODE_DST='' - - # Define node pattern for source documenation entry. - NODE_SRC=$(echo "$ENTRY" \ - | cut -d / -f7- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//") - - # Define node replacement for target documentation entry. - NODE_DST=$(echo "$ENTRY_DST" \ - | cut -d / -f7- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//") - - # Define list of entries to process. - ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern='.*\.texi') - - # Update node-related cross-references. The node-related cross - # reference definition, long ones specially, could require more - # than one line to be set. By default, GNU sed does not matches - # newline characters in the pattern space, so we need to make use - # of `label' feature and the `N' command in order to build a - # pattern space that includes the newline character in it. Here we - # use the `a' letter to name the label we use, followed by N - # command to add a newline to the pattern space, the s command to - # make the pattern replacement using the `g' flag to make it - # global and finaly the command `b' to branch label named `a'. - sed -r -i ":a;N;s!${NODE_SRC}!${NODE_DST}!g;ba" ${ENTRIES} - - # At this point, source documentation entry has been renamed from - # source to target documentation entry, but they are still - # commented. So, uncomment them restoring target documentation - # entries. - help_restoreCrossReferences "${ENTRY_DST}" - -} diff --git a/Scripts/Functions/Help/help_renameEntry.sh b/Scripts/Functions/Help/help_renameEntry.sh deleted file mode 100755 index 9b72910..0000000 --- a/Scripts/Functions/Help/help_renameEntry.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# help_renameEntry.sh -- This function renames documentation entries -# and updates documentation structure to reflect changes. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_renameEntry { - - # Copy source documentation entry. - help_copyEntry - - # Delete source documentation entry. The source documentation - # entry has been copied already, so to create the rename effect - # delete it from repository filesystem. - help_deleteEntry - - # At this point, source documentation entry has been removed and - # all menu, nodes and cross-references have been commented. So, - # replace commented menu, nodes and cross-reference information - # from source to target documentation entry. - help_renameCrossReferences - -} diff --git a/Scripts/Functions/Help/help_restoreCrossReferences.sh b/Scripts/Functions/Help/help_restoreCrossReferences.sh deleted file mode 100755 index 31a443a..0000000 --- a/Scripts/Functions/Help/help_restoreCrossReferences.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# -# help_restoreCrossReferences.sh -- This function looks inside -# texinfo source files, from section level on, and restores any cross -# reference related to a documentation entry. This function is used in -# those cases where documentation entries are created/recreated to -# documentation structure. It is a verification that looks for -# matching documentation entries previously defined as removed by -# help_deleteCrossReferences function. The -# help_restoreCrossReferences function relays in the removed message -# format produced by help_deleteCrossReferences function, in order -# to return them back into the link format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_restoreCrossReferences { - - local -a PATTERN - local -a REPLACE - local LOCATION='' - - # Define entry location. Verify first argument to make this - # function reusable. If no value is passed as first argument use - # entry global information value as default value instead. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ENTRY" - fi - - # Build the node string using entry location. - local NODE=$(echo "$LOCATION" \ - | cut -d / -f7- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//") - - # Define regular expression patterns to match removed message - # format produced by message_removeCrossReferences function. - PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" - PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" - - # Define replacement string to turn removed message back to cross - # reference link. - REPLACE[0]='@\1{\2}' - REPLACE[1]='\1' - - # Define list of entries to process. - local ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern='.*\.texi') - - # Update node-related cross references. The node-related cross - # reference definition, long ones specially, could require more - # than one line to be set. By default, GNU sed does not matches - # newline characters in the pattern space, so we need to make use - # of `label' feature and the `N' command in order to build a - # pattern space that includes the newline character in it. Here we - # use the `a' letter to name the label we use, followed by N - # command to add a newline to the pattern space, the s command to - # make the pattern replacement using the `g' flag to make it - # global and finaly the command `b' to branch label named `a'. - sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} - - # Update menu-related cross references. Menu-related cross - # references hardly appear in more than one line, so there is no - # need to complicate the replacement command. - sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} - -} diff --git a/Scripts/Functions/Help/help_searchIndex.sh b/Scripts/Functions/Help/help_searchIndex.sh deleted file mode 100644 index c259d1c..0000000 --- a/Scripts/Functions/Help/help_searchIndex.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# help_searchIndex.sh -- This function does an index search inside the -# info document. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_searchIndex { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line - - # Execute info command to perform an index-search. - /usr/bin/info --index-search="$FLAG_SEARCH" --file=${MANUAL_BASEFILE}.info.bz2 - -} diff --git a/Scripts/Functions/Help/help_searchNode.sh b/Scripts/Functions/Help/help_searchNode.sh deleted file mode 100755 index 0a3b296..0000000 --- a/Scripts/Functions/Help/help_searchNode.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# help_searchNode.sh -- This function does a node search inside the -# info document. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_searchNode { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line - - # 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="Directories $(help_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 - else - help_editEntry - fi - -} diff --git a/Scripts/Functions/Help/help_texinfo_copyEntry.sh b/Scripts/Functions/Help/help_texinfo_copyEntry.sh new file mode 100755 index 0000000..e4f9dcd --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_copyEntry.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# help_texinfo_copyEntry.sh -- This function copies documentation entries and +# updates documentation structure to reflect changes. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_copyEntry { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + local ENTRY_SRC="$ENTRY" + local ENTRIES='' + local ENTRY='' + + # Verify parent directory of entry destination. If its parent + # directory doesn't exist, create it and add it to the repository. + if [[ ! -d $(dirname ${ENTRY_DST}) ]];then + mkdir -p $(dirname ${ENTRY_DST}) + svn add $(dirname ${ENTRY_DST}) --quiet + fi + + # Copy main documentation entry. + if [[ -a ${ENTRY_SRC} ]] && [[ ! -a ${ENTRY_DST} ]];then + cli_printMessage "${ENTRY_DST}" --as-creating-line + svn cp "${ENTRY_SRC}" "${ENTRY_DST}" --quiet + fi + + # Define target location of directory holding dependent + # documentation entries. + ENTRY_DST=$(echo ${ENTRY_DST} | sed -r 's!\.texi$!!') + + # Copy dependent documentation entries, if any. + if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]] && [[ ! -d ${ENTRY_DST} ]];then + cli_printMessage "${ENTRY_DST}" --as-creating-line + svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DST}" --quiet + fi + + # Define list of files to process. + ENTRIES=$(cli_getFilesList $(dirname ${ENTRY_DST}) --pattern=".*$(basename ${ENTRY_DST}).*\.texi") + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "Updating menus, nodes and cross-references." --as-response-line + + # Redefine ENTRY variable in order to update documentation + # structure, taking recently created entries as reference. + for ENTRY in ${ENTRIES};do + + # Update menu and node definitions from manual sections to + # reflect the changes. + help_texinfo_updateMenu + help_texinfo_updateNodes + + # Update cross reference definitions from manual to reflect + # the changes. + help_texinfo_restoreCrossReferences + + done + +} diff --git a/Scripts/Functions/Help/help_texinfo_deleteCrossReferences.sh b/Scripts/Functions/Help/help_texinfo_deleteCrossReferences.sh new file mode 100755 index 0000000..1bb3be5 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_deleteCrossReferences.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# +# help_texinfo_deleteCrossReferences.sh -- This function looks inside +# texinfo source files, from section level on, and removes all cross +# referece definitions related to a documentation entry. Use this +# function in coordination with help_texinfo_deleteEntry function, in order +# to keep cross reference information, inside the documentation +# manual, syncronized. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_deleteCrossReferences { + + local -a PATTERN + local -a REPLACE + local LOCATION='' + + # Define entry location. Verify first argument to make this + # function reusable. If no value is passed as first argument use + # entry global information value as default value instead. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ENTRY" + fi + + # Build the node string using entry location. + local NODE=$(echo "$LOCATION" \ + | cut -d / -f7- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//" \ + -e 's! !( |\\n)!g') + + # Define regular expression patterns for texinfo cross reference + # commands. + PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" + PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$" + + # Define replacement string for missing entries. It is convenient + # to keep missing entries in documentation for documentation team + # to know. Removing the missing cross reference may intorudce + # confussion. Imagine that! you are spending lots of hours in an + # article and suddenly one of your cross refereces disappears with + # no visible reason, with the next working copy update you + # perform. That's frustrating. Instead, when centos-art.sh script + # finds a missing cross reference it removes the link and remark + # the issue for you to act on it. + REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' + REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' + + # Define list of entries to process. + local ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern='.*\.texi') + + # Update node-related cross references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} + +} diff --git a/Scripts/Functions/Help/help_texinfo_deleteEntry.sh b/Scripts/Functions/Help/help_texinfo_deleteEntry.sh new file mode 100755 index 0000000..2b77017 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_deleteEntry.sh @@ -0,0 +1,109 @@ +#!/bin/bash +# +# help_texinfo_deleteEntry.sh -- This function removes a documentation entry +# from documentation directory structure. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_deleteEntry { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + local ENTRY_SRC=${ENTRY} + local ENTRIES='' + local ENTRY='' + local ENTRY_DEP='' + + # Initiate list of entries to remove using the entry specified in + # the command line. + ENTRIES=${ENTRY_SRC} + + # Verify existence of dependent entries. Dependent entries are + # stored inside a directory with the same name of the entry you + # are trying to remove. + if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]];then + + # Add dependent files to list of entries. + ENTRIES="${ENTRIES} $(cli_getFilesList ${ENTRY_DIR}/${ENTRY_FILE} --pattern=".*\.texi")" + + # Add dependent directories to list of entries. Be aware of + # nested directories. + for ENTRY in ${ENTRIES};do + ENTRY_DEP=$(echo $ENTRY | sed -r "s/\.texi$//") + if [[ -d $ENTRY_DEP ]];then + ENTRIES="${ENTRIES} ${ENTRY_DEP}" + fi + done + + fi + + # Prepare list of entries for action preamble. + ENTRIES=$(echo ${ENTRIES} | tr ' ' "\n" | sort -r | uniq) + + # Print action preamble. + cli_printActionPreamble $ENTRIES --to-delete + + # Remove documentation entry using Subversion's `delete' command + # to know when the action took place. Do not use regular `rm' + # command here. + svn del ${ENTRIES} --quiet + + # Verify exit status from subversion command to be sure everything + # went well. Otherwhise stop script execution. + if [[ $? -ne 0 ]];then + cli_printMessage "${FUNCDIRNAM}" --as-toknowmore-line + fi + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "Updating menus, nodes and cross-references." '--as-response-line' + + # Process list of entries in order to update menus, nodes and + # cross references. Since we are verifying entry status before + # remove the we cannot update the information in the same loop we + # remove files. This would modify some file before be removed and + # that would stop script execution. Similary, if we do update + # menus, nodes and cross references before removing files it would + # be needed to remove farther status verification in order for the + # script to continue its execution. Thereby, I can't see a + # different way but removing files first using status verification + # and later go through entries list again to update menus, nodes + # and cross references in remaining files. + for ENTRY in ${ENTRIES};do + + # Update menu and node definitions from manual sections to + # reflect the changes. + help_texinfo_updateMenu "remove-entry" + help_texinfo_updateNodes + + # Update cross reference definitions from manual to reflect + # the changes. + help_texinfo_deleteCrossReferences + + done + + # Rebuild output files to propagate recent changes. + help_texinfo_updateOutputFiles + +} diff --git a/Scripts/Functions/Help/help_texinfo_editEntry.sh b/Scripts/Functions/Help/help_texinfo_editEntry.sh new file mode 100755 index 0000000..18ae4a4 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_editEntry.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# +# help_texinfo_editEntry.sh -- This function implements the edition flow of +# documentation entries inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_editEntry { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Verify chapter definition inside manual. + if [[ ! -d $MANUAL_CHAPTER_DIR ]];then + + # Print confirmation question. + cli_printMessage "`gettext "The following documentation chapter will be created:"`" + cli_printMessage "$MANUAL_CHAPTER_DIR" --as-response-line + cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line + + # Update manual chapter related files. + help_texinfo_updateChaptersFiles + + # Update manual chapter related menu. + help_texinfo_updateChaptersMenu + + # Update manual chapter related nodes (based on chapter + # related menu). + help_texinfo_updateChaptersNodes + + fi + + # Verify section definition inside chapters. + if [[ ! -f $ENTRY ]];then + + # Print confirmation question. + cli_printMessage "`gettext "The following documentation section will be created:"`" + cli_printMessage "$ENTRY" --as-response-line + cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line + + # Update chapter section related menu. + help_texinfo_updateMenu + + # Update chapter section related nodes (based on chapter + # section related menu). + help_texinfo_updateNodes + + # Update old missing cross references. If for some reason a + # documentation entry is removed by mistake, and that mistake + # is fixing by adding the removed documentation entry back + # into the repository, rebuild the missing cross reference + # message to use the correct link to the documentation + # section. + help_texinfo_restoreCrossReferences + + else + + # Print action message. + cli_printMessage "$ENTRY" --as-updating-line + + fi + + # Use default text editor to edit the documentation entry. + eval $EDITOR $ENTRY + + # Rebuild output files to propagate recent changes. + help_texinfo_updateOutputFiles + +} diff --git a/Scripts/Functions/Help/help_texinfo_getEntry.sh b/Scripts/Functions/Help/help_texinfo_getEntry.sh new file mode 100755 index 0000000..5b5fa00 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_getEntry.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# help_texinfo_getEntry.sh -- This function builds a documentation entry based +# on a location specified. Location specification can be both action +# value (ACTIONVAL) variable or a value passed as first positional +# parameter. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_getEntry { + + # Define variables as local to avoid conflicts outside. + local ENTRY='' + local LOCATION='' + + # Redefine location in order to make this function reusable not + # just for action value variable but whatever value passed as + # first possitional argument. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ACTIONVAL" + fi + + # Define relative path of entry, from trunk directory on. + ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") + + # Verify the entry relative path to find out which documentation + # manual we are acting on. As convenction, whatever documentation + # entry you provide outside trunk/Manuals/ directory structure is + # considered as you are documenting the repository directory + # structure. Otherwise, if an entry inside trunk/Manuals/ is + # provided, the directory structure provided is used as default + # documentation manual for actions like `--create' and `--update' + # to take place on. Other options like `--edit', `--delete' and + # `--read' cannot be applied to paths provided inside + # trunk/Manuals/ such actions need to be performed manually. + if [[ ${ENTRY} =~ '\.texi$' ]];then + ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manuals/!!') + else + ENTRY=$(dirname Directories/${ENTRY})/$(basename $LOCATION).texi + fi + + # Re-define entry to set absolute path to manuals base directory + # structure. + ENTRY=${MANUAL_BASEDIR}/${ENTRY} + + # Output entry's absolute path. + echo ${ENTRY} + +} diff --git a/Scripts/Functions/Help/help_texinfo_getNode.sh b/Scripts/Functions/Help/help_texinfo_getNode.sh new file mode 100755 index 0000000..1cdb4c2 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_getNode.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# help_texinfo_getNode.sh -- This function cleans up the action value +# (ACTIONVAL) directory to make a node name from it. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_getNode { + + local NODE=$(echo "$ACTIONVAL" \ + | sed -r "s!^${HOME}/artwork/!!" \ + | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') + + echo "$NODE" +} + diff --git a/Scripts/Functions/Help/help_texinfo_makeSeeAlso.sh b/Scripts/Functions/Help/help_texinfo_makeSeeAlso.sh new file mode 100755 index 0000000..f687add --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_makeSeeAlso.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# help_texinfo_makeSeeAlso.sh -- This function creates an itemized list +# of links to refer parent documentation entries. This list of links +# is expanded wherever the =TEXINFO_SEEALSO= translation marker be +# placed in the documentation entry. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_makeSeeAlso { + + local FILE="$1" + local NODE="$2" + local NODECOMP='' + local NODECOMPS_TOTAL='' + local -a NODECOMPS + local SEEALSO_LIST='' + + # Stript out the node information in order to retrive its + # components individually. + for NODECOMP in $(echo $NODE);do + NODECOMPS[((++${#NODECOMPS[*]}))]=$NODECOMP + done + + # Define how many components does the node have. + local NODECOMPS_TOTAL=$((${#NODECOMPS[*]})) + + # Define the list content. This list should contain all the parent + # documentation entries under the same chapter, using the current + # documentation entry as reference. Assuming no parent directory + # exist for the current documentation entry, print just one item + # with three dots as content so as to let the user deside what the + # most appropriate content for this section would be. + if [[ $NODECOMPS_TOTAL -gt 2 ]];then + SEEALSO_LIST=$(\ + until [[ ${NODECOMPS_TOTAL} -eq 2 ]];do + echo "@item @ref{$NODE" \ + | cut -d ' ' -f-"$NODECOMPS_TOTAL" \ + | sed -r -e 's!^[:space:]*!\\n!' -e 's!$!}!'; + NODECOMPS_TOTAL=$(($NODECOMPS_TOTAL - 1)) + done) + else + SEEALSO_LIST=$(echo "@item @dots{}") + fi + + # Define the list type and merge its content. + SEEALSO_LIST="$(echo '@itemize'$SEEALSO_LIST'\n@end itemize')" + + # Expand translation marker in the documentation entry. + sed -i -e "/=TEXINFO_SEEALSO=/c\\$SEEALSO_LIST" $FILE + +} diff --git a/Scripts/Functions/Help/help_texinfo_renameCrossReferences.sh b/Scripts/Functions/Help/help_texinfo_renameCrossReferences.sh new file mode 100755 index 0000000..b325ac8 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_renameCrossReferences.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# help_texinfo_renameCrossReferences.sh -- This function replaces a node +# pattern with a node replacement and updates cross-reference +# definitions to reflect the changes. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_renameCrossReferences { + + local NODE='' + local COUNT=1 + local ENTRIES='' + local NODE_SRC='' + local NODE_DST='' + + # Define node pattern for source documenation entry. + NODE_SRC=$(echo "$ENTRY" \ + | cut -d / -f7- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//") + + # Define node replacement for target documentation entry. + NODE_DST=$(echo "$ENTRY_DST" \ + | cut -d / -f7- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//") + + # Define list of entries to process. + ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern='.*\.texi') + + # Update node-related cross-references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${NODE_SRC}!${NODE_DST}!g;ba" ${ENTRIES} + + # At this point, source documentation entry has been renamed from + # source to target documentation entry, but they are still + # commented. So, uncomment them restoring target documentation + # entries. + help_texinfo_restoreCrossReferences "${ENTRY_DST}" + +} diff --git a/Scripts/Functions/Help/help_texinfo_renameEntry.sh b/Scripts/Functions/Help/help_texinfo_renameEntry.sh new file mode 100755 index 0000000..c9ef509 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_renameEntry.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# help_texinfo_renameEntry.sh -- This function renames documentation entries +# and updates documentation structure to reflect changes. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_renameEntry { + + # Copy source documentation entry. + help_texinfo_copyEntry + + # Delete source documentation entry. The source documentation + # entry has been copied already, so to create the rename effect + # delete it from repository filesystem. + help_texinfo_deleteEntry + + # At this point, source documentation entry has been removed and + # all menu, nodes and cross-references have been commented. So, + # replace commented menu, nodes and cross-reference information + # from source to target documentation entry. + help_texinfo_renameCrossReferences + +} diff --git a/Scripts/Functions/Help/help_texinfo_restoreCrossReferences.sh b/Scripts/Functions/Help/help_texinfo_restoreCrossReferences.sh new file mode 100755 index 0000000..c454fa4 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_restoreCrossReferences.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# +# help_texinfo_restoreCrossReferences.sh -- This function looks inside +# texinfo source files, from section level on, and restores any cross +# reference related to a documentation entry. This function is used in +# those cases where documentation entries are created/recreated to +# documentation structure. It is a verification that looks for +# matching documentation entries previously defined as removed by +# help_texinfo_deleteCrossReferences function. The +# help_texinfo_restoreCrossReferences function relays in the removed +# message format produced by help_texinfo_deleteCrossReferences +# function, in order to return them back into the link format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_restoreCrossReferences { + + local -a PATTERN + local -a REPLACE + local LOCATION='' + + # Define entry location. Verify first argument to make this + # function reusable. If no value is passed as first argument use + # entry global information value as default value instead. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ENTRY" + fi + + # Build the node string using entry location. + local NODE=$(echo "$LOCATION" \ + | cut -d / -f7- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//") + + # Define regular expression patterns to match removed message + # format produced by message_removeCrossReferences function. + PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" + PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" + + # Define replacement string to turn removed message back to cross + # reference link. + REPLACE[0]='@\1{\2}' + REPLACE[1]='\1' + + # Define list of entries to process. + local ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern='.*\.texi') + + # Update node-related cross references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} + +} diff --git a/Scripts/Functions/Help/help_texinfo_searchIndex.sh b/Scripts/Functions/Help/help_texinfo_searchIndex.sh new file mode 100644 index 0000000..b8acbc6 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_searchIndex.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# help_texinfo_searchIndex.sh -- This function does an index search inside the +# info document. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_searchIndex { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line + + # Execute info command to perform an index-search. + /usr/bin/info --index-search="$FLAG_SEARCH" --file=${MANUAL_BASEFILE}.info.bz2 + +} diff --git a/Scripts/Functions/Help/help_texinfo_searchNode.sh b/Scripts/Functions/Help/help_texinfo_searchNode.sh new file mode 100755 index 0000000..b47a44f --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_searchNode.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# help_texinfo_searchNode.sh -- This function does a node search inside the +# info document. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_searchNode { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line + + # 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="Directories $(help_texinfo_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 + else + help_texinfo_editEntry + fi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateChaptersFiles.sh b/Scripts/Functions/Help/help_texinfo_updateChaptersFiles.sh new file mode 100755 index 0000000..ada585f --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateChaptersFiles.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# +# help_texinfo_updateChaptersFiles.sh -- This function updates chapter related +# files. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateChaptersFiles { + + # Define chapter's generic structure. + local CHAPTERBODY="\ + @node $MANUAL_CHAPTER_NAME + @chapter $MANUAL_CHAPTER_NAME + @cindex $(echo $MANUAL_CHAPTER_NAME | tr '[[:upper:]]' '[[:lower:]]') + @include $MANUAL_CHAPTER_NAME/chapter-intro.texi + @include $MANUAL_CHAPTER_NAME/chapter-menu.texi + @include $MANUAL_CHAPTER_NAME/chapter-nodes.texi" + + # Remove any space/tabs at the begining of @... lines. + CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') + + # Create directory to store chapter files. + if [[ ! -d $MANUAL_CHAPTER_DIR ]];then + mkdir $MANUAL_CHAPTER_DIR + 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" > $MANUAL_CHAPTER_DIR/chapter.texi + echo "" > $MANUAL_CHAPTER_DIR/chapter-menu.texi + echo "" > $MANUAL_CHAPTER_DIR/chapter-nodes.texi + + # Initialize chapter instroduction using template file. + cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_CHAPTER_DIR/chapter-intro.texi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateChaptersMenu.sh b/Scripts/Functions/Help/help_texinfo_updateChaptersMenu.sh new file mode 100755 index 0000000..fe57b9a --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateChaptersMenu.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# +# help_texinfo_updateChaptersMenu.sh -- This function updates chapter menu. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_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 inside the master texinfo + # file (repository.texi) as an included file. To create the final + # .info file correctly, the Index line in the menu should remain, + # even no other node exist. + if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then + MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | egrep -v "^(@(end )?menu$|\* Index::.*)$") + fi + + # Re-defined menu of chapters based on action. + case $ACTION in + 'remove-entry' ) + # Remove chapter from menu. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ + | egrep -v "^\* ${MANUAL_CHAPTER_NAME}::[[:print:]]*$") + ;; + 'update-entry' | * ) + # Update chapter menu using texinfo format. + MENUCHAPTERS="${MENUCHAPTERS} + * ${MANUAL_CHAPTER_NAME}::" + ;; + esac + + # Remove opening spaces/tabs and empty line from the menu of + # chapters. Empty lines may occur the first time the menu of + # chapters is created. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | 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} + * 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}" > ${MANUAL_BASEFILE}-menu.texi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateChaptersNodes.sh b/Scripts/Functions/Help/help_texinfo_updateChaptersNodes.sh new file mode 100755 index 0000000..f222f0b --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateChaptersNodes.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# help_texinfo_updateChaptersNodes.sh -- This function updates nodes of +# chapters based on menu of chapters. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateChaptersNodes { + + # Build list "nodes of chapters" based on menu of chapters. + local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | 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" > ${MANUAL_BASEFILE}-nodes.texi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateMenu.sh b/Scripts/Functions/Help/help_texinfo_updateMenu.sh new file mode 100755 index 0000000..a127c58 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateMenu.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# help_texinfo_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, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateMenu { + + # Specify which action to do inside chapter's menu. + local ACTION="$1" + + # Build the menu node related to the entry being processed + # currently. + local MENUNODE=$(echo "$ENTRY" | cut -d / -f8- | tr '/' ' ' \ + | sed 's!\.texi$!!') + + # Give format to menu line using texinfo style. + local MENULINE="* ${MANUAL_CHAPTER_NAME} $MENUNODE::" + + # Define chapter's menu. Remove `@menu', `@end menu', and empty lines + # from output. + local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ + | 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_texinfo_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" > $MANUAL_CHAPTER_DIR/chapter-menu.texi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateNodes.sh b/Scripts/Functions/Help/help_texinfo_updateNodes.sh new file mode 100755 index 0000000..6b23b39 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateNodes.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# +# help_texinfo_updateNodes.sh -- This function updates chapter's nodes +# definition using the chapter's menu as reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateNodes { + + local TEXINFO_TEMPLATE='' + + # Retrive nodes' entries from chapter-menu.texi file. + local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ + | 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' | sed "s!${MANUAL_CHAPTER_NAME}/!!") + INCL=$(echo "$NODE" | sed -r 's! !/!g').texi + CIND=$(echo "$NODE") + + # Create an empty directory to store texinfo files. + if [[ ! -d ${MANUAL_BASEDIR}/$(dirname "$INCL") ]];then + mkdir -p ${MANUAL_BASEDIR}/$(dirname "$INCL") + fi + + # Create texinfo section file using templates. + if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]];then + + # Define what template to apply using the absolute path of + # the documentation entry as reference. + if [[ ${MANUAL_BASEDIR}/${INCL} =~ 'trunk/Scripts/Functions/.+' ]];then + TEXINFO_TEMPLATE="${FUNCCONFIG}/manual-section-functions.texi" + else + TEXINFO_TEMPLATE="${FUNCCONFIG}/manual-section.texi" + fi + + # Copy template to its destination. + cp ${TEXINFO_TEMPLATE} ${MANUAL_BASEDIR}/$INCL + + # Expand common translation markers. + cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL" + + # Expand texinfo-specific translation markers. + ${FUNCNAM}_doTexinfoSeealso "${MANUAL_BASEDIR}/$INCL" "$NODE" + + fi + + # Output node information based on texinfo menu. + echo "@node $NODE" + echo "@section `eval_gettext "The @file{\\\$SECT} Directory"`" + echo "@cindex $CIND" + echo "@include $INCL" + echo "" + + # Dump node information into chapter node file. + done > $MANUAL_CHAPTER_DIR/chapter-nodes.texi + +} + diff --git a/Scripts/Functions/Help/help_texinfo_updateOutputFileInfo.sh b/Scripts/Functions/Help/help_texinfo_updateOutputFileInfo.sh new file mode 100755 index 0000000..72320e9 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateOutputFileInfo.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# help_texinfo_updateOutputFileInfo.sh -- This function exports +# documentation manual to info format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateOutputFileInfo { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-updating-line + + # Update info file. + /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info + + # Compress info file. + if [[ $? -eq 0 ]];then + bzip2 -f ${MANUAL_BASEFILE}.info + fi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateOutputFilePdf.sh b/Scripts/Functions/Help/help_texinfo_updateOutputFilePdf.sh new file mode 100755 index 0000000..9e714cd --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateOutputFilePdf.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# help_texinfo_updateOutputFilePdf.sh -- This function exports documentation +# manual to PDF format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateOutputFilePdf { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.pdf" --as-updating-line + + # Update plaintext output directory. + /usr/bin/texi2pdf --quiet \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateOutputFilePlaintext.sh b/Scripts/Functions/Help/help_texinfo_updateOutputFilePlaintext.sh new file mode 100755 index 0000000..34342dd --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateOutputFilePlaintext.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# help_texinfo_updateOutputFilePlaintext.sh -- This function exports +# documentation manual to plain-text format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateOutputFilePlaintext { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" --as-updating-line + + # Update plaintext output directory. + /usr/bin/makeinfo --plaintext \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt + + # Compress plaintext output file. + if [[ -f ${MANUAL_BASEFILE}.txt ]];then + bzip2 ${MANUAL_BASEFILE}.txt --force + fi + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateOutputFileXhtml.sh b/Scripts/Functions/Help/help_texinfo_updateOutputFileXhtml.sh new file mode 100755 index 0000000..a290757 --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateOutputFileXhtml.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# help_texinfo_updateOutputFileXhtml.sh -- This function exports +# documentation manual to HTML format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateOutputFileXhtml { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.xhtml.tar.bz2" --as-updating-line + + # Redefine manual base file to use just the file base name. + local MANUAL_BASEFILE=$(basename "$MANUAL_BASEFILE") + + # Add manual base directory path into directory stack to make it + # the current working directory. This is done to reduce the path + # information packaged inside `repository.xhtml.tar.bz2' file. + pushd ${MANUAL_BASEDIR} > /dev/null + + # Prepare directory structure where xhtml files will be stored in. + [[ ! -d ${MANUAL_BASEFILE}.xhtml ]] && mkdir -p ${MANUAL_BASEFILE}.xhtml + + # Clean up directory structure where xhtml files will be stored. + # We don't want to have unused files inside it. + [[ $(ls ${MANUAL_BASEFILE}.xhtml > /dev/null) ]] && rm ${MANUAL_BASEFILE}.xhtml/*.xhtml + + # Add directory where xhtml files will be sotred in into directory + # stack to make it the current working directory. This is required + # in order for include paths to be constructed correctly. + pushd ${MANUAL_BASEFILE}.xhtml > /dev/null + + # Update xhtml files. Use texi2html to export from texinfo file + # format to html using CentOS Web default visual style. + texi2html --init-file=${MANUAL_BASEDIR}/${MANUAL_BASEFILE}-init.pl \ + --output=${MANUAL_BASEDIR}/${MANUAL_BASEFILE}.xhtml \ + ${MANUAL_BASEDIR}/${MANUAL_BASEFILE}.texi + + # Remove directory where xhtml files are stored from directory + # stack. The xhtml files have been already created. + popd > /dev/null + + # Apply xhtml transformations. This transformation cannot be built + # inside the initialization script (repository.init). For example, + # I can't see a possible way to produce different quotation HTML + # outputs from the same texinfo quotation definition. Instead, + # once the HTML code is produced we can take que quotation HTML + # definition plus the first letters inside it and transform the + # structure to a completly different thing that can be handle + # through classed inside CSS definitions. + sed -r -i -f ${MANUAL_BASEFILE}.sed ${MANUAL_BASEFILE}.xhtml/*.xhtml + + # Compress directory structure where xhtml files are stored in. + # This compressed version is the one we put under version control. + # The directory used to build the compressed version is left + # unversion for the matter of human revision. + tar -cjf ${MANUAL_BASEFILE}.xhtml.tar.bz2 ${MANUAL_BASEFILE}.xhtml + + # Remove manual base directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateOutputFileXml.sh b/Scripts/Functions/Help/help_texinfo_updateOutputFileXml.sh new file mode 100755 index 0000000..47dc32b --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateOutputFileXml.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# help_texinfo_updateOutputFileXml.sh -- This function exports documentation +# manual to XML format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateOutputFileXml { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.xml" --as-updating-line + + # Update xml output format. + /usr/bin/makeinfo --xml \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ + +} diff --git a/Scripts/Functions/Help/help_texinfo_updateOutputFiles.sh b/Scripts/Functions/Help/help_texinfo_updateOutputFiles.sh new file mode 100755 index 0000000..e126bff --- /dev/null +++ b/Scripts/Functions/Help/help_texinfo_updateOutputFiles.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# help_texinfo_updateOutputFiles.sh -- This function exports documentation +# manual to different output formats. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Project +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function help_texinfo_updateOutputFiles { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Add the working copy root directory to directory stack to make + # path construction correctly. Otherwise, makeinfo may produce + # paths incorrectly. + pushd ${HOME}/artwork > /dev/null + + help_texinfo_updateOutputFileInfo + help_texinfo_updateOutputFileXhtml + help_texinfo_updateOutputFileXml + help_texinfo_updateOutputFilePdf + help_texinfo_updateOutputFilePlaintext + + # Remove the working copy root directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Functions/Help/help_updateChaptersFiles.sh b/Scripts/Functions/Help/help_updateChaptersFiles.sh deleted file mode 100755 index ad81c0c..0000000 --- a/Scripts/Functions/Help/help_updateChaptersFiles.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# -# help_updateChaptersFiles.sh -- This function updates chapter related -# files. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateChaptersFiles { - - # Define chapter's generic structure. - local CHAPTERBODY="\ - @node $MANUAL_CHAPTER_NAME - @chapter $MANUAL_CHAPTER_NAME - @cindex $(echo $MANUAL_CHAPTER_NAME | tr '[[:upper:]]' '[[:lower:]]') - @include $MANUAL_CHAPTER_NAME/chapter-intro.texi - @include $MANUAL_CHAPTER_NAME/chapter-menu.texi - @include $MANUAL_CHAPTER_NAME/chapter-nodes.texi" - - # Remove any space/tabs at the begining of @... lines. - CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') - - # Create directory to store chapter files. - if [[ ! -d $MANUAL_CHAPTER_DIR ]];then - mkdir $MANUAL_CHAPTER_DIR - 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" > $MANUAL_CHAPTER_DIR/chapter.texi - echo "" > $MANUAL_CHAPTER_DIR/chapter-menu.texi - echo "" > $MANUAL_CHAPTER_DIR/chapter-nodes.texi - - # Initialize chapter instroduction using template file. - cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_CHAPTER_DIR/chapter-intro.texi - -} diff --git a/Scripts/Functions/Help/help_updateChaptersMenu.sh b/Scripts/Functions/Help/help_updateChaptersMenu.sh deleted file mode 100755 index 31a5564..0000000 --- a/Scripts/Functions/Help/help_updateChaptersMenu.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# -# help_updateChaptersMenu.sh -- This function updates chapter menu. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, 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 inside the master texinfo - # file (repository.texi) as an included file. To create the final - # .info file correctly, the Index line in the menu should remain, - # even no other node exist. - if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then - MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ - | egrep -v "^(@(end )?menu$|\* Index::.*)$") - fi - - # Re-defined menu of chapters based on action. - case $ACTION in - 'remove-entry' ) - # Remove chapter from menu. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ - | egrep -v "^\* ${MANUAL_CHAPTER_NAME}::[[:print:]]*$") - ;; - 'update-entry' | * ) - # Update chapter menu using texinfo format. - MENUCHAPTERS="${MENUCHAPTERS} - * ${MANUAL_CHAPTER_NAME}::" - ;; - esac - - # Remove opening spaces/tabs and empty line from the menu of - # chapters. Empty lines may occur the first time the menu of - # chapters is created. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ - | 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} - * 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}" > ${MANUAL_BASEFILE}-menu.texi - -} diff --git a/Scripts/Functions/Help/help_updateChaptersNodes.sh b/Scripts/Functions/Help/help_updateChaptersNodes.sh deleted file mode 100755 index 3d00125..0000000 --- a/Scripts/Functions/Help/help_updateChaptersNodes.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# help_updateChaptersNodes.sh -- This function updates nodes of -# chapters based on menu of chapters. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateChaptersNodes { - - # Build list "nodes of chapters" based on menu of chapters. - local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ - | 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" > ${MANUAL_BASEFILE}-nodes.texi - -} diff --git a/Scripts/Functions/Help/help_updateMenu.sh b/Scripts/Functions/Help/help_updateMenu.sh deleted file mode 100755 index d8e5a6e..0000000 --- a/Scripts/Functions/Help/help_updateMenu.sh +++ /dev/null @@ -1,82 +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, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateMenu { - - # Specify which action to do inside chapter's menu. - local ACTION="$1" - - # Build the menu node related to the entry being processed - # currently. - local MENUNODE=$(echo "$ENTRY" | cut -d / -f8- | tr '/' ' ' \ - | sed 's!\.texi$!!') - - # Give format to menu line using texinfo style. - local MENULINE="* ${MANUAL_CHAPTER_NAME} $MENUNODE::" - - # Define chapter's menu. Remove `@menu', `@end menu', and empty lines - # from output. - local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ - | 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" > $MANUAL_CHAPTER_DIR/chapter-menu.texi - -} diff --git a/Scripts/Functions/Help/help_updateNodes.sh b/Scripts/Functions/Help/help_updateNodes.sh deleted file mode 100755 index dd03df2..0000000 --- a/Scripts/Functions/Help/help_updateNodes.sh +++ /dev/null @@ -1,81 +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, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateNodes { - - local TEXINFO_TEMPLATE='' - - # Retrive nodes' entries from chapter-menu.texi file. - local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ - | 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' | sed "s!${MANUAL_CHAPTER_NAME}/!!") - INCL=$(echo "$NODE" | sed -r 's! !/!g').texi - CIND=$(echo "$NODE") - - # Create an empty directory to store texinfo files. - if [[ ! -d ${MANUAL_BASEDIR}/$(dirname "$INCL") ]];then - mkdir -p ${MANUAL_BASEDIR}/$(dirname "$INCL") - fi - - # Create texinfo section file using templates. - if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]];then - - # Define what template to apply using the absolute path of - # the documentation entry as reference. - if [[ ${MANUAL_BASEDIR}/${INCL} =~ 'trunk/Scripts/Functions/.+' ]];then - TEXINFO_TEMPLATE="${FUNCCONFIG}/manual-section-functions.texi" - else - TEXINFO_TEMPLATE="${FUNCCONFIG}/manual-section.texi" - fi - - # Copy template to its destination. - cp ${TEXINFO_TEMPLATE} ${MANUAL_BASEDIR}/$INCL - - # Expand common translation markers. - cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL" - - # Expand texinfo-specific translation markers. - ${FUNCNAM}_doTexinfoSeealso "${MANUAL_BASEDIR}/$INCL" "$NODE" - - fi - - # Output node information based on texinfo menu. - echo "@node $NODE" - echo "@section `eval_gettext "The @file{\\\$SECT} Directory"`" - echo "@cindex $CIND" - echo "@include $INCL" - echo "" - - # Dump node information into chapter node file. - done > $MANUAL_CHAPTER_DIR/chapter-nodes.texi - -} - diff --git a/Scripts/Functions/Help/help_updateOutputFileInfo.sh b/Scripts/Functions/Help/help_updateOutputFileInfo.sh deleted file mode 100755 index 6e4ef9f..0000000 --- a/Scripts/Functions/Help/help_updateOutputFileInfo.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFileInfo.sh -- This function exports -# documentation manual to info format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateOutputFileInfo { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-updating-line - - # Update info file. - /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info - - # Compress info file. - if [[ $? -eq 0 ]];then - bzip2 -f ${MANUAL_BASEFILE}.info - fi - -} diff --git a/Scripts/Functions/Help/help_updateOutputFilePdf.sh b/Scripts/Functions/Help/help_updateOutputFilePdf.sh deleted file mode 100755 index da151b1..0000000 --- a/Scripts/Functions/Help/help_updateOutputFilePdf.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFilePdf.sh -- This function exports documentation -# manual to PDF format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateOutputFilePdf { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.pdf" --as-updating-line - - # Update plaintext output directory. - /usr/bin/texi2pdf --quiet \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf - -} diff --git a/Scripts/Functions/Help/help_updateOutputFilePlaintext.sh b/Scripts/Functions/Help/help_updateOutputFilePlaintext.sh deleted file mode 100755 index 725658c..0000000 --- a/Scripts/Functions/Help/help_updateOutputFilePlaintext.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFilePlaintext.sh -- This function exports -# documentation manual to plain-text format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateOutputFilePlaintext { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" --as-updating-line - - # Update plaintext output directory. - /usr/bin/makeinfo --plaintext \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt - - # Compress plaintext output file. - if [[ -f ${MANUAL_BASEFILE}.txt ]];then - bzip2 ${MANUAL_BASEFILE}.txt --force - fi - -} diff --git a/Scripts/Functions/Help/help_updateOutputFileXhtml.sh b/Scripts/Functions/Help/help_updateOutputFileXhtml.sh deleted file mode 100755 index 4d7150d..0000000 --- a/Scripts/Functions/Help/help_updateOutputFileXhtml.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFileXhtml.sh -- This function exports -# documentation manual to HTML format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateOutputFileXhtml { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.xhtml.tar.bz2" --as-updating-line - - # Redefine manual base file to use just the file base name. - local MANUAL_BASEFILE=$(basename "$MANUAL_BASEFILE") - - # Add manual base directory path into directory stack to make it - # the current working directory. This is done to reduce the path - # information packaged inside `repository.xhtml.tar.bz2' file. - pushd ${MANUAL_BASEDIR} > /dev/null - - # Prepare directory structure where xhtml files will be stored in. - [[ ! -d ${MANUAL_BASEFILE}.xhtml ]] && mkdir -p ${MANUAL_BASEFILE}.xhtml - - # Clean up directory structure where xhtml files will be stored. - # We don't want to have unused files inside it. - [[ $(ls ${MANUAL_BASEFILE}.xhtml > /dev/null) ]] && rm ${MANUAL_BASEFILE}.xhtml/*.xhtml - - # Add directory where xhtml files will be sotred in into directory - # stack to make it the current working directory. This is required - # in order for include paths to be constructed correctly. - pushd ${MANUAL_BASEFILE}.xhtml > /dev/null - - # Update xhtml files. Use texi2html to export from texinfo file - # format to html using CentOS Web default visual style. - texi2html --init-file=${MANUAL_BASEDIR}/${MANUAL_BASEFILE}-init.pl \ - --output=${MANUAL_BASEDIR}/${MANUAL_BASEFILE}.xhtml \ - ${MANUAL_BASEDIR}/${MANUAL_BASEFILE}.texi - - # Remove directory where xhtml files are stored from directory - # stack. The xhtml files have been already created. - popd > /dev/null - - # Apply xhtml transformations. This transformation cannot be built - # inside the initialization script (repository.init). For example, - # I can't see a possible way to produce different quotation HTML - # outputs from the same texinfo quotation definition. Instead, - # once the HTML code is produced we can take que quotation HTML - # definition plus the first letters inside it and transform the - # structure to a completly different thing that can be handle - # through classed inside CSS definitions. - sed -r -i -f ${MANUAL_BASEFILE}.sed ${MANUAL_BASEFILE}.xhtml/*.xhtml - - # Compress directory structure where xhtml files are stored in. - # This compressed version is the one we put under version control. - # The directory used to build the compressed version is left - # unversion for the matter of human revision. - tar -cjf ${MANUAL_BASEFILE}.xhtml.tar.bz2 ${MANUAL_BASEFILE}.xhtml - - # Remove manual base directory from directory stack. - popd > /dev/null - -} diff --git a/Scripts/Functions/Help/help_updateOutputFileXml.sh b/Scripts/Functions/Help/help_updateOutputFileXml.sh deleted file mode 100755 index de6b717..0000000 --- a/Scripts/Functions/Help/help_updateOutputFileXml.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFileXml.sh -- This function exports documentation -# manual to XML format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateOutputFileXml { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.xml" --as-updating-line - - # Update xml output format. - /usr/bin/makeinfo --xml \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ - -} diff --git a/Scripts/Functions/Help/help_updateOutputFiles.sh b/Scripts/Functions/Help/help_updateOutputFiles.sh deleted file mode 100755 index 51faa5e..0000000 --- a/Scripts/Functions/Help/help_updateOutputFiles.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# help_updateOutputFiles.sh -- This function exports documentation -# manual to different output formats. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Project -# -# 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function help_updateOutputFiles { - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Add the working copy root directory to directory stack to make - # path construction correctly. Otherwise, makeinfo may produce - # paths incorrectly. - pushd ${HOME}/artwork > /dev/null - - help_updateOutputFileInfo - help_updateOutputFileXhtml - help_updateOutputFileXml - help_updateOutputFilePdf - help_updateOutputFilePlaintext - - # Remove the working copy root directory from directory stack. - popd > /dev/null - -}