From e31caf057015a3ce0c78072f3b503d1afb231e05 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jun 12 2011 02:30:36 +0000 Subject: Update directory structure of `help' functionality. --- diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_copyEntry.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_copyEntry.sh deleted file mode 100755 index 9c76505..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_copyEntry.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash -# -# texinfo_copyEntry.sh -- This function copies documentation entries -# inside the working copy and updates the documentation structure to -# reflect the changes. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_copyEntry { - - # Verify number of non-option arguments passed to centos-art.sh - # script. - if [[ $# -lt 2 ]];then - cli_printMessage "`gettext "Two paths are required."`" --as-error-line - elif [[ $# -gt 2 ]];then - cli_printMessage "`gettext "Only two paths are supported."`" --as-error-line - fi - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Define source documentation entry. This is the documentation - # entry that will be duplicated. - local MANUAL_ENTRY_SRC=$(${FLAG_BACKEND}_getEntry "${1}") - - # Define target documentation entry. This is the new documentation - # entry created from the source documentation entry. - local MANUAL_ENTRY_DST=$(${FLAG_BACKEND}_getEntry "${2}") - - # Verify parent directory of target documentation entry. If it - # doesn't exist, create it and add it to version control. - if [[ ! -d $(dirname ${MANUAL_ENTRY_DST}) ]];then - mkdir -p $(dirname ${MANUAL_ENTRY_DST}) - svn add $(dirname ${MANUAL_ENTRY_DST}) --quiet - fi - - # Copy source documentation entry to target documentation entry. - if [[ -f ${MANUAL_ENTRY_SRC} ]];then - if [[ ! -f ${MANUAL_ENTRY_DST} ]];then - cli_printMessage "${MANUAL_ENTRY_DST}" --as-creating-line - svn cp "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}" --quiet - else - cli_printMessage "`gettext "The target location is not valid."`" --as-error-line - fi - else - cli_printMessage "`gettext "The source location is not valid."`" --as-error-line - fi - - # Redefine both source and target locations to refer the directory - # where dependent documentation entries are stored in. - MANUAL_ENTRY_SRC=$(echo ${MANUAL_ENTRY_SRC} | sed -r "s/\.${FLAG_BACKEND}$//") - MANUAL_ENTRY_DST=$(echo ${MANUAL_ENTRY_DST} | sed -r "s/\.${FLAG_BACKEND}$//") - - # Copy dependent documentation entries, if any. - if [[ -d ${MANUAL_ENTRY_SRC} ]];then - if [[ ! -a ${MANUAL_ENTRY_DST} ]];then - cli_printMessage "${MANUAL_ENTRY_DST}" --as-creating-line - svn cp "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}" --quiet - fi - fi - - # Define list of target documentation entries. - local MANUAL_ENTRY='' - local MANUAL_ENTRIES=$(cli_getFilesList \ - $(dirname ${MANUAL_ENTRY_DST}) \ - --pattern="${MANUAL_ENTRY_DST}.*\.${FLAG_BACKEND}") - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Print action message. - cli_printMessage "`gettext "Updating menus, nodes and cross-references."`" --as-response-line - - # Loop through target documentation entries in order to update - # the documentation structure (e.g., It is not enough with copying - # documentation entry files, it is also needed to update menu, - # nodes and related cross-references). - for MANUAL_ENTRY in ${MANUAL_ENTRIES};do - - # Update menu and node definitions from manual sections to - # reflect the changes. - ${FLAG_BACKEND}_updateMenu - ${FLAG_BACKEND}_updateNodes - - # Update cross reference definitions from manual to reflect - # the changes. - ${FLAG_BACKEND}_restoreCrossReferences $MANUAL_ENTRY - - done - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_createChapters.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_createChapters.sh deleted file mode 100755 index 4bfe101..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_createChapters.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -# -# texinfo_createChapters.sh -- This function creates the chapters' -# base directory structure using templates as reference. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_createChapters { - - local MANUAL_CHAPTER_NAME='' - - # Define list of chapter templates files used as base to create - # the chapters' documentation manual. - local FILE='' - local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE} \ - --pattern='chapter(-menu|-nodes)?\.texinfo' --mindepth='2') - - # Loop through chapter structures and create them. - for FILE in $FILES;do - - # Redefine chapter directory based on template files. - MANUAL_CHAPTER_NAME=$(basename $(dirname ${FILE})) - - # Verify texinfo templates used as based to build the chapter. - # Be sure they are inside the working copy of CentOS Artwork - # Repository (-w) and under version control (-n), too. - cli_checkFiles ${FILE} -wn - - # Verify chapter's directory. If it doesn't exist, create it. - if [[ ! -d ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} ]];then - svn mkdir ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet - fi - - # Copy template files into chapter's directory. - svn cp ${FILE} ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet - - # Remove content from `chapter-nodes.texinfo' instance to - # start with a clean node structure. This file is also used by - # to create new repository documentation entries, but we don't - # need that information right now (when the `Directories' - # chapter structure is created), just an empty copy of the - # file. The node structure of `Directories' chapter is created - # automatically based on repository directory structure. - if [[ $FILE =~ "Directories/chapter-nodes\.texinfo$" ]];then - echo "" > ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${FLAG_BACKEND} - fi - - done - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_createStructure.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_createStructure.sh deleted file mode 100755 index 443564a..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_createStructure.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# texinfo_createStructure.sh -- This function creates the -# documentation structure of a manual using the current language as -# reference. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_createStructure { - - # Verify manual base directory. The manual base directory is where - # the whole documentation manual is stored in. If it already - # exist, assume it was correctly created in the past. - if [[ -d $MANUAL_BASEDIR ]];then - return - fi - - # Print action message. - cli_printMessage "-" --as-separator-line - cli_printMessage "`gettext "Creating manual structure."`" - - # Create the language-specific directory used to store all files - # related to documentation manual. - svn mkdir ${MANUAL_BASEDIR} --quiet - - # Define file names required to build the manual. - local FILE='' - local FILES=$(cli_getFilesList "${MANUAL_TEMPLATE}" \ - --maxdepth='1' \ - --pattern="repository(-menu|-nodes|-index)?\.${FLAG_BACKEND}") - - # Verify manual base file. The manual base file is where the - # documentation manual is defined in the backend format. Assuming - # no file exists (e.g., a new language-specific manual is being - # created), use texinfo templates for it. - for FILE in $FILES;do - if [[ ! -f ${MANUAL_BASEDIR}/$(basename ${FILE}) ]];then - cli_checkFiles ${FILE} -wn - svn cp ${FILE} ${MANUAL_BASEDIR}/$(basename ${FILE}) --quiet - cli_replaceTMarkers ${MANUAL_BASEDIR}/$(basename ${FILE}) - fi - done - - # Update manual chapter related files. - ${FLAG_BACKEND}_createChapters - - # Update manual chapter related menu. - ${FLAG_BACKEND}_updateChaptersMenu - - # Update manual chapter related nodes (based on chapter related - # menu). - ${FLAG_BACKEND}_updateChaptersNodes - - # Commit changes from working copy to central repository only. At - # this point, changes in the repository are not merged in the - # working copy, but chages in the working copy do are committed up - # to repository. - cli_commitRepoChanges ${MANUAL_BASEDIR} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_deleteCrossReferences.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_deleteCrossReferences.sh deleted file mode 100755 index 5cfd3e7..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_deleteCrossReferences.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# -# 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 texinfo_deleteEntry function, in order -# to keep cross reference information, inside the documentation -# manual, syncronized. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_deleteCrossReferences { - - local -a PATTERN - local -a REPLACE - - # Define documentation entry. - local MANUAL_ENTRY="$1" - - # Verify documentation entry. If documentation entry is empty, - # stop script execution with an error message. - if [[ $MANUAL_ENTRY == '' ]];then - cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line - fi - - # Build the node string using entry location. - local NODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") - - # 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 MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern=".*\.${FLAG_BACKEND}") - - # 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'. - # - # Inside the pattern space, the `\<' and `\>' are used to restrict - # the match pattern to a word boundary. The word boundary - # restriction applied here is required to avoid undesired - # replacements when we replace singular words with their plurals. - # For example, if we need to change the word `Manual' to its - # plular (i.e., `Manuals'), and no boundary restriction is used in - # the pattern space to do that, we might end up having words like - # `Manualsssss'. This is because this sed command might be applied - # to the same file many times; and each time it is applied a new - # `Manuals' replaces the previous `Manuals' replacement to form - # `Manualss', `Manualsss', and so on for each interaction. - sed -r -i ":a;N;s!\<${PATTERN[0]}\>!${REPLACE[0]}!g;ba" ${MANUAL_ENTRIES} - - # Update menu-related cross references. Menu-related cross - # references hardly appear in more than one line, so there is no - # need to complicate much the replacement command. - sed -r -i "s!\<${PATTERN[1]}\>!${REPLACE[1]}!" ${MANUAL_ENTRIES} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_deleteEntry.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_deleteEntry.sh deleted file mode 100755 index 1acb27e..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_deleteEntry.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash -# -# texinfo_deleteEntry.sh -- This function removes a documentation entry -# from documentation directory structure. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_deleteEntry { - - local MANUAL_ENTRY='' - local MANUAL_ENTRY_DIR='' - local MANUAL_ENTRY_SUBDIR='' - - # Define list of entries to remove using the entry specified in - # the command line. - local MANUAL_ENTRIES=$(${FLAG_BACKEND}_getEntry "$@") - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Define list of dependen entries. Dependent entries are stored - # inside a directory with the same name of the entry being - # removed. - for MANUAL_ENTRY in $MANUAL_ENTRIES;do - - # Define directory where dependent documentation entries are - # stored in. - MANUAL_ENTRY_DIR=$(echo $MANUAL_ENTRY | sed -r "s/\.${FLAG_BACKEND}$//") - - if [[ -d $MANUAL_ENTRY_DIR ]];then - - # Add dependent documentation entries to the list of - # documentation entries that will be deleted. - MANUAL_ENTRIES="${MANUAL_ENTRIES} $(cli_getFilesList ${MANUAL_ENTRY_DIR} --pattern=".*\.${FLAG_BACKEND}")" - - for MANUAL_ENTRY in $MANUAL_ENTRIES;do - - # Define directory name for dependent documentation - # entries which have their own dependent directories. - MANUAL_ENTRY_SUBDIR=$(basename $MANUAL_ENTRY | sed -r "s/\.${FLAG_BACKEND}$//") - - # Add directory paths from dependent documentation - # entries which have their own dependent directories - # to the list of documentation entries that will be - # deleted. - MANUAL_ENTRIES="${MANUAL_ENTRIES} $(cli_getFilesList \ - ${MANUAL_ENTRY_DIR} \ - --pattern=".*/${MANUAL_ENTRY_SUBDIR}" \ - --type='d')" - - done - - fi - - done - - # Sanitate list of documentation entries that will be removed. - MANUAL_ENTRIES=$(echo ${MANUAL_ENTRIES} | tr ' ' "\n" | sort -r | uniq | tr "\n" ' ') - - # Verify existence of entries before deleting them. We cannot - # delete an entry which doesn't exist. Assuming that an entry - # doesn't exist, end script execution with an error message. - cli_checkFiles "$MANUAL_ENTRIES" - - # Remove documentation entry using Subversion's `delete' command - # to know when the action took place. Do not use regular `rm' - # command here. - for MANUAL_ENTRY in $MANUAL_ENTRIES;do - cli_printMessage "$MANUAL_ENTRY" --as-deleting-line - svn del ${MANUAL_ENTRY} --quiet - done - - # Verify exit status from subversion command to be sure everything - # went well. Otherwise stop script execution with an error - # message. - if [[ $? -ne 0 ]];then - cli_printMessage "`gettext "An error occurred when deleting entries."`" --as-toknowmore-line - fi - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Print action message. - cli_printMessage "`gettext "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 MANUAL_ENTRY in ${MANUAL_ENTRIES};do - - # Skip all directories, they are not documentation entries on - # themselves. Use documentation entries only. - if [[ ! $MANUAL_ENTRY =~ "\.${FLAG_BACKEND}$" ]];then - continue - fi - - # Update menu and node definitions from manual sections to - # reflect the changes. - ${FLAG_BACKEND}_updateMenu "remove-entry" - ${FLAG_BACKEND}_updateNodes - - # Update cross reference definitions from manual to reflect - # the changes. - ${FLAG_BACKEND}_deleteCrossReferences $MANUAL_ENTRY - - done - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_editEntry.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_editEntry.sh deleted file mode 100755 index e32a01b..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_editEntry.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# -# texinfo_editEntry.sh -- This function implements the edition flow of -# documentation entries inside the working copy. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_editEntry { - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Verify section definition inside chapters. - if [[ ! -f $MANUAL_ENTRY ]];then - - # Verify the parent directory of documentation entry. If the - # parent directory of the current documentation entry doesn't - # exist, create it and be sure it is added to version control. - # Also, verify that the parent directory of the documentation - # entry can be created. Otherwise, stop script execution with - # an error for the user to be aware of it. - if [[ ! -d $(dirname $(dirname $MANUAL_ENTRY)) ]];then - cli_printMessage "`gettext "The documentation entry provided hasn't a parent directory."`" --as-error-line - elif [[ ! -d $(dirname $MANUAL_ENTRY) ]];then - svn mkdir $(dirname ${MANUAL_ENTRY}) --quiet - fi - - # Print confirmation question. - cli_printMessage "`gettext "The following documentation section will be created:"`" - cli_printMessage "$MANUAL_ENTRY" --as-response-line - cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line - - # Update chapter section related menu. - ${FLAG_BACKEND}_updateMenu - - # Update chapter section related nodes (based on chapter - # section related menu). - ${FLAG_BACKEND}_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. - ${FLAG_BACKEND}_restoreCrossReferences $MANUAL_ENTRY - - else - - # Print action message. - cli_printMessage "$MANUAL_ENTRY" --as-updating-line - - fi - - # Use default text editor to edit the documentation entry. - eval $EDITOR $MANUAL_ENTRY - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getChapterDir.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getChapterDir.sh deleted file mode 100755 index a2edcf7..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getChapterDir.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# texinfo_getChapterDir.sh -- This function outputs the entry's -# chapter directory. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_getChapterDir { - - local MANUAL_ENTRY='' - local MANUAL_ENTRIES="$1" - - # At this point, we need to take a desition about documentation - # design, in order to answer the question: How do we assign - # chapters, sections and subsections automatically, based on the - # repository structure? and also, how such design could be - # adapted to changes in the repository structure? - # - # One solution would be: represent the repository's directory - # structure as sections inside a chapter named `Directories' or - # something similar. Subsections and subsubsections will not have - # their own files, they all will be written inside the same - # section file that represents the repository documentation entry. - for MANUAL_ENTRY in $MANUAL_ENTRIES;do - ${FLAG_BACKEND}_getEntry $MANUAL_ENTRY | cut -d / -f-8 - done | sort | uniq - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh deleted file mode 100755 index 174e0e5..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getEntry.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# -# 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 Artwork SIG -# -# 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 texinfo_getEntry { - - # Define variables as local to avoid conflicts outside. - local MANUAL_ENTRY='' - local LOCATION='' - local LOCATIONS='' - - # Redefine locations in order to make this function reusable not - # just for action value variable but whatever value passed as - # first possitional argument. - if [[ "$@" != '' ]];then - LOCATIONS="$@" - else - LOCATIONS="$ACTIONVAL" - fi - - for LOCATION in $LOCATIONS;do - - # Sanitate action value to use absolute paths. - LOCATION=$(cli_checkRepoDirSource $LOCATION) - - # Define relative path of entry, from trunk directory on. - MANUAL_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. - if [[ ${MANUAL_ENTRY} =~ "\.${FLAG_BACKEND}$" ]];then - MANUAL_ENTRY=$(echo ${MANUAL_ENTRY} \ - | sed "s!trunk/Manuals/RepoReference/!!") - else - MANUAL_ENTRY=$(dirname ${MANUAL_CHAPTER_NAME}/${MANUAL_ENTRY})/$(basename $LOCATION).${FLAG_BACKEND} - fi - - # Re-define entry to set absolute path to manuals base - # directory structure. - MANUAL_ENTRY=${MANUAL_BASEDIR}/${MANUAL_ENTRY} - - # Output entry's absolute path. - echo ${MANUAL_ENTRY} - - done - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh deleted file mode 100755 index 36f93f4..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_getNode.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# 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 Artwork SIG -# -# 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 texinfo_getNode { - - # Define documentation entry. - local MANUAL_ENTRY="$1" - - # Verify documentation entry. - if [[ $MANUAL_ENTRY == '' ]];then - cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line - fi - - # Define node from documentation entry. - local NODE=$(echo "$MANUAL_ENTRY" | sed -r \ - -e "s!^${MANUAL_BASEDIR}!!" \ - -e "s/(chapter-intro\.${FLAG_BACKEND}|\.${FLAG_BACKEND})$//" \ - -e 's!/! !g' \ - -e 's!^[[:space:]]+!!') - - echo "$NODE" - -} - diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_makeSeeAlso.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_makeSeeAlso.sh deleted file mode 100755 index 05b8010..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_makeSeeAlso.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# 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 Artwork SIG -# -# 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 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 '\\n@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/Backends/Texinfo/texinfo_renameCrossReferences.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_renameCrossReferences.sh deleted file mode 100755 index a2f687e..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_renameCrossReferences.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# 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 Artwork SIG -# -# 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 texinfo_renameCrossReferences { - - local MANUAL_ENTRY_SRC=$(${FLAG_BACKEND}_getEntry "$1") - local MANUAL_ENTRY_DST=$(${FLAG_BACKEND}_getEntry "$2") - - # Define node pattern for source documenation entry. - local NODE_SRC=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_SRC") - - # Define node replacement for target documentation entry. - local NODE_DST=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_DST") - - # Define list of entries to process. - local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern=".*\.${FLAG_BACKEND}") - - # 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'. - # - # Inside the pattern space, the `\<' and `\>' are used to restrict - # the match pattern to a word boundary. The word boundary - # restriction applied here is required to avoid undesired - # replacements when we replace singular words with their plurals. - # For example, if we need to change the word `Manual' to its - # plular (i.e., `Manuals'), and no boundary restriction is used in - # the pattern space to do that, we might end up having words like - # `Manualsssss'. This is because this sed command might be applied - # to the same file many times; and each time it is applied a new - # `Manuals' replaces the previous `Manuals' replacement to form - # `Manualss', `Manualsss', and so on for each interaction. - sed -r -i ":a;N;s!\<${NODE_SRC}\>!${NODE_DST}!g;ba" ${MANUAL_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. - ${FLAG_BACKEND}_restoreCrossReferences "${MANUAL_ENTRY_DST}" - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_renameEntry.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_renameEntry.sh deleted file mode 100755 index 09fff4a..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_renameEntry.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# texinfo_renameEntry.sh -- This function renames documentation entries -# and updates documentation structure to reflect changes. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_renameEntry { - - # Copy source documentation entry. - ${FLAG_BACKEND}_copyEntry "$1" "$2" - - # Delete source documentation entry. The source documentation - # entry has been copied already, so to create the rename effect - # delete it from repository filesystem. - ${FLAG_BACKEND}_deleteEntry "$1" - - # 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. - ${FLAG_BACKEND}_renameCrossReferences "$1" "$2" - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_restoreCrossReferences.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_restoreCrossReferences.sh deleted file mode 100755 index 3b2b053..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_restoreCrossReferences.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -# -# 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 -# texinfo_deleteCrossReferences function. The -# texinfo_restoreCrossReferences function relays in the removed -# message format produced by texinfo_deleteCrossReferences -# function, in order to return them back into the link format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_restoreCrossReferences { - - local -a PATTERN - local -a REPLACE - - # Define documentation entry. - local MANUAL_ENTRY="$1" - - # Verify documentation entry. If documentation entry is empty, - # stop script execution with an error message. - if [[ $MANUAL_ENTRY == '' ]];then - cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line - fi - - # Build the node string using entry location. - local NODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") - - # 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 MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern=".*\.${FLAG_BACKEND}") - - # 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'. - # - # Inside the pattern space, the `\<' and `\>' are used to restrict - # the match pattern to a word boundary. The word boundary - # restriction applied here is required to avoid undesired - # replacements when we replace singular words with their plurals. - # For example, if we need to change the word `Manual' to its - # plular (i.e., `Manuals'), and no boundary restriction is used in - # the pattern space to do that, we might end up having words like - # `Manualsssss'. This is because this sed command might be applied - # to the same file many times; and each time it is applied a new - # `Manuals' replaces the previous `Manuals' replacement to form - # `Manualss', `Manualsss', and so on for each interaction. - sed -r -i ":a;N;s!\<${PATTERN[0]}\>!${REPLACE[0]}!g;ba" ${MANUAL_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]}!" ${MANUAL_ENTRIES} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchIndex.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchIndex.sh deleted file mode 100644 index 3d96c7a..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchIndex.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# texinfo_searchIndex.sh -- This function does an index search inside the -# info document. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_searchIndex { - - # Rebuild output files to propagate recent changes. - ${FLAG_BACKEND}_updateOutputFiles - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # 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/Backends/Texinfo/texinfo_searchNode.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchNode.sh deleted file mode 100755 index 2a28295..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_searchNode.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# texinfo_searchNode.sh -- This function does a node search inside the -# info document. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_searchNode { - - # Print separator line. - cli_printMessage '-' --as-separator-line - - # Define list of documentation entries. - local MANUAL_ENTRY='' - local MANUAL_ENTRIES=$(${FLAG_BACKEND}_getEntry "$@") - - # Loop through manual entries and read related node. - for MANUAL_ENTRY in $MANUAL_ENTRIES;do - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line - - # Check documentation entry inside documentation structure. If - # the documentation entry exits use the info reader to open - # the info file at the specified node for reading it on the - # terminal. Otherwise, ask the user to create it. - if [[ -f "$MANUAL_ENTRY" ]];then - /usr/bin/info --node="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY")" --file=${MANUAL_BASEFILE}.info.bz2 - else - ${FLAG_BACKEND}_editEntry - fi - - done - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateChaptersMenu.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateChaptersMenu.sh deleted file mode 100755 index 2fd2f40..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateChaptersMenu.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# -# texinfo_updateChaptersMenu.sh -- This function updates chapter menu. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 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.texinfo) 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.${FLAG_BACKEND} ]];then - MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.${FLAG_BACKEND} \ - | egrep -v "^@(end )?menu$" | egrep -v '^\* 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.${FLAG_BACKEND} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateChaptersNodes.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateChaptersNodes.sh deleted file mode 100755 index 18541a6..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateChaptersNodes.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# -# texinfo_updateChaptersNodes.sh -- This function updates nodes of -# chapters based on menu of chapters. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateChaptersNodes { - - # Build list "nodes of chapters" based on menu of chapters. - local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.${FLAG_BACKEND} \ - | egrep -v '^@(end )?menu$' | egrep -v '^\* Index::$'\ - | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ - | sed -r 's! !_!g' | sort | uniq ) - - # Build list of texinfo inclusions to load chapters' nodes. Don't - # include `Index' chapter here, it has been already included in - # the `repository.texinfo' file. - local FILENODE=$(\ - for CHAPTERNODE in ${CHAPTERNODES};do - INCL=$(echo ${CHAPTERNODE} \ - | sed -r "s!(${CHAPTERNODE})!\1/chapter\.${FLAG_BACKEND}!") - # Output inclusion line using texinfo format. - echo "@include $INCL" - done) - - # Dump organized nodes of chapters into file. - echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.${FLAG_BACKEND} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateMenu.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateMenu.sh deleted file mode 100755 index 874660d..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateMenu.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# 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 Artwork SIG -# -# 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 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=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") - - # Give format to menu line using texinfo style. - local MENULINE="* ${MENUNODE}::" - - # Define chapter's menu. Remove `@menu', `@end menu' and empty - # lines from output. - local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${FLAG_BACKEND} \ - | 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 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.${FLAG_BACKEND} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateNodes.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateNodes.sh deleted file mode 100755 index 4ac333a..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateNodes.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -# -# texinfo_updateNodes.sh -- This function updates chapter's nodes -# definition using the chapter's menu as reference. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateNodes { - - # Retrive nodes' entries from chapter-menu.texinfo file. - local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${FLAG_BACKEND} \ - | 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}" | cut -d' ' -f2- | sed -r 's! !/!g') - INCL=$(echo "${NODE}" | sed -r 's! !/!g').${FLAG_BACKEND} - CIND=$(echo "${NODE}") - - # Create texinfo section file using templates, only if the - # section file doesn't exist and hasn't been marked for - # deletion. Otherwise, when the files have been marked for - # deletion, they will be created again from texinfo template - # to working copy and that might create confusion. - if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]] \ - && [[ $(cli_getRepoStatus ${MANUAL_BASEDIR}/$INCL) != 'D' ]];then - - # Define absolute path to section templates assignment - # file. This is the file that hold the relation between - # section template files and repository paths when - # documentation entries are created. - local CONFFILE="${MANUAL_TEMPLATE}/${MANUAL_NAME}.conf" - - # Verify existence of configuration file. - cli_checkFiles $CONFFILE - - # Retrive configuration lines from configuration file. Be - # sure no line begining with `#' or space remain in the - # line. Otherwise, it would be difficult to loop through - # configuration lines. - local CONFLINE='' - local CONFLINES=$(cat ${CONFFILE} \ - | egrep -v '^#' \ - | egrep -v '^[[:space:]]*$' \ - | sed -r 's![[:space:]]*!!g') - - # Initialize both left hand side and right hand side - # configuration values. - local CONFLHS='' - local CONFRHS='' - - # Initialize absolute path to final texinfo template. - local TEMPLATE='' - - # Define what section template to apply using - # documentation entry absolute path and values provided by - # configuration line. Be sure to break the loop in the - # first match. - for CONFLINE in $CONFLINES;do - - CONFLHS=$(echo $CONFLINE \ - | gawk 'BEGIN{FS = "="}; { print $1 }' \ - | sed -r 's![[:space:]]*!!g') - - CONFRHS=$(echo $CONFLINE \ - | gawk 'BEGIN{FS = "="}; { print $2 }' \ - | sed -r 's![[:space:]]*!!g' | sed -r 's!^"(.+)"$!\1!') - - if [[ ${MANUAL_BASEDIR}/${INCL} =~ $CONFRHS ]];then - TEMPLATE="${MANUAL_TEMPLATE}/${CONFLHS}" - break - fi - - done - - # Verify existence of texinfo template file. If no - # template is found, stop script execution with an error - # message. We cannot continue without it. - cli_checkFiles $TEMPLATE - - # Create documentation entry using texinfo template as - # reference. - svn cp ${TEMPLATE} ${MANUAL_BASEDIR}/$INCL --quiet - - # Expand common translation markers in documentation entry. - cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL" - - # Expand `Goals' subsection translation markers in - # documentation entry. - sed -i -r "s!=SECT=!${SECT}!g" "${MANUAL_BASEDIR}/$INCL" - - # Expand `See also' subsection translation markers in - # documentation entry. - ${FLAG_BACKEND}_makeSeeAlso "${MANUAL_BASEDIR}/$INCL" "$NODE" - - fi - - # Verify existence of chapter-nodes template files. If no - # chapter-nodes template is found, stop script execution with - # an error message. We cannot continue without it. - cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${FLAG_BACKEND} - - # Output node information chapter-nodes template file using - # the current texinfo menu information. - cat ${MANUAL_TEMPLATE}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${FLAG_BACKEND} \ - | sed -r -e "s!=NODE=!${NODE}!g" -e "s!=SECT=!${SECT}!g" \ - -e "s!=CIND=!${CIND}!g" -e "s!=INCL=!${INCL}!g" - - # Dump node definitions into document structure. - done > $MANUAL_CHAPTER_DIR/chapter-nodes.${FLAG_BACKEND} - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileInfo.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileInfo.sh deleted file mode 100755 index a8ea1ad..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileInfo.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# texinfo_updateOutputFileInfo.sh -- This function exports -# documentation manual to info format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateOutputFileInfo { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-updating-line - - # Update info file. - /usr/bin/makeinfo --output=${MANUAL_BASEFILE}.info \ - --enable-encoding \ - ${MANUAL_BASEFILE}.${FLAG_BACKEND} - - # Compress info file. - if [[ $? -eq 0 ]];then - bzip2 -f ${MANUAL_BASEFILE}.info - fi - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFilePdf.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFilePdf.sh deleted file mode 100755 index 8997007..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFilePdf.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# texinfo_updateOutputFilePdf.sh -- This function exports documentation -# manual to PDF format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateOutputFilePdf { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.pdf" --as-updating-line - - # Update plaintext output directory. - /usr/bin/texi2pdf --quiet \ - ${MANUAL_BASEFILE}.${FLAG_BACKEND} --output=${MANUAL_BASEFILE}.pdf - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFilePlaintext.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFilePlaintext.sh deleted file mode 100755 index b2fbc52..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFilePlaintext.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# texinfo_updateOutputFilePlaintext.sh -- This function exports -# documentation manual to plain-text format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateOutputFilePlaintext { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" --as-updating-line - - # Update plaintext output directory. - /usr/bin/makeinfo --plaintext \ - ${MANUAL_BASEFILE}.${FLAG_BACKEND} --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/Backends/Texinfo/texinfo_updateOutputFileXhtml.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileXhtml.sh deleted file mode 100755 index 969f166..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileXhtml.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash -# -# texinfo_updateOutputFileXhtml.sh -- This function exports -# documentation manual to HTML format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateOutputFileXhtml { - - # Verify initialization files used by texi2html. - cli_checkFiles ${MANUAL_BACKEND}/${MANUAL_NAME}-init.pl - cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_NAME}-init.pl - - # Verify transformation files used to modify texi2html output. - cli_checkFiles ${MANUAL_BACKEND}/${MANUAL_NAME}.sed - cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_NAME}.sed - - # 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 xhtml using CentOS Web default visual style. - texi2html --lang=$(cli_getCurrentLocale --langcode-only) \ - --init-file=${MANUAL_BACKEND}/${MANUAL_NAME}-init.pl \ - --init-file=${MANUAL_TEMPLATE}/${MANUAL_NAME}-init.pl \ - --output=${MANUAL_BASEDIR}/${MANUAL_NAME}.xhtml \ - ${MANUAL_BASEDIR}/${MANUAL_NAME}.${FLAG_BACKEND} - - # 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.pl). For example, - # Would it be 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_BACKEND}/${MANUAL_NAME}.sed \ - -f ${MANUAL_TEMPLATE}/${MANUAL_NAME}.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/Backends/Texinfo/texinfo_updateOutputFileXml.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileXml.sh deleted file mode 100755 index 4606b15..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFileXml.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# texinfo_updateOutputFileXml.sh -- This function exports documentation -# manual to XML format. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 texinfo_updateOutputFileXml { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.xml" --as-updating-line - - # Update xml output format. - /usr/bin/makeinfo --xml \ - ${MANUAL_BASEFILE}.${FLAG_BACKEND} --output=${MANUAL_BASEFILE}.xml \ - -} diff --git a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFiles.sh b/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFiles.sh deleted file mode 100755 index beba642..0000000 --- a/Scripts/Functions/Help/Backends/Texinfo/texinfo_updateOutputFiles.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# texinfo_updateOutputFiles.sh -- This function exports documentation -# manual to different output formats. -# -# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG -# -# 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 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 - - ${FLAG_BACKEND}_updateOutputFileInfo - ${FLAG_BACKEND}_updateOutputFileXhtml - ${FLAG_BACKEND}_updateOutputFileXml - ${FLAG_BACKEND}_updateOutputFilePdf - ${FLAG_BACKEND}_updateOutputFilePlaintext - - # Remove the working copy root directory from directory stack. - popd > /dev/null - -} diff --git a/Scripts/Functions/Help/help_copyEntry.sh b/Scripts/Functions/Help/help_copyEntry.sh new file mode 100755 index 0000000..9c76505 --- /dev/null +++ b/Scripts/Functions/Help/help_copyEntry.sh @@ -0,0 +1,109 @@ +#!/bin/bash +# +# texinfo_copyEntry.sh -- This function copies documentation entries +# inside the working copy and updates the documentation structure to +# reflect the changes. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_copyEntry { + + # Verify number of non-option arguments passed to centos-art.sh + # script. + if [[ $# -lt 2 ]];then + cli_printMessage "`gettext "Two paths are required."`" --as-error-line + elif [[ $# -gt 2 ]];then + cli_printMessage "`gettext "Only two paths are supported."`" --as-error-line + fi + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define source documentation entry. This is the documentation + # entry that will be duplicated. + local MANUAL_ENTRY_SRC=$(${FLAG_BACKEND}_getEntry "${1}") + + # Define target documentation entry. This is the new documentation + # entry created from the source documentation entry. + local MANUAL_ENTRY_DST=$(${FLAG_BACKEND}_getEntry "${2}") + + # Verify parent directory of target documentation entry. If it + # doesn't exist, create it and add it to version control. + if [[ ! -d $(dirname ${MANUAL_ENTRY_DST}) ]];then + mkdir -p $(dirname ${MANUAL_ENTRY_DST}) + svn add $(dirname ${MANUAL_ENTRY_DST}) --quiet + fi + + # Copy source documentation entry to target documentation entry. + if [[ -f ${MANUAL_ENTRY_SRC} ]];then + if [[ ! -f ${MANUAL_ENTRY_DST} ]];then + cli_printMessage "${MANUAL_ENTRY_DST}" --as-creating-line + svn cp "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}" --quiet + else + cli_printMessage "`gettext "The target location is not valid."`" --as-error-line + fi + else + cli_printMessage "`gettext "The source location is not valid."`" --as-error-line + fi + + # Redefine both source and target locations to refer the directory + # where dependent documentation entries are stored in. + MANUAL_ENTRY_SRC=$(echo ${MANUAL_ENTRY_SRC} | sed -r "s/\.${FLAG_BACKEND}$//") + MANUAL_ENTRY_DST=$(echo ${MANUAL_ENTRY_DST} | sed -r "s/\.${FLAG_BACKEND}$//") + + # Copy dependent documentation entries, if any. + if [[ -d ${MANUAL_ENTRY_SRC} ]];then + if [[ ! -a ${MANUAL_ENTRY_DST} ]];then + cli_printMessage "${MANUAL_ENTRY_DST}" --as-creating-line + svn cp "${MANUAL_ENTRY_SRC}" "${MANUAL_ENTRY_DST}" --quiet + fi + fi + + # Define list of target documentation entries. + local MANUAL_ENTRY='' + local MANUAL_ENTRIES=$(cli_getFilesList \ + $(dirname ${MANUAL_ENTRY_DST}) \ + --pattern="${MANUAL_ENTRY_DST}.*\.${FLAG_BACKEND}") + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "`gettext "Updating menus, nodes and cross-references."`" --as-response-line + + # Loop through target documentation entries in order to update + # the documentation structure (e.g., It is not enough with copying + # documentation entry files, it is also needed to update menu, + # nodes and related cross-references). + for MANUAL_ENTRY in ${MANUAL_ENTRIES};do + + # Update menu and node definitions from manual sections to + # reflect the changes. + ${FLAG_BACKEND}_updateMenu + ${FLAG_BACKEND}_updateNodes + + # Update cross reference definitions from manual to reflect + # the changes. + ${FLAG_BACKEND}_restoreCrossReferences $MANUAL_ENTRY + + done + +} diff --git a/Scripts/Functions/Help/help_createChapters.sh b/Scripts/Functions/Help/help_createChapters.sh new file mode 100755 index 0000000..4bfe101 --- /dev/null +++ b/Scripts/Functions/Help/help_createChapters.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# texinfo_createChapters.sh -- This function creates the chapters' +# base directory structure using templates as reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_createChapters { + + local MANUAL_CHAPTER_NAME='' + + # Define list of chapter templates files used as base to create + # the chapters' documentation manual. + local FILE='' + local FILES=$(cli_getFilesList ${MANUAL_TEMPLATE} \ + --pattern='chapter(-menu|-nodes)?\.texinfo' --mindepth='2') + + # Loop through chapter structures and create them. + for FILE in $FILES;do + + # Redefine chapter directory based on template files. + MANUAL_CHAPTER_NAME=$(basename $(dirname ${FILE})) + + # Verify texinfo templates used as based to build the chapter. + # Be sure they are inside the working copy of CentOS Artwork + # Repository (-w) and under version control (-n), too. + cli_checkFiles ${FILE} -wn + + # Verify chapter's directory. If it doesn't exist, create it. + if [[ ! -d ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} ]];then + svn mkdir ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet + fi + + # Copy template files into chapter's directory. + svn cp ${FILE} ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME} --quiet + + # Remove content from `chapter-nodes.texinfo' instance to + # start with a clean node structure. This file is also used by + # to create new repository documentation entries, but we don't + # need that information right now (when the `Directories' + # chapter structure is created), just an empty copy of the + # file. The node structure of `Directories' chapter is created + # automatically based on repository directory structure. + if [[ $FILE =~ "Directories/chapter-nodes\.texinfo$" ]];then + echo "" > ${MANUAL_BASEDIR}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${FLAG_BACKEND} + fi + + done + +} diff --git a/Scripts/Functions/Help/help_createStructure.sh b/Scripts/Functions/Help/help_createStructure.sh new file mode 100755 index 0000000..443564a --- /dev/null +++ b/Scripts/Functions/Help/help_createStructure.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# texinfo_createStructure.sh -- This function creates the +# documentation structure of a manual using the current language as +# reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_createStructure { + + # Verify manual base directory. The manual base directory is where + # the whole documentation manual is stored in. If it already + # exist, assume it was correctly created in the past. + if [[ -d $MANUAL_BASEDIR ]];then + return + fi + + # Print action message. + cli_printMessage "-" --as-separator-line + cli_printMessage "`gettext "Creating manual structure."`" + + # Create the language-specific directory used to store all files + # related to documentation manual. + svn mkdir ${MANUAL_BASEDIR} --quiet + + # Define file names required to build the manual. + local FILE='' + local FILES=$(cli_getFilesList "${MANUAL_TEMPLATE}" \ + --maxdepth='1' \ + --pattern="repository(-menu|-nodes|-index)?\.${FLAG_BACKEND}") + + # Verify manual base file. The manual base file is where the + # documentation manual is defined in the backend format. Assuming + # no file exists (e.g., a new language-specific manual is being + # created), use texinfo templates for it. + for FILE in $FILES;do + if [[ ! -f ${MANUAL_BASEDIR}/$(basename ${FILE}) ]];then + cli_checkFiles ${FILE} -wn + svn cp ${FILE} ${MANUAL_BASEDIR}/$(basename ${FILE}) --quiet + cli_replaceTMarkers ${MANUAL_BASEDIR}/$(basename ${FILE}) + fi + done + + # Update manual chapter related files. + ${FLAG_BACKEND}_createChapters + + # Update manual chapter related menu. + ${FLAG_BACKEND}_updateChaptersMenu + + # Update manual chapter related nodes (based on chapter related + # menu). + ${FLAG_BACKEND}_updateChaptersNodes + + # Commit changes from working copy to central repository only. At + # this point, changes in the repository are not merged in the + # working copy, but chages in the working copy do are committed up + # to repository. + cli_commitRepoChanges ${MANUAL_BASEDIR} + +} diff --git a/Scripts/Functions/Help/help_deleteCrossReferences.sh b/Scripts/Functions/Help/help_deleteCrossReferences.sh new file mode 100755 index 0000000..5cfd3e7 --- /dev/null +++ b/Scripts/Functions/Help/help_deleteCrossReferences.sh @@ -0,0 +1,96 @@ +#!/bin/bash +# +# 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 texinfo_deleteEntry function, in order +# to keep cross reference information, inside the documentation +# manual, syncronized. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_deleteCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. If documentation entry is empty, + # stop script execution with an error message. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Build the node string using entry location. + local NODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") + + # 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 MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern=".*\.${FLAG_BACKEND}") + + # 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'. + # + # Inside the pattern space, the `\<' and `\>' are used to restrict + # the match pattern to a word boundary. The word boundary + # restriction applied here is required to avoid undesired + # replacements when we replace singular words with their plurals. + # For example, if we need to change the word `Manual' to its + # plular (i.e., `Manuals'), and no boundary restriction is used in + # the pattern space to do that, we might end up having words like + # `Manualsssss'. This is because this sed command might be applied + # to the same file many times; and each time it is applied a new + # `Manuals' replaces the previous `Manuals' replacement to form + # `Manualss', `Manualsss', and so on for each interaction. + sed -r -i ":a;N;s!\<${PATTERN[0]}\>!${REPLACE[0]}!g;ba" ${MANUAL_ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate much the replacement command. + sed -r -i "s!\<${PATTERN[1]}\>!${REPLACE[1]}!" ${MANUAL_ENTRIES} + +} diff --git a/Scripts/Functions/Help/help_deleteEntry.sh b/Scripts/Functions/Help/help_deleteEntry.sh new file mode 100755 index 0000000..1acb27e --- /dev/null +++ b/Scripts/Functions/Help/help_deleteEntry.sh @@ -0,0 +1,134 @@ +#!/bin/bash +# +# texinfo_deleteEntry.sh -- This function removes a documentation entry +# from documentation directory structure. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_deleteEntry { + + local MANUAL_ENTRY='' + local MANUAL_ENTRY_DIR='' + local MANUAL_ENTRY_SUBDIR='' + + # Define list of entries to remove using the entry specified in + # the command line. + local MANUAL_ENTRIES=$(${FLAG_BACKEND}_getEntry "$@") + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define list of dependen entries. Dependent entries are stored + # inside a directory with the same name of the entry being + # removed. + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + + # Define directory where dependent documentation entries are + # stored in. + MANUAL_ENTRY_DIR=$(echo $MANUAL_ENTRY | sed -r "s/\.${FLAG_BACKEND}$//") + + if [[ -d $MANUAL_ENTRY_DIR ]];then + + # Add dependent documentation entries to the list of + # documentation entries that will be deleted. + MANUAL_ENTRIES="${MANUAL_ENTRIES} $(cli_getFilesList ${MANUAL_ENTRY_DIR} --pattern=".*\.${FLAG_BACKEND}")" + + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + + # Define directory name for dependent documentation + # entries which have their own dependent directories. + MANUAL_ENTRY_SUBDIR=$(basename $MANUAL_ENTRY | sed -r "s/\.${FLAG_BACKEND}$//") + + # Add directory paths from dependent documentation + # entries which have their own dependent directories + # to the list of documentation entries that will be + # deleted. + MANUAL_ENTRIES="${MANUAL_ENTRIES} $(cli_getFilesList \ + ${MANUAL_ENTRY_DIR} \ + --pattern=".*/${MANUAL_ENTRY_SUBDIR}" \ + --type='d')" + + done + + fi + + done + + # Sanitate list of documentation entries that will be removed. + MANUAL_ENTRIES=$(echo ${MANUAL_ENTRIES} | tr ' ' "\n" | sort -r | uniq | tr "\n" ' ') + + # Verify existence of entries before deleting them. We cannot + # delete an entry which doesn't exist. Assuming that an entry + # doesn't exist, end script execution with an error message. + cli_checkFiles "$MANUAL_ENTRIES" + + # Remove documentation entry using Subversion's `delete' command + # to know when the action took place. Do not use regular `rm' + # command here. + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + cli_printMessage "$MANUAL_ENTRY" --as-deleting-line + svn del ${MANUAL_ENTRY} --quiet + done + + # Verify exit status from subversion command to be sure everything + # went well. Otherwise stop script execution with an error + # message. + if [[ $? -ne 0 ]];then + cli_printMessage "`gettext "An error occurred when deleting entries."`" --as-toknowmore-line + fi + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Print action message. + cli_printMessage "`gettext "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 MANUAL_ENTRY in ${MANUAL_ENTRIES};do + + # Skip all directories, they are not documentation entries on + # themselves. Use documentation entries only. + if [[ ! $MANUAL_ENTRY =~ "\.${FLAG_BACKEND}$" ]];then + continue + fi + + # Update menu and node definitions from manual sections to + # reflect the changes. + ${FLAG_BACKEND}_updateMenu "remove-entry" + ${FLAG_BACKEND}_updateNodes + + # Update cross reference definitions from manual to reflect + # the changes. + ${FLAG_BACKEND}_deleteCrossReferences $MANUAL_ENTRY + + done + +} diff --git a/Scripts/Functions/Help/help_editEntry.sh b/Scripts/Functions/Help/help_editEntry.sh new file mode 100755 index 0000000..e32a01b --- /dev/null +++ b/Scripts/Functions/Help/help_editEntry.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# texinfo_editEntry.sh -- This function implements the edition flow of +# documentation entries inside the working copy. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_editEntry { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Verify section definition inside chapters. + if [[ ! -f $MANUAL_ENTRY ]];then + + # Verify the parent directory of documentation entry. If the + # parent directory of the current documentation entry doesn't + # exist, create it and be sure it is added to version control. + # Also, verify that the parent directory of the documentation + # entry can be created. Otherwise, stop script execution with + # an error for the user to be aware of it. + if [[ ! -d $(dirname $(dirname $MANUAL_ENTRY)) ]];then + cli_printMessage "`gettext "The documentation entry provided hasn't a parent directory."`" --as-error-line + elif [[ ! -d $(dirname $MANUAL_ENTRY) ]];then + svn mkdir $(dirname ${MANUAL_ENTRY}) --quiet + fi + + # Print confirmation question. + cli_printMessage "`gettext "The following documentation section will be created:"`" + cli_printMessage "$MANUAL_ENTRY" --as-response-line + cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line + + # Update chapter section related menu. + ${FLAG_BACKEND}_updateMenu + + # Update chapter section related nodes (based on chapter + # section related menu). + ${FLAG_BACKEND}_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. + ${FLAG_BACKEND}_restoreCrossReferences $MANUAL_ENTRY + + else + + # Print action message. + cli_printMessage "$MANUAL_ENTRY" --as-updating-line + + fi + + # Use default text editor to edit the documentation entry. + eval $EDITOR $MANUAL_ENTRY + +} diff --git a/Scripts/Functions/Help/help_getChapterDir.sh b/Scripts/Functions/Help/help_getChapterDir.sh new file mode 100755 index 0000000..a2edcf7 --- /dev/null +++ b/Scripts/Functions/Help/help_getChapterDir.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# texinfo_getChapterDir.sh -- This function outputs the entry's +# chapter directory. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_getChapterDir { + + local MANUAL_ENTRY='' + local MANUAL_ENTRIES="$1" + + # At this point, we need to take a desition about documentation + # design, in order to answer the question: How do we assign + # chapters, sections and subsections automatically, based on the + # repository structure? and also, how such design could be + # adapted to changes in the repository structure? + # + # One solution would be: represent the repository's directory + # structure as sections inside a chapter named `Directories' or + # something similar. Subsections and subsubsections will not have + # their own files, they all will be written inside the same + # section file that represents the repository documentation entry. + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + ${FLAG_BACKEND}_getEntry $MANUAL_ENTRY | cut -d / -f-8 + done | sort | uniq + +} diff --git a/Scripts/Functions/Help/help_getEntry.sh b/Scripts/Functions/Help/help_getEntry.sh new file mode 100755 index 0000000..174e0e5 --- /dev/null +++ b/Scripts/Functions/Help/help_getEntry.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# 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 Artwork SIG +# +# 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 texinfo_getEntry { + + # Define variables as local to avoid conflicts outside. + local MANUAL_ENTRY='' + local LOCATION='' + local LOCATIONS='' + + # Redefine locations in order to make this function reusable not + # just for action value variable but whatever value passed as + # first possitional argument. + if [[ "$@" != '' ]];then + LOCATIONS="$@" + else + LOCATIONS="$ACTIONVAL" + fi + + for LOCATION in $LOCATIONS;do + + # Sanitate action value to use absolute paths. + LOCATION=$(cli_checkRepoDirSource $LOCATION) + + # Define relative path of entry, from trunk directory on. + MANUAL_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. + if [[ ${MANUAL_ENTRY} =~ "\.${FLAG_BACKEND}$" ]];then + MANUAL_ENTRY=$(echo ${MANUAL_ENTRY} \ + | sed "s!trunk/Manuals/RepoReference/!!") + else + MANUAL_ENTRY=$(dirname ${MANUAL_CHAPTER_NAME}/${MANUAL_ENTRY})/$(basename $LOCATION).${FLAG_BACKEND} + fi + + # Re-define entry to set absolute path to manuals base + # directory structure. + MANUAL_ENTRY=${MANUAL_BASEDIR}/${MANUAL_ENTRY} + + # Output entry's absolute path. + echo ${MANUAL_ENTRY} + + done + +} diff --git a/Scripts/Functions/Help/help_getNode.sh b/Scripts/Functions/Help/help_getNode.sh new file mode 100755 index 0000000..36f93f4 --- /dev/null +++ b/Scripts/Functions/Help/help_getNode.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# 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 Artwork SIG +# +# 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 texinfo_getNode { + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Define node from documentation entry. + local NODE=$(echo "$MANUAL_ENTRY" | sed -r \ + -e "s!^${MANUAL_BASEDIR}!!" \ + -e "s/(chapter-intro\.${FLAG_BACKEND}|\.${FLAG_BACKEND})$//" \ + -e 's!/! !g' \ + -e 's!^[[:space:]]+!!') + + echo "$NODE" + +} + diff --git a/Scripts/Functions/Help/help_makeSeeAlso.sh b/Scripts/Functions/Help/help_makeSeeAlso.sh new file mode 100755 index 0000000..05b8010 --- /dev/null +++ b/Scripts/Functions/Help/help_makeSeeAlso.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# 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 Artwork SIG +# +# 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 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 '\\n@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_renameCrossReferences.sh b/Scripts/Functions/Help/help_renameCrossReferences.sh new file mode 100755 index 0000000..a2f687e --- /dev/null +++ b/Scripts/Functions/Help/help_renameCrossReferences.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# 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 Artwork SIG +# +# 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 texinfo_renameCrossReferences { + + local MANUAL_ENTRY_SRC=$(${FLAG_BACKEND}_getEntry "$1") + local MANUAL_ENTRY_DST=$(${FLAG_BACKEND}_getEntry "$2") + + # Define node pattern for source documenation entry. + local NODE_SRC=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_SRC") + + # Define node replacement for target documentation entry. + local NODE_DST=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY_DST") + + # Define list of entries to process. + local MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern=".*\.${FLAG_BACKEND}") + + # 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'. + # + # Inside the pattern space, the `\<' and `\>' are used to restrict + # the match pattern to a word boundary. The word boundary + # restriction applied here is required to avoid undesired + # replacements when we replace singular words with their plurals. + # For example, if we need to change the word `Manual' to its + # plular (i.e., `Manuals'), and no boundary restriction is used in + # the pattern space to do that, we might end up having words like + # `Manualsssss'. This is because this sed command might be applied + # to the same file many times; and each time it is applied a new + # `Manuals' replaces the previous `Manuals' replacement to form + # `Manualss', `Manualsss', and so on for each interaction. + sed -r -i ":a;N;s!\<${NODE_SRC}\>!${NODE_DST}!g;ba" ${MANUAL_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. + ${FLAG_BACKEND}_restoreCrossReferences "${MANUAL_ENTRY_DST}" + +} diff --git a/Scripts/Functions/Help/help_renameEntry.sh b/Scripts/Functions/Help/help_renameEntry.sh new file mode 100755 index 0000000..09fff4a --- /dev/null +++ b/Scripts/Functions/Help/help_renameEntry.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# texinfo_renameEntry.sh -- This function renames documentation entries +# and updates documentation structure to reflect changes. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_renameEntry { + + # Copy source documentation entry. + ${FLAG_BACKEND}_copyEntry "$1" "$2" + + # Delete source documentation entry. The source documentation + # entry has been copied already, so to create the rename effect + # delete it from repository filesystem. + ${FLAG_BACKEND}_deleteEntry "$1" + + # 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. + ${FLAG_BACKEND}_renameCrossReferences "$1" "$2" + +} diff --git a/Scripts/Functions/Help/help_restoreCrossReferences.sh b/Scripts/Functions/Help/help_restoreCrossReferences.sh new file mode 100755 index 0000000..3b2b053 --- /dev/null +++ b/Scripts/Functions/Help/help_restoreCrossReferences.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# 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 +# texinfo_deleteCrossReferences function. The +# texinfo_restoreCrossReferences function relays in the removed +# message format produced by texinfo_deleteCrossReferences +# function, in order to return them back into the link format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_restoreCrossReferences { + + local -a PATTERN + local -a REPLACE + + # Define documentation entry. + local MANUAL_ENTRY="$1" + + # Verify documentation entry. If documentation entry is empty, + # stop script execution with an error message. + if [[ $MANUAL_ENTRY == '' ]];then + cli_printMessage "`gettext "The first positional parameter cannot be empty."`" --as-error-line + fi + + # Build the node string using entry location. + local NODE=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") + + # 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 MANUAL_ENTRIES=$(cli_getFilesList ${MANUAL_BASEDIR} --pattern=".*\.${FLAG_BACKEND}") + + # 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'. + # + # Inside the pattern space, the `\<' and `\>' are used to restrict + # the match pattern to a word boundary. The word boundary + # restriction applied here is required to avoid undesired + # replacements when we replace singular words with their plurals. + # For example, if we need to change the word `Manual' to its + # plular (i.e., `Manuals'), and no boundary restriction is used in + # the pattern space to do that, we might end up having words like + # `Manualsssss'. This is because this sed command might be applied + # to the same file many times; and each time it is applied a new + # `Manuals' replaces the previous `Manuals' replacement to form + # `Manualss', `Manualsss', and so on for each interaction. + sed -r -i ":a;N;s!\<${PATTERN[0]}\>!${REPLACE[0]}!g;ba" ${MANUAL_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]}!" ${MANUAL_ENTRIES} + +} diff --git a/Scripts/Functions/Help/help_searchIndex.sh b/Scripts/Functions/Help/help_searchIndex.sh new file mode 100644 index 0000000..3d96c7a --- /dev/null +++ b/Scripts/Functions/Help/help_searchIndex.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# texinfo_searchIndex.sh -- This function does an index search inside the +# info document. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_searchIndex { + + # Rebuild output files to propagate recent changes. + ${FLAG_BACKEND}_updateOutputFiles + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # 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 new file mode 100755 index 0000000..2a28295 --- /dev/null +++ b/Scripts/Functions/Help/help_searchNode.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# texinfo_searchNode.sh -- This function does a node search inside the +# info document. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_searchNode { + + # Print separator line. + cli_printMessage '-' --as-separator-line + + # Define list of documentation entries. + local MANUAL_ENTRY='' + local MANUAL_ENTRIES=$(${FLAG_BACKEND}_getEntry "$@") + + # Loop through manual entries and read related node. + for MANUAL_ENTRY in $MANUAL_ENTRIES;do + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-reading-line + + # Check documentation entry inside documentation structure. If + # the documentation entry exits use the info reader to open + # the info file at the specified node for reading it on the + # terminal. Otherwise, ask the user to create it. + if [[ -f "$MANUAL_ENTRY" ]];then + /usr/bin/info --node="$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY")" --file=${MANUAL_BASEFILE}.info.bz2 + else + ${FLAG_BACKEND}_editEntry + fi + + done + +} diff --git a/Scripts/Functions/Help/help_updateChaptersMenu.sh b/Scripts/Functions/Help/help_updateChaptersMenu.sh new file mode 100755 index 0000000..2fd2f40 --- /dev/null +++ b/Scripts/Functions/Help/help_updateChaptersMenu.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# texinfo_updateChaptersMenu.sh -- This function updates chapter menu. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 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.texinfo) 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.${FLAG_BACKEND} ]];then + MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.${FLAG_BACKEND} \ + | egrep -v "^@(end )?menu$" | egrep -v '^\* 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.${FLAG_BACKEND} + +} diff --git a/Scripts/Functions/Help/help_updateChaptersNodes.sh b/Scripts/Functions/Help/help_updateChaptersNodes.sh new file mode 100755 index 0000000..18541a6 --- /dev/null +++ b/Scripts/Functions/Help/help_updateChaptersNodes.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# texinfo_updateChaptersNodes.sh -- This function updates nodes of +# chapters based on menu of chapters. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateChaptersNodes { + + # Build list "nodes of chapters" based on menu of chapters. + local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.${FLAG_BACKEND} \ + | egrep -v '^@(end )?menu$' | egrep -v '^\* Index::$'\ + | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ + | sed -r 's! !_!g' | sort | uniq ) + + # Build list of texinfo inclusions to load chapters' nodes. Don't + # include `Index' chapter here, it has been already included in + # the `repository.texinfo' file. + local FILENODE=$(\ + for CHAPTERNODE in ${CHAPTERNODES};do + INCL=$(echo ${CHAPTERNODE} \ + | sed -r "s!(${CHAPTERNODE})!\1/chapter\.${FLAG_BACKEND}!") + # Output inclusion line using texinfo format. + echo "@include $INCL" + done) + + # Dump organized nodes of chapters into file. + echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.${FLAG_BACKEND} + +} diff --git a/Scripts/Functions/Help/help_updateMenu.sh b/Scripts/Functions/Help/help_updateMenu.sh new file mode 100755 index 0000000..874660d --- /dev/null +++ b/Scripts/Functions/Help/help_updateMenu.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# +# 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 Artwork SIG +# +# 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 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=$(${FLAG_BACKEND}_getNode "$MANUAL_ENTRY") + + # Give format to menu line using texinfo style. + local MENULINE="* ${MENUNODE}::" + + # Define chapter's menu. Remove `@menu', `@end menu' and empty + # lines from output. + local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${FLAG_BACKEND} \ + | 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 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.${FLAG_BACKEND} + +} diff --git a/Scripts/Functions/Help/help_updateNodes.sh b/Scripts/Functions/Help/help_updateNodes.sh new file mode 100755 index 0000000..4ac333a --- /dev/null +++ b/Scripts/Functions/Help/help_updateNodes.sh @@ -0,0 +1,133 @@ +#!/bin/bash +# +# texinfo_updateNodes.sh -- This function updates chapter's nodes +# definition using the chapter's menu as reference. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateNodes { + + # Retrive nodes' entries from chapter-menu.texinfo file. + local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.${FLAG_BACKEND} \ + | 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}" | cut -d' ' -f2- | sed -r 's! !/!g') + INCL=$(echo "${NODE}" | sed -r 's! !/!g').${FLAG_BACKEND} + CIND=$(echo "${NODE}") + + # Create texinfo section file using templates, only if the + # section file doesn't exist and hasn't been marked for + # deletion. Otherwise, when the files have been marked for + # deletion, they will be created again from texinfo template + # to working copy and that might create confusion. + if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]] \ + && [[ $(cli_getRepoStatus ${MANUAL_BASEDIR}/$INCL) != 'D' ]];then + + # Define absolute path to section templates assignment + # file. This is the file that hold the relation between + # section template files and repository paths when + # documentation entries are created. + local CONFFILE="${MANUAL_TEMPLATE}/${MANUAL_NAME}.conf" + + # Verify existence of configuration file. + cli_checkFiles $CONFFILE + + # Retrive configuration lines from configuration file. Be + # sure no line begining with `#' or space remain in the + # line. Otherwise, it would be difficult to loop through + # configuration lines. + local CONFLINE='' + local CONFLINES=$(cat ${CONFFILE} \ + | egrep -v '^#' \ + | egrep -v '^[[:space:]]*$' \ + | sed -r 's![[:space:]]*!!g') + + # Initialize both left hand side and right hand side + # configuration values. + local CONFLHS='' + local CONFRHS='' + + # Initialize absolute path to final texinfo template. + local TEMPLATE='' + + # Define what section template to apply using + # documentation entry absolute path and values provided by + # configuration line. Be sure to break the loop in the + # first match. + for CONFLINE in $CONFLINES;do + + CONFLHS=$(echo $CONFLINE \ + | gawk 'BEGIN{FS = "="}; { print $1 }' \ + | sed -r 's![[:space:]]*!!g') + + CONFRHS=$(echo $CONFLINE \ + | gawk 'BEGIN{FS = "="}; { print $2 }' \ + | sed -r 's![[:space:]]*!!g' | sed -r 's!^"(.+)"$!\1!') + + if [[ ${MANUAL_BASEDIR}/${INCL} =~ $CONFRHS ]];then + TEMPLATE="${MANUAL_TEMPLATE}/${CONFLHS}" + break + fi + + done + + # Verify existence of texinfo template file. If no + # template is found, stop script execution with an error + # message. We cannot continue without it. + cli_checkFiles $TEMPLATE + + # Create documentation entry using texinfo template as + # reference. + svn cp ${TEMPLATE} ${MANUAL_BASEDIR}/$INCL --quiet + + # Expand common translation markers in documentation entry. + cli_replaceTMarkers "${MANUAL_BASEDIR}/$INCL" + + # Expand `Goals' subsection translation markers in + # documentation entry. + sed -i -r "s!=SECT=!${SECT}!g" "${MANUAL_BASEDIR}/$INCL" + + # Expand `See also' subsection translation markers in + # documentation entry. + ${FLAG_BACKEND}_makeSeeAlso "${MANUAL_BASEDIR}/$INCL" "$NODE" + + fi + + # Verify existence of chapter-nodes template files. If no + # chapter-nodes template is found, stop script execution with + # an error message. We cannot continue without it. + cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${FLAG_BACKEND} + + # Output node information chapter-nodes template file using + # the current texinfo menu information. + cat ${MANUAL_TEMPLATE}/${MANUAL_CHAPTER_NAME}/chapter-nodes.${FLAG_BACKEND} \ + | sed -r -e "s!=NODE=!${NODE}!g" -e "s!=SECT=!${SECT}!g" \ + -e "s!=CIND=!${CIND}!g" -e "s!=INCL=!${INCL}!g" + + # Dump node definitions into document structure. + done > $MANUAL_CHAPTER_DIR/chapter-nodes.${FLAG_BACKEND} + +} diff --git a/Scripts/Functions/Help/help_updateOutputFileInfo.sh b/Scripts/Functions/Help/help_updateOutputFileInfo.sh new file mode 100755 index 0000000..a8ea1ad --- /dev/null +++ b/Scripts/Functions/Help/help_updateOutputFileInfo.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# texinfo_updateOutputFileInfo.sh -- This function exports +# documentation manual to info format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateOutputFileInfo { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" --as-updating-line + + # Update info file. + /usr/bin/makeinfo --output=${MANUAL_BASEFILE}.info \ + --enable-encoding \ + ${MANUAL_BASEFILE}.${FLAG_BACKEND} + + # 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 new file mode 100755 index 0000000..8997007 --- /dev/null +++ b/Scripts/Functions/Help/help_updateOutputFilePdf.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# texinfo_updateOutputFilePdf.sh -- This function exports documentation +# manual to PDF format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateOutputFilePdf { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.pdf" --as-updating-line + + # Update plaintext output directory. + /usr/bin/texi2pdf --quiet \ + ${MANUAL_BASEFILE}.${FLAG_BACKEND} --output=${MANUAL_BASEFILE}.pdf + +} diff --git a/Scripts/Functions/Help/help_updateOutputFilePlaintext.sh b/Scripts/Functions/Help/help_updateOutputFilePlaintext.sh new file mode 100755 index 0000000..b2fbc52 --- /dev/null +++ b/Scripts/Functions/Help/help_updateOutputFilePlaintext.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# texinfo_updateOutputFilePlaintext.sh -- This function exports +# documentation manual to plain-text format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateOutputFilePlaintext { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" --as-updating-line + + # Update plaintext output directory. + /usr/bin/makeinfo --plaintext \ + ${MANUAL_BASEFILE}.${FLAG_BACKEND} --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 new file mode 100755 index 0000000..969f166 --- /dev/null +++ b/Scripts/Functions/Help/help_updateOutputFileXhtml.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# texinfo_updateOutputFileXhtml.sh -- This function exports +# documentation manual to HTML format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateOutputFileXhtml { + + # Verify initialization files used by texi2html. + cli_checkFiles ${MANUAL_BACKEND}/${MANUAL_NAME}-init.pl + cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_NAME}-init.pl + + # Verify transformation files used to modify texi2html output. + cli_checkFiles ${MANUAL_BACKEND}/${MANUAL_NAME}.sed + cli_checkFiles ${MANUAL_TEMPLATE}/${MANUAL_NAME}.sed + + # 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 xhtml using CentOS Web default visual style. + texi2html --lang=$(cli_getCurrentLocale --langcode-only) \ + --init-file=${MANUAL_BACKEND}/${MANUAL_NAME}-init.pl \ + --init-file=${MANUAL_TEMPLATE}/${MANUAL_NAME}-init.pl \ + --output=${MANUAL_BASEDIR}/${MANUAL_NAME}.xhtml \ + ${MANUAL_BASEDIR}/${MANUAL_NAME}.${FLAG_BACKEND} + + # 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.pl). For example, + # Would it be 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_BACKEND}/${MANUAL_NAME}.sed \ + -f ${MANUAL_TEMPLATE}/${MANUAL_NAME}.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 new file mode 100755 index 0000000..4606b15 --- /dev/null +++ b/Scripts/Functions/Help/help_updateOutputFileXml.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# texinfo_updateOutputFileXml.sh -- This function exports documentation +# manual to XML format. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 texinfo_updateOutputFileXml { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.xml" --as-updating-line + + # Update xml output format. + /usr/bin/makeinfo --xml \ + ${MANUAL_BASEFILE}.${FLAG_BACKEND} --output=${MANUAL_BASEFILE}.xml \ + +} diff --git a/Scripts/Functions/Help/help_updateOutputFiles.sh b/Scripts/Functions/Help/help_updateOutputFiles.sh new file mode 100755 index 0000000..beba642 --- /dev/null +++ b/Scripts/Functions/Help/help_updateOutputFiles.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# texinfo_updateOutputFiles.sh -- This function exports documentation +# manual to different output formats. +# +# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG +# +# 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 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 + + ${FLAG_BACKEND}_updateOutputFileInfo + ${FLAG_BACKEND}_updateOutputFileXhtml + ${FLAG_BACKEND}_updateOutputFileXml + ${FLAG_BACKEND}_updateOutputFilePdf + ${FLAG_BACKEND}_updateOutputFilePlaintext + + # Remove the working copy root directory from directory stack. + popd > /dev/null + +}