From 9ebc537ba139b6a5583bcfcfc70060a025ee2fc9 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Mar 12 2011 16:51:00 +0000 Subject: Update `manual' functionality: - Stop using the `manual_' prefix. Start using `document_' instead. --- diff --git a/Scripts/Bash/Cli/Functions/Manual/document.sh b/Scripts/Bash/Cli/Functions/Manual/document.sh new file mode 100755 index 0000000..83e388e --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# +# document.sh -- This function provides documentation features to +# centos-art.sh script. Here we initialize documentation variables and +# call document_getArguments functions. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document { + + local ACTIONNAM='' + local ACTIONVAL='' + + # Define manuals base directory. This is the place where + # documentation manuals base directory structures are stored and + # organized in. + MANUAL_BASEDIR="${HOME}/artwork/trunk/Manual" + + # Interpret arguments and options passed through command-line. + document_getArguments + + # Redefine positional parameters using ARGUMENTS. At this point, + # option arguments have been removed from ARGUMENTS variable and + # only non-option arguments remain in it. + eval set -- "$ARGUMENTS" + + # Define action name. It does matter what option be passed to + # centos-art, there are many different actions to perform based on + # the option passed (e.g., `--edit', `--read', `--search', etc.). + # In that sake, we defined action name inside document_getArguments, + # at the moment of interpreting options. + + # Define action value. As convenction, we use non-option arguments + # to define the action value (ACTIONVAL) variable. + for ACTIONVAL in "$@";do + + if [[ $ACTIONVAL == '--' ]];then + continue + fi + + # Check action value passed through the command-line using + # source directory definition as reference. + cli_checkRepoDirSource + + # Define documentation entry. + ENTRY=$(document_getEntry) + + # Define documentation entry directory. This is the directory + # where the entry file is stored. + ENTRY_DIR=$(dirname ${ENTRY} | sed -r 's!\.texi$!!') + + # Define documentation entry file (without extension). + ENTRY_FILE=$(basename ${ENTRY} | sed -r 's!\.texi$!!') + + # Define file name for documentation manual. This is the file + # used to initiate the structure of documentation manual. + MANUAL_NAME=repository + + # Define directory to store documentation entries. At this + # point, we need to take a desition about documentation + # design, in order to answer the question: How do we assign + # chapters, sections and subsections automatically, based on + # the repository structure? and also, how such design could + # be adapted to changes in the repository structure? + # + # One solution would be: represent the repository's directory + # structure as sections inside a chapter named Filesystem 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 directory. + MANUAL_CHAPTER_DIR=$(echo $ENTRY | cut -d / -f-7) + + # Define chapter name for the documentation entry we are + # working with. + MANUAL_CHAPTER_NAME=$(basename "$MANUAL_CHAPTER_DIR") + + # Define base name for documentation manual files (without + # extension). This is the main file name used to build texinfo + # related files (.info, .pdf, .xml, etc.). + MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}" + + # Set action preable. + cli_printActionPreamble "${MANUAL_BASEFILE}.texi" '' '' + + # Syncronize changes between repository and working copy. At + # this point, changes in the repository are merged in the + # working copy and changes in the working copy committed up to + # repository. + cli_syncroRepoChanges ${MANUAL_BASEDIR} + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # 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} + + done +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_copyEntry.sh b/Scripts/Bash/Cli/Functions/Manual/document_copyEntry.sh new file mode 100755 index 0000000..d52610e --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_copyEntry.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# document_copyEntry.sh -- This function copies documentation entries and +# updates documentation structure to reflect changes. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_copyEntry { + + local ENTRY_SRC=${ENTRY} + local ENTRY_DST=${FLAG_TO} + local ENTRIES='' + local ENTRY='' + + # Print action message. + cli_printMessage "${ENTRY_DST}" 'AsCreatingLine' + + # Copy main documentation entry. + if [[ ! -f ${ENTRY_DST} ]];then + svn cp "${ENTRY_SRC}" "${ENTRY_DST}" --quiet + fi + + # Define target location of directory holding dependent + # documentation entries. + ENTRY_DST=$(echo ${ENTRY_DST} | sed -r 's!\.texi$!!') + + # Copy dependent documentation entries, if any. + if [[ ! -d ${ENTRY_DST} ]];then + cli_printMessage "${ENTRY_DST}" 'AsCreatingLine' + svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DST}" --quiet + fi + + # Define list of files to process. + ENTRIES=$(cli_getFilesList "$(dirname ${ENTRY_DST})" "$(basename ${ENTRY_DST}).*\.texi") + + # Set action preamble. + cli_printActionPreamble "${ENTRIES}" '' '' + + # Print separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Print action message. + cli_printMessage "Updating manual menus, nodes and cross-references." 'AsResponseLine' + + # Redefine ENTRY variable in order to update documentation + # structure, taking recently created entries as reference. + for ENTRY in ${ENTRIES};do + + # Update menu and node definitions from manual sections to + # reflect the changes. + document_updateMenu + document_updateNodes + + # Update cross reference definitions from manual to reflect + # the changes. + document_restoreCrossReferences + + done + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_deleteCrossReferences.sh b/Scripts/Bash/Cli/Functions/Manual/document_deleteCrossReferences.sh new file mode 100755 index 0000000..ed9e704 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_deleteCrossReferences.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# +# document_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 document_deleteEntry function, in order +# to keep cross reference information, inside the documentation +# manual, syncronized. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_deleteCrossReferences { + + local -a PATTERN + local -a REPLACE + local LOCATION='' + + # Define entry location. Verify first argument to make this + # function reusable. If no value is passed as first argument use + # entry global information value as default value instead. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ENTRY" + fi + + # Build the node string using entry location. + local NODE=$(echo "$LOCATION" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//" \ + -e 's! !( |\\n)!g') + + # Define regular expression patterns for texinfo cross reference + # commands. + PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" + PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$" + + # Define replacement string for missing entries. It is convenient + # to keep missing entries in documentation for documentation team + # to know. Removing the missing cross reference may intorudce + # confussion. Imagine that! you are spending lots of hours in an + # article and suddenly one of your cross refereces disappears with + # no visible reason, with the next working copy update you + # perform. That's frustrating. Instead, when centos-art.sh script + # finds a missing cross reference it removes the link and remark + # the issue for you to act on it. + REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' + REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' + + # Define list of entries to process. + local ENTRIES=$(cli_getFilesList "${MANUAL_BASEDIR}" '.*\.texi') + + # Set action preamble. + cli_printActionPreamble "$ENTRIES" '' '' + + # Update node-related cross references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_deleteEntry.sh b/Scripts/Bash/Cli/Functions/Manual/document_deleteEntry.sh new file mode 100755 index 0000000..976881e --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_deleteEntry.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# document_deleteEntry.sh -- This function removes a documentation entry +# from documentation directory structure. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_deleteEntry { + + local ENTRY_SRC=${ENTRY} + local ENTRIES='' + local ENTRY='' + local ENTRY_DEP='' + + # Initiate list of entries to remove using the entry specified in + # the command line. + ENTRIES=${ENTRY_SRC} + + # Verify existence of dependent entries. Dependent entries are + # stored inside a directory with the same name of the entry you + # are trying to remove. + if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]];then + + # Add dependent files to list of entries. + ENTRIES="${ENTRIES} $(cli_getFilesList "${ENTRY_DIR}/${ENTRY_FILE}" ".*\.texi")" + + # Add dependent directories to list of entries. Be aware of + # nested directories. + for ENTRY in ${ENTRIES};do + ENTRY_DEP=$(echo $ENTRY | sed -r "s/\.texi$//") + if [[ -d $ENTRY_DEP ]];then + ENTRIES="${ENTRIES} ${ENTRY_DEP}" + fi + done + + fi + + # Prepare list of entries for action preamble. + ENTRIES=$(echo ${ENTRIES} | tr ' ' "\n" | sort -r | uniq) + + # Print action preamble. + cli_printActionPreamble "$ENTRIES" 'doDelete' 'AsResponseLine' + + # Remove documentation entry using regular subversion commands. + # Do not use regular rm command here, use subversion del command + # instead. Otherwise, even the file is removed, it will be brought + # back when the final cli_commitRepoChange be executed. Remember + # there is a subversion update there, no matter what you remove + # using regular commands, when you do update the directory + # structure on the working copy the removed files (not removed in + # the repository, nor marked to be removed) are brought down to + # the working copy again. + svn del ${ENTRIES} --quiet + if [[ $? -ne 0 ]];then + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Print separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Print action message. + cli_printMessage "Updating manual menus, nodes and cross-references." 'AsResponseLine' + + # 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 entities list again to update menus, nodes + # and cross references from remaining files. + for ENTRY in ${ENTRIES};do + + # Use entry files only. Directories are used to store + # dependent entries. Directories are not considered entries on + # themselves. + if [[ ! -f $ENTRY ]];then + continue + fi + + # Update menu and node definitions from manual sections to + # reflect the changes. + document_updateMenu "remove-entry" + document_updateNodes + + # Update cross reference definitions from manual to reflect + # the changes. + document_deleteCrossReferences + + done + + # Remove entry menus and nodes from chapter definition to reflect + # the fact it has been removed. This is mainly applied when one + # of the chapters (e.g., trunk/, tags/, or branches/) is removed. + if [[ ! -d $MANUAL_CHAPTER_DIR ]];then + document_updateChaptersMenu 'remove-entry' + document_updateChaptersNodes + fi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_editEntry.sh b/Scripts/Bash/Cli/Functions/Manual/document_editEntry.sh new file mode 100755 index 0000000..a18a0aa --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_editEntry.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# document_editEntry.sh -- This function implements the edition flow of +# documentation entries inside the working copy. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_editEntry { + + # Verify chapter definition inside manual. + if [[ ! -d $MANUAL_CHAPTER_DIR ]];then + + # Print confirmation question. + cli_printMessage "`gettext "The following documentation chapter will be created:"`" + cli_printMessage "$MANUAL_CHAPTER_DIR" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + # Update manual chapter related files. + document_updateChaptersFiles + + # Update manual chapter related menu. + document_updateChaptersMenu + + # Update manual chapter related nodes (based on chapter + # related menu). + document_updateChaptersNodes + + fi + + # Verify section definition inside chapters. + if [[ ! -f $ENTRY ]];then + + # Print confirmation question. + cli_printMessage "`gettext "The following documentation section will be created:"`" + cli_printMessage "$ENTRY" "AsResponseLine" + cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" + + # Update chapter section related menu. + document_updateMenu + + # Update chapter section related nodes (based on chapter + # section related menu). + document_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. + document_restoreCrossReferences + + else + + # Print action message. + cli_printMessage "$ENTRY" 'AsUpdatingLine' + + fi + + # Use default text editor to edit the documentation entry. + eval $EDITOR $ENTRY + + # Print separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Rebuild output files to propagate recent changes. + document_updateOutputFiles + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_getArguments.sh b/Scripts/Bash/Cli/Functions/Manual/document_getArguments.sh new file mode 100755 index 0000000..7ad4136 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_getArguments.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# document_getArguments.sh -- This function interpretes arguments passed +# to `manual' functionality and calls actions accordingly. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_getArguments { + + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="filter,quiet,answer,dont-commit-changes,read,search,edit,update" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + + --filter ) + FLAG_FILTER="$2" + shift 2 + ;; + + --quiet ) + FLAG_QUIET="true" + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --answer ) + FLAG_ANSWER="$2" + shift 2 + ;; + + --dont-commit-changes ) + FLAG_DONT_COMMIT_CHANGES="true" + shift 1 + ;; + + --read ) + ACTIONNAM="${FUNCNAM}_searchNode" + shift 1 + ;; + + --search ) + ACTIONNAM="${FUNCNAM}_searchIndex" + shift 1 + ;; + + --edit ) + ACTIONNAM="${FUNCNAM}_editEntry" + shift 1 + ;; + + --update ) + ACTIONNAM="${FUNCNAM}_updateOutputFiles" + shift 1 + ;; + + * ) + break + esac + done + + # Redefine ARGUMENTS variable using current positional parameters. + cli_doParseArgumentsReDef "$@" + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_getEntry.sh b/Scripts/Bash/Cli/Functions/Manual/document_getEntry.sh new file mode 100755 index 0000000..2f1bc2f --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_getEntry.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# document_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-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_getEntry { + + # Define variables as local to avoid conflicts outside. + local ENTRY='' + local LOCATION='' + + # Redefine location in order to make this function reusable not + # just for action value variable but whatever value passed as + # first possitional argument. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ACTIONVAL" + fi + + # Define relative path of entry, from trunk directory on. + ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") + + # Verify the entry relative path to find out which documentation + # manual we are acting on. As convenction, whatever documentation + # entry you provide outside trunk/Manuals/ directory structure is + # considered as you are documenting the repository directory + # structure. Otherwise, if an entry inside trunk/Manuals/ is + # provided, the directory structure provided is used as default + # documentation manual for actions like `--create' and `--update' + # to take place on. Other options like `--edit', `--delete' and + # `--read' cannot be applied to paths provided is inside + # trunk/Manuals/ such actions made manually. + if [[ ${ENTRY} =~ '\.texi$' ]];then + ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manual/!!') + else + ENTRY=$(dirname Filesystem/${ENTRY})/$(basename $LOCATION).texi + fi + + # Re-define entry to set absolute path to manuals base directory + # structure. + ENTRY=${MANUAL_BASEDIR}/${ENTRY} + + # Output entry's absolute path. + echo ${ENTRY} + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_getNode.sh b/Scripts/Bash/Cli/Functions/Manual/document_getNode.sh new file mode 100755 index 0000000..79852f0 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_getNode.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# document_getNode.sh -- This function cleans up the action value +# (ACTIONVAL) directory to make a node name from it. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_getNode { + + local NODE=$(echo "$ACTIONVAL" \ + | sed -r "s!^${HOME}/artwork/!!" \ + | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') + + echo "$NODE" +} + diff --git a/Scripts/Bash/Cli/Functions/Manual/document_renameCrossReferences.sh b/Scripts/Bash/Cli/Functions/Manual/document_renameCrossReferences.sh new file mode 100755 index 0000000..0d5caab --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_renameCrossReferences.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# document_renameCrossReferences.sh -- This function replaces a node +# pattern with a node replacement and updates cross-reference +# definitions to reflect the changes. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_renameCrossReferences { + + local NODE='' + local COUNT=1 + local ENTRIES='' + local NODE_SRC='' + local NODE_DST='' + + # Define node pattern for source documenation entry. + NODE_SRC=$(echo "$ENTRY" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//" \ + -e 's! !( |\\n)!g') + + # Define node replacement for target documentation entry. + NODE_DST=$(echo "$FLAG_TO" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//") + + # Sanitate node replacement for target documentation entry to make + # use of regular expression positional markers, so the word + # separator character found by node pattern could be used. + for NODE in $NODE_DST;do + if [[ $COUNT -eq 1 ]];then + NODE_DST="${NODE}\\${COUNT}" + else + NODE_DST="${NODE_DST}$(echo "${NODE}\\${COUNT}")" + fi + COUNT=$(($COUNT + 1)) + done + + # Remove last positional marker from node replacement. + NODE_DST=$(echo $NODE_DST | sed -r 's!\\[[:digit:]]$!!') + + # Define list of entries to process. + ENTRIES=$(cli_getFilesList "${MANUAL_BASEDIR}" '.*\.texi') + + # Set action preamble. + cli_printActionPreamble "$ENTRIES" '' '' + + # Update node-related cross-references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${NODE_SRC}!${NODE_DST}!g;ba" ${ENTRIES} + + # At this point, source documentation entry has been renamed from + # source to target documentation entry, but they are still + # commented. So, restore target documentation entries. + document_restoreCrossReferences "${FLAG_TO}" + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_renameEntry.sh b/Scripts/Bash/Cli/Functions/Manual/document_renameEntry.sh new file mode 100755 index 0000000..bc0bf77 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_renameEntry.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# +# document_renameEntry.sh -- This function renames documentation entries +# and updates documentation structure to reflect changes. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_renameEntry { + + # Copy source documentation entry. + document_copyEntry + + # Print separator line. + cli_printMessage '-' 'AsSeparatorLine' + + # Delete source documentation entry. The source documentation + # entry has been copied already, so to create the rename effect + # delete it from repository filesystem. + document_deleteEntry + + # At this point, source documentation entry has been removed and + # all menu, nodes and cross-references have been commented. So, + # replace commented menu, nodes and cross-reference information + # from source to target documentation entry. + document_renameCrossReferences + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_restoreCrossReferences.sh b/Scripts/Bash/Cli/Functions/Manual/document_restoreCrossReferences.sh new file mode 100755 index 0000000..fc61b50 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_restoreCrossReferences.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# document_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 +# document_deleteCrossReferences function. The +# document_restoreCrossReferences function relays in the removed message +# format produced by document_deleteCrossReferences function, in order +# to return them back into the link format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_restoreCrossReferences { + + local -a PATTERN + local -a REPLACE + local LOCATION='' + + # Define entry location. Verify first argument to make this + # function reusable. If no value is passed as first argument use + # entry global information value as default value instead. + if [[ "$1" != '' ]];then + LOCATION="$1" + else + LOCATION="$ENTRY" + fi + + # Build the node string using entry location. + local NODE=$(echo "$LOCATION" \ + | cut -d / -f8- \ + | tr '/' ' ' \ + | sed -r \ + -e "s/(chapter-intro\.texi|\.texi)$//" \ + -e 's! !( |\\n)!g') + + # Define regular expression patterns to match removed message + # format produced by message_removeCrossReferences function. + PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" + PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" + + # Define replacement string to turn removed message back to cross + # reference link. + REPLACE[0]='@\1{\2}' + REPLACE[1]='\1' + + # Define list of entries to process. + local ENTRIES=$(cli_getFilesList "${MANUAL_BASEDIR}" '.*\.texi') + + # Set action preamble. + cli_printActionPreamble "$ENTRIES" '' '' + + # Update node-related cross references. The node-related cross + # reference definition, long ones specially, could require more + # than one line to be set. By default, GNU sed does not matches + # newline characters in the pattern space, so we need to make use + # of `label' feature and the `N' command in order to build a + # pattern space that includes the newline character in it. Here we + # use the `a' letter to name the label we use, followed by N + # command to add a newline to the pattern space, the s command to + # make the pattern replacement using the `g' flag to make it + # global and finaly the command `b' to branch label named `a'. + sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} + + # Update menu-related cross references. Menu-related cross + # references hardly appear in more than one line, so there is no + # need to complicate the replacement command. + sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_searchIndex.sh b/Scripts/Bash/Cli/Functions/Manual/document_searchIndex.sh new file mode 100644 index 0000000..7f8c7d5 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_searchIndex.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# document_searchIndex.sh -- This function does an index search inside the +# info document. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_searchIndex { + + # Check flag filter. By default flag filter has the `.+' value + # which is not very descriptive in the sake of an index-search. + # So, when no value is passed through --filter option use top node + # as default value for index-search. + if [[ "$FLAG_FILTER" == '.+' ]];then + cli_printMessage "`gettext "Use the \\\`--filter' option to define the search pattern."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsReadingLine' + + # Execute info command to perform an index-search. + /usr/bin/info --index-search="$FLAG_FILTER" --file=${MANUAL_BASEFILE}.info.bz2 + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_searchNode.sh b/Scripts/Bash/Cli/Functions/Manual/document_searchNode.sh new file mode 100755 index 0000000..34f1833 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_searchNode.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# document_searchNode.sh -- This function does a node search inside the +# info document. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_searchNode { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsReadingLine' + + # Check entry inside documentation structure. If the entry + # exits use the info reader to open the info file at the + # specified node. Otherwise, ask the user for create it. + if [[ -f "$ENTRY" ]];then + /usr/bin/info --node="Filesystem $(document_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 + else + document_editEntry + fi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersFiles.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersFiles.sh new file mode 100755 index 0000000..8fadb5a --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersFiles.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# document_updateChaptersFiles.sh -- This function updates chapter related +# files. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateChaptersFiles { + + # Define chapter's generic structure. + local CHAPTERBODY="\ + @node $MANUAL_CHAPTER_NAME + @chapter $MANUAL_CHAPTER_NAME + @cindex $(echo $MANUAL_CHAPTER_NAME | tr '[[:upper:]]' '[[:lower:]]') + @include $MANUAL_CHAPTER_NAME/chapter-intro.texi + @include $MANUAL_CHAPTER_NAME/chapter-menu.texi + @include $MANUAL_CHAPTER_NAME/chapter-nodes.texi" + + # Remove any space/tabs at the begining of @... lines. + CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') + + # Create directory to store chapter files. + if [[ ! -d $MANUAL_CHAPTER_DIR ]];then + mkdir $MANUAL_CHAPTER_DIR + fi + + # Create files to store chapter information. If chapter files + # already exist, they will be re-written and any previous + # information inside them will be lost. + echo "$CHAPTERBODY" > $MANUAL_CHAPTER_DIR/chapter.texi + echo "" > $MANUAL_CHAPTER_DIR/chapter-menu.texi + echo "" > $MANUAL_CHAPTER_DIR/chapter-nodes.texi + + # Initialize chapter instroduction using template file. + cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_CHAPTER_DIR/chapter-intro.texi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersMenu.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersMenu.sh new file mode 100755 index 0000000..ba92541 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersMenu.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# document_updateChaptersMenu.sh - This function updates chapter menu. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateChaptersMenu { + + local ACTION=$1 + local MENUCHAPTERS='' + + # Build menu of chapters. The Index node is not included as other + # nodes are. The Index node is defined insde the master texinfo + # file (repository.texi). To create the final .info file + # correctly, the Index line in the menu should remain, even no + # other node exist. + if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then + MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | egrep -v "^(@(end )?menu$|\* Index::.*)$") + fi + + # Re-defined menu of chapters based on action. + case $ACTION in + 'remove-entry' ) + # Remove chapter from menu. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ + | egrep -v "^\* ${MANUAL_CHAPTER_NAME}::[[:print:]]*$") + ;; + 'update-entry' | * ) + # Update chapter menu using texinfo format. + MENUCHAPTERS="${MENUCHAPTERS} + * ${MANUAL_CHAPTER_NAME}::" + ;; + esac + + # Remove opening spaces/tabs and empty line from the menu of + # chapters. Empty lines may occur the first time the menu of + # chapters is created. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Organize menu of chapters alphabetically and verify that no + # duplicated line be included on the list. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq ) + + # Give format to final menu output. + MENUCHAPTERS="@menu + ${MENUCHAPTERS} + * Index:: + @end menu" + + # Strip opening space/tabs from final menu of chapters. + MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ + | egrep -v '^[[:space:]]*$') + + # Dump organized menu of chapters into file. + echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.texi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersNodes.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersNodes.sh new file mode 100755 index 0000000..57f829c --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateChaptersNodes.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# document_updateChaptersNodes.sh - This function updates nodes of +# chapters based on menu of chapters. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateChaptersNodes { + + # Build list "nodes of chapters" based on menu of chapters. + local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ + | egrep -v '^@(end )?menu$' \ + | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ + | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ + | sed -r 's! !_!g' | sort | uniq ) + + # Build list of texinfo inclusions to load chapters' nodes. + local FILENODE=$(\ + for CHAPTERNODE in ${CHAPTERNODES};do + + INCL=$(echo ${CHAPTERNODE} | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") + + # Output inclusion line using texinfo format. + echo "@include $INCL" + + done) + + # Dump organized nodes of chapters into file. + echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.texi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateMenu.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateMenu.sh new file mode 100755 index 0000000..90c96cb --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateMenu.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# +# document_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-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateMenu { + + # Specify which action to do inside chapter's menu. + local ACTION="$1" + + # Build the menu node related to the entry being processed + # currently. + local MENUNODE=$(echo "$ENTRY" | cut -d / -f8- | tr '/' ' ' \ + | sed 's!\.texi$!!') + + # Give format to menu line using texinfo style. + local MENULINE="* ${MANUAL_CHAPTER_NAME} $MENUNODE::" + + # Define chapter's menu. Remove `@menu', `@end menu', and empty lines + # from output. + local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ + | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') + + # Re-defined chapter's menu based on action. + case $ACTION in + 'remove-entry' ) + # Remove menu line from chapter's menu. + MENU=$(echo "$MENU" | egrep -v "$MENULINE") + ;; + 'update-entry' | * ) + # Add menu line to chapter's menu. This is the default + # behaivour if no argument is passed to document_updateMenu + # function. + MENU="$MENU + $MENULINE" + ;; + esac + + # Organize menu alphabetically, remove empty and duplicated lines. + # At this point, empty line may occur the first time the menu is + # created, don't let them to scape. + MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$' | sort | uniq ) + + # Rebuild chapter's menu structure adding '@menu' and '@end menu' + # lines back in menu. + MENU="@menu + $MENU + @end menu" + + # Remove opening spaces/tabs from final menu structure. + MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') + + # Dump final menu structure back into chapter's menu file. + echo "$MENU" > $MANUAL_CHAPTER_DIR/chapter-menu.texi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateNodes.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateNodes.sh new file mode 100755 index 0000000..688becf --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateNodes.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# document_updateNodes.sh -- This function updates chapter's nodes +# definition using the chapter's menu as reference. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateNodes { + + # Retrive nodes' entries from chapter-menu.texi file. + local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ + | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ + | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) + + # Re-build node structure based on menu information. + for NODE in $NODES;do + + NODE=$(echo "${NODE}" | sed -r 's!:! !g') + SECT=$(echo "$NODE" | sed -r 's! !/!g' | sed "s!${MANUAL_CHAPTER_NAME}/!!") + INCL=$(echo "$NODE" | sed -r 's! !/!g').texi + CIND=$(echo "$NODE") + + # Create an empty directory to store texinfo files. + if [[ ! -d ${MANUAL_BASEDIR}/$(dirname "$INCL") ]];then + mkdir -p ${MANUAL_BASEDIR}/$(dirname "$INCL") + fi + + # Create texinfo section file using its template. + if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]];then + cp ${FUNCCONFIG}/manual-section.texi ${MANUAL_BASEDIR}/$INCL + fi + + # Output node information based on texinfo menu. + echo "@node $NODE" + echo "@section `eval_gettext "The @file{\\\$SECT} Directory"`" + echo "@cindex $CIND" + echo "@include $INCL" + echo "" + + # Dump node information into chapter node file. + done > $MANUAL_CHAPTER_DIR/chapter-nodes.texi + +} + diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileHtml.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileHtml.sh new file mode 100755 index 0000000..4c08218 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileHtml.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# document_updateOutputFileHtml.sh -- This function exports +# documentation manual to HTML format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateOutputFileHtml { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}-html" 'AsUpdatingLine' + + # Check html output directory + [[ ! -d ${MANUAL_BASEFILE}-html ]] && mkdir -p ${MANUAL_BASEFILE}-html + + # Add html output directory into directory stack to make it the + # current working directory. Otherwise texi2html may produce + # incorrect paths to images included. + pushd ${MANUAL_BASEFILE}-html > /dev/null + + # Update html files. Use texi2html to export from texinfo file + # format to html using CentOS Web default visual style. + texi2html ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}-html --split section \ + --nosec-nav \ + --css-include=${HOME}/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ + -I=${HOME}/artwork + + # Apply html transformations. Html transformations rely on + # Texi2html default html output. The main goal of these html + # transformations is to build specific html structures that match + # specific css definitions. This way we extend the visual style of + # Texi2html default html output. + sed -r -i \ + -f ${HOME}/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ + ${MANUAL_BASEFILE}-html/*.html + + # Remove html output directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileInfo.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileInfo.sh new file mode 100755 index 0000000..b8d7d44 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileInfo.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# document_updateOutputFileInfo.sh -- This function exports +# documentation manual to info format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateOutputFileInfo { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsUpdatingLine' + + # Update info file. + /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info + + # Compress info file. + if [[ $? -eq 0 ]];then + bzip2 -f ${MANUAL_BASEFILE}.info + fi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFilePdf.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFilePdf.sh new file mode 100755 index 0000000..293041b --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFilePdf.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# document_updateOutputFilePdf.sh -- This function exports documentation +# manual to PDF format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateOutputFilePdf { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.pdf" 'AsUpdatingLine' + + # Update plaintext output directory. + /usr/bin/texi2pdf --quiet \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFilePlaintext.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFilePlaintext.sh new file mode 100755 index 0000000..49bd35c --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFilePlaintext.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# document_updateOutputFilePlaintext.sh -- This function exports +# documentation manual to plain-text format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateOutputFilePlaintext { + + # Output action message. + cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" 'AsUpdatingLine' + + # Update plaintext output directory. + /usr/bin/makeinfo --plaintext \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt + + # Compress plaintext output file. + if [[ -f ${MANUAL_BASEFILE}.txt ]];then + bzip2 ${MANUAL_BASEFILE}.txt --force + fi + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileXml.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileXml.sh new file mode 100755 index 0000000..807a181 --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFileXml.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# document_updateOutputFileXml.sh -- This function exports documentation +# manual to XML format. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateOutputFileXml { + + # Print action message. + cli_printMessage "${MANUAL_BASEFILE}.xml" 'AsUpdatingLine' + + # Update xml output format. + /usr/bin/makeinfo --xml \ + ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFiles.sh b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFiles.sh new file mode 100755 index 0000000..ebb59ec --- /dev/null +++ b/Scripts/Bash/Cli/Functions/Manual/document_updateOutputFiles.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# document_updateOutputFiles.sh -- This function exports documentation +# manual to different output formats. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function document_updateOutputFiles { + + # Remove extension from manual's base file. This way it is + # possible to reuse the same filename on different types of files. + MANUAL_BASEFILE=$(echo ${MANUAL_BASEFILE} | sed -r 's!\.texi!!') + + # 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 + + document_updateOutputFileInfo + document_updateOutputFileHtml + document_updateOutputFileXml + document_updateOutputFilePdf + document_updateOutputFilePlaintext + + # Remove the working copy root directory from directory stack. + popd > /dev/null + +} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual.sh b/Scripts/Bash/Cli/Functions/Manual/manual.sh deleted file mode 100755 index 6ea951a..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# -# manual.sh -- This function provides documentation features to -# centos-art.sh script. Here we initialize documentation variables and -# call manual_getArguments functions. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual { - - local ACTIONNAM='' - local ACTIONVAL='' - - # Define manuals base directory. This is the place where - # documentation manuals base directory structures are stored and - # organized in. - MANUAL_BASEDIR="${HOME}/artwork/trunk/Manual" - - # Interpret arguments and options passed through command-line. - manual_getArguments - - # Redefine positional parameters using ARGUMENTS. At this point, - # option arguments have been removed from ARGUMENTS variable and - # only non-option arguments remain in it. - eval set -- "$ARGUMENTS" - - # Define action name. It does matter what option be passed to - # centos-art, there are many different actions to perform based on - # the option passed (e.g., `--edit', `--read', `--search', etc.). - # In that sake, we defined action name inside manual_getArguments, - # at the moment of interpreting options. - - # Define action value. As convenction, we use non-option arguments - # to define the action value (ACTIONVAL) variable. - for ACTIONVAL in "$@";do - - if [[ $ACTIONVAL == '--' ]];then - continue - fi - - # Check action value passed through the command-line using - # source directory definition as reference. - cli_checkRepoDirSource - - # Define documentation entry. - ENTRY=$(manual_getEntry) - - # Define documentation entry directory. This is the directory - # where the entry file is stored. - ENTRY_DIR=$(dirname ${ENTRY} | sed -r 's!\.texi$!!') - - # Define documentation entry file (without extension). - ENTRY_FILE=$(basename ${ENTRY} | sed -r 's!\.texi$!!') - - # Define file name for documentation manual. This is the file - # used to initiate the structure of documentation manual. - MANUAL_NAME=repository - - # Define directory to store documentation entries. At this - # point, we need to take a desition about documentation - # design, in order to answer the question: How do we assign - # chapters, sections and subsections automatically, based on - # the repository structure? and also, how such design could - # be adapted to changes in the repository structure? - # - # One solution would be: represent the repository's directory - # structure as sections inside a chapter named Filesystem 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 directory. - MANUAL_CHAPTER_DIR=$(echo $ENTRY | cut -d / -f-7) - - # Define chapter name for the documentation entry we are - # working with. - MANUAL_CHAPTER_NAME=$(basename "$MANUAL_CHAPTER_DIR") - - # Define base name for documentation manual files (without - # extension). This is the main file name used to build texinfo - # related files (.info, .pdf, .xml, etc.). - MANUAL_BASEFILE="${MANUAL_BASEDIR}/${MANUAL_NAME}" - - # Set action preable. - cli_printActionPreamble "${MANUAL_BASEFILE}.texi" '' '' - - # Syncronize changes between repository and working copy. At - # this point, changes in the repository are merged in the - # working copy and changes in the working copy committed up to - # repository. - cli_syncroRepoChanges ${MANUAL_BASEDIR} - - # Execute action name. - if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then - eval $ACTIONNAM - else - cli_printMessage "`gettext "A valid action is required."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # 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} - - done -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_copyEntry.sh b/Scripts/Bash/Cli/Functions/Manual/manual_copyEntry.sh deleted file mode 100755 index a8ba6d1..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_copyEntry.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# -# manual_copyEntry.sh -- This function copies documentation entries and -# updates documentation structure to reflect changes. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_copyEntry { - - local ENTRY_SRC=${ENTRY} - local ENTRY_DST=${FLAG_TO} - local ENTRIES='' - local ENTRY='' - - # Print action message. - cli_printMessage "${ENTRY_DST}" 'AsCreatingLine' - - # Copy main documentation entry. - if [[ ! -f ${ENTRY_DST} ]];then - svn cp "${ENTRY_SRC}" "${ENTRY_DST}" --quiet - fi - - # Define target location of directory holding dependent - # documentation entries. - ENTRY_DST=$(echo ${ENTRY_DST} | sed -r 's!\.texi$!!') - - # Copy dependent documentation entries, if any. - if [[ ! -d ${ENTRY_DST} ]];then - cli_printMessage "${ENTRY_DST}" 'AsCreatingLine' - svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DST}" --quiet - fi - - # Define list of files to process. - ENTRIES=$(cli_getFilesList "$(dirname ${ENTRY_DST})" "$(basename ${ENTRY_DST}).*\.texi") - - # Set action preamble. - cli_printActionPreamble "${ENTRIES}" '' '' - - # Print separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Print action message. - cli_printMessage "Updating manual menus, nodes and cross-references." 'AsResponseLine' - - # Redefine ENTRY variable in order to update documentation - # structure, taking recently created entries as reference. - for ENTRY in ${ENTRIES};do - - # Update menu and node definitions from manual sections to - # reflect the changes. - manual_updateMenu - manual_updateNodes - - # Update cross reference definitions from manual to reflect - # the changes. - manual_restoreCrossReferences - - done - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_deleteCrossReferences.sh b/Scripts/Bash/Cli/Functions/Manual/manual_deleteCrossReferences.sh deleted file mode 100755 index d7b9c68..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_deleteCrossReferences.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -# -# manual_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 manual_deleteEntry function, in order -# to keep cross reference information, inside the documentation -# manual, syncronized. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_deleteCrossReferences { - - local -a PATTERN - local -a REPLACE - local LOCATION='' - - # Define entry location. Verify first argument to make this - # function reusable. If no value is passed as first argument use - # entry global information value as default value instead. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ENTRY" - fi - - # Build the node string using entry location. - local NODE=$(echo "$LOCATION" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//" \ - -e 's! !( |\\n)!g') - - # Define regular expression patterns for texinfo cross reference - # commands. - PATTERN[0]="@(pxref|xref|ref)\{(${NODE})\}" - PATTERN[1]="^(\* ${NODE}:(.*)?:(.*)?)$" - - # Define replacement string for missing entries. It is convenient - # to keep missing entries in documentation for documentation team - # to know. Removing the missing cross reference may intorudce - # confussion. Imagine that! you are spending lots of hours in an - # article and suddenly one of your cross refereces disappears with - # no visible reason, with the next working copy update you - # perform. That's frustrating. Instead, when centos-art.sh script - # finds a missing cross reference it removes the link and remark - # the issue for you to act on it. - REPLACE[0]='--- @strong{'`gettext "Removed"`'}(\1:\2) ---' - REPLACE[1]='@comment --- '`gettext "Removed"`'(\1) ---' - - # Define list of entries to process. - local ENTRIES=$(cli_getFilesList "${MANUAL_BASEDIR}" '.*\.texi') - - # Set action preamble. - cli_printActionPreamble "$ENTRIES" '' '' - - # Update node-related cross references. The node-related cross - # reference definition, long ones specially, could require more - # than one line to be set. By default, GNU sed does not matches - # newline characters in the pattern space, so we need to make use - # of `label' feature and the `N' command in order to build a - # pattern space that includes the newline character in it. Here we - # use the `a' letter to name the label we use, followed by N - # command to add a newline to the pattern space, the s command to - # make the pattern replacement using the `g' flag to make it - # global and finaly the command `b' to branch label named `a'. - sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} - - # Update menu-related cross references. Menu-related cross - # references hardly appear in more than one line, so there is no - # need to complicate the replacement command. - sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_deleteEntry.sh b/Scripts/Bash/Cli/Functions/Manual/manual_deleteEntry.sh deleted file mode 100755 index a39a719..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_deleteEntry.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash -# -# manual_deleteEntry.sh -- This function removes a documentation entry -# from documentation directory structure. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_deleteEntry { - - local ENTRY_SRC=${ENTRY} - local ENTRIES='' - local ENTRY='' - local ENTRY_DEP='' - - # Initiate list of entries to remove using the entry specified in - # the command line. - ENTRIES=${ENTRY_SRC} - - # Verify existence of dependent entries. Dependent entries are - # stored inside a directory with the same name of the entry you - # are trying to remove. - if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]];then - - # Add dependent files to list of entries. - ENTRIES="${ENTRIES} $(cli_getFilesList "${ENTRY_DIR}/${ENTRY_FILE}" ".*\.texi")" - - # Add dependent directories to list of entries. Be aware of - # nested directories. - for ENTRY in ${ENTRIES};do - ENTRY_DEP=$(echo $ENTRY | sed -r "s/\.texi$//") - if [[ -d $ENTRY_DEP ]];then - ENTRIES="${ENTRIES} ${ENTRY_DEP}" - fi - done - - fi - - # Prepare list of entries for action preamble. - ENTRIES=$(echo ${ENTRIES} | tr ' ' "\n" | sort -r | uniq) - - # Print action preamble. - cli_printActionPreamble "$ENTRIES" 'doDelete' 'AsResponseLine' - - # Remove documentation entry using regular subversion commands. - # Do not use regular rm command here, use subversion del command - # instead. Otherwise, even the file is removed, it will be brought - # back when the final cli_commitRepoChange be executed. Remember - # there is a subversion update there, no matter what you remove - # using regular commands, when you do update the directory - # structure on the working copy the removed files (not removed in - # the repository, nor marked to be removed) are brought down to - # the working copy again. - svn del ${ENTRIES} --quiet - if [[ $? -ne 0 ]];then - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Print separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Print action message. - cli_printMessage "Updating manual menus, nodes and cross-references." 'AsResponseLine' - - # 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 entities list again to update menus, nodes - # and cross references from remaining files. - for ENTRY in ${ENTRIES};do - - # Use entry files only. Directories are used to store - # dependent entries. Directories are not considered entries on - # themselves. - if [[ ! -f $ENTRY ]];then - continue - fi - - # Update menu and node definitions from manual sections to - # reflect the changes. - manual_updateMenu "remove-entry" - manual_updateNodes - - # Update cross reference definitions from manual to reflect - # the changes. - manual_deleteCrossReferences - - done - - # Remove entry menus and nodes from chapter definition to reflect - # the fact it has been removed. This is mainly applied when one - # of the chapters (e.g., trunk/, tags/, or branches/) is removed. - if [[ ! -d $MANUAL_CHAPTER_DIR ]];then - manual_updateChaptersMenu 'remove-entry' - manual_updateChaptersNodes - fi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_editEntry.sh b/Scripts/Bash/Cli/Functions/Manual/manual_editEntry.sh deleted file mode 100755 index a50a944..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_editEntry.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# -# manual_editEntry.sh -- This function implements the edition flow of -# documentation entries inside the working copy. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_editEntry { - - # Verify chapter definition inside manual. - if [[ ! -d $MANUAL_CHAPTER_DIR ]];then - - # Print confirmation question. - cli_printMessage "`gettext "The following documentation chapter will be created:"`" - cli_printMessage "$MANUAL_CHAPTER_DIR" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - # Update manual chapter related files. - manual_updateChaptersFiles - - # Update manual chapter related menu. - manual_updateChaptersMenu - - # Update manual chapter related nodes (based on chapter - # related menu). - manual_updateChaptersNodes - - fi - - # Verify section definition inside chapters. - if [[ ! -f $ENTRY ]];then - - # Print confirmation question. - cli_printMessage "`gettext "The following documentation section will be created:"`" - cli_printMessage "$ENTRY" "AsResponseLine" - cli_printMessage "`gettext "Do you want to continue?"`" "AsYesOrNoRequestLine" - - # Update chapter section related menu. - manual_updateMenu - - # Update chapter section related nodes (based on chapter - # section related menu). - manual_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. - manual_restoreCrossReferences - - else - - # Print action message. - cli_printMessage "$ENTRY" 'AsUpdatingLine' - - fi - - # Use default text editor to edit the documentation entry. - eval $EDITOR $ENTRY - - # Print separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Rebuild output files to propagate recent changes. - manual_updateOutputFiles - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_getArguments.sh b/Scripts/Bash/Cli/Functions/Manual/manual_getArguments.sh deleted file mode 100755 index b75b400..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_getArguments.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# -# manual_getArguments.sh -- This function interpretes arguments passed -# to `manual' functionality and calls actions accordingly. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_getArguments { - - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="filter,quiet,answer,dont-commit-changes,read,search,edit,update" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - - --filter ) - FLAG_FILTER="$2" - shift 2 - ;; - - --quiet ) - FLAG_QUIET="true" - FLAG_DONT_COMMIT_CHANGES="true" - shift 1 - ;; - - --answer ) - FLAG_ANSWER="$2" - shift 2 - ;; - - --dont-commit-changes ) - FLAG_DONT_COMMIT_CHANGES="true" - shift 1 - ;; - - --read ) - ACTIONNAM="${FUNCNAM}_searchNode" - shift 1 - ;; - - --search ) - ACTIONNAM="${FUNCNAM}_searchIndex" - shift 1 - ;; - - --edit ) - ACTIONNAM="${FUNCNAM}_editEntry" - shift 1 - ;; - - --update ) - ACTIONNAM="${FUNCNAM}_updateOutputFiles" - shift 1 - ;; - - * ) - break - esac - done - - # Redefine ARGUMENTS variable using current positional parameters. - cli_doParseArgumentsReDef "$@" - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_getEntry.sh b/Scripts/Bash/Cli/Functions/Manual/manual_getEntry.sh deleted file mode 100755 index 8fc6661..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_getEntry.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# manual_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-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_getEntry { - - # Define variables as local to avoid conflicts outside. - local ENTRY='' - local LOCATION='' - - # Redefine location in order to make this function reusable not - # just for action value variable but whatever value passed as - # first possitional argument. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ACTIONVAL" - fi - - # Define relative path of entry, from trunk directory on. - ENTRY=$(echo $LOCATION | sed -r "s!^${HOME}/artwork/!!") - - # Verify the entry relative path to find out which documentation - # manual we are acting on. As convenction, whatever documentation - # entry you provide outside trunk/Manuals/ directory structure is - # considered as you are documenting the repository directory - # structure. Otherwise, if an entry inside trunk/Manuals/ is - # provided, the directory structure provided is used as default - # documentation manual for actions like `--create' and `--update' - # to take place on. Other options like `--edit', `--delete' and - # `--read' cannot be applied to paths provided is inside - # trunk/Manuals/ such actions made manually. - if [[ ${ENTRY} =~ '\.texi$' ]];then - ENTRY=$(echo ${ENTRY} | sed 's!trunk/Manual/!!') - else - ENTRY=$(dirname Filesystem/${ENTRY})/$(basename $LOCATION).texi - fi - - # Re-define entry to set absolute path to manuals base directory - # structure. - ENTRY=${MANUAL_BASEDIR}/${ENTRY} - - # Output entry's absolute path. - echo ${ENTRY} - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_getNode.sh b/Scripts/Bash/Cli/Functions/Manual/manual_getNode.sh deleted file mode 100755 index a2d9b52..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_getNode.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# manual_getNode.sh -- This function cleans up the action value -# (ACTIONVAL) directory to make a node name from it. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_getNode { - - local NODE=$(echo "$ACTIONVAL" \ - | sed -r "s!^${HOME}/artwork/!!" \ - | sed -r 's!/! !g' | sed -r 's!^[[:space:]]+!!') - - echo "$NODE" -} - diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_renameCrossReferences.sh b/Scripts/Bash/Cli/Functions/Manual/manual_renameCrossReferences.sh deleted file mode 100755 index 91fb866..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_renameCrossReferences.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# -# manual_renameCrossReferences.sh -- This function replaces a node -# pattern with a node replacement and updates cross-reference -# definitions to reflect the changes. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_renameCrossReferences { - - local NODE='' - local COUNT=1 - local ENTRIES='' - local NODE_SRC='' - local NODE_DST='' - - # Define node pattern for source documenation entry. - NODE_SRC=$(echo "$ENTRY" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//" \ - -e 's! !( |\\n)!g') - - # Define node replacement for target documentation entry. - NODE_DST=$(echo "$FLAG_TO" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//") - - # Sanitate node replacement for target documentation entry to make - # use of regular expression positional markers, so the word - # separator character found by node pattern could be used. - for NODE in $NODE_DST;do - if [[ $COUNT -eq 1 ]];then - NODE_DST="${NODE}\\${COUNT}" - else - NODE_DST="${NODE_DST}$(echo "${NODE}\\${COUNT}")" - fi - COUNT=$(($COUNT + 1)) - done - - # Remove last positional marker from node replacement. - NODE_DST=$(echo $NODE_DST | sed -r 's!\\[[:digit:]]$!!') - - # Define list of entries to process. - ENTRIES=$(cli_getFilesList "${MANUAL_BASEDIR}" '.*\.texi') - - # Set action preamble. - cli_printActionPreamble "$ENTRIES" '' '' - - # Update node-related cross-references. The node-related cross - # reference definition, long ones specially, could require more - # than one line to be set. By default, GNU sed does not matches - # newline characters in the pattern space, so we need to make use - # of `label' feature and the `N' command in order to build a - # pattern space that includes the newline character in it. Here we - # use the `a' letter to name the label we use, followed by N - # command to add a newline to the pattern space, the s command to - # make the pattern replacement using the `g' flag to make it - # global and finaly the command `b' to branch label named `a'. - sed -r -i ":a;N;s!${NODE_SRC}!${NODE_DST}!g;ba" ${ENTRIES} - - # At this point, source documentation entry has been renamed from - # source to target documentation entry, but they are still - # commented. So, restore target documentation entries. - manual_restoreCrossReferences "${FLAG_TO}" - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_renameEntry.sh b/Scripts/Bash/Cli/Functions/Manual/manual_renameEntry.sh deleted file mode 100755 index 1f56f81..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_renameEntry.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# manual_renameEntry.sh -- This function renames documentation entries -# and updates documentation structure to reflect changes. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_renameEntry { - - # Copy source documentation entry. - manual_copyEntry - - # Print separator line. - cli_printMessage '-' 'AsSeparatorLine' - - # Delete source documentation entry. The source documentation - # entry has been copied already, so to create the rename effect - # delete it from repository filesystem. - manual_deleteEntry - - # At this point, source documentation entry has been removed and - # all menu, nodes and cross-references have been commented. So, - # replace commented menu, nodes and cross-reference information - # from source to target documentation entry. - manual_renameCrossReferences - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_restoreCrossReferences.sh b/Scripts/Bash/Cli/Functions/Manual/manual_restoreCrossReferences.sh deleted file mode 100755 index c64ccc6..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_restoreCrossReferences.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# manual_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 -# manual_deleteCrossReferences function. The -# manual_restoreCrossReferences function relays in the removed message -# format produced by manual_deleteCrossReferences function, in order -# to return them back into the link format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_restoreCrossReferences { - - local -a PATTERN - local -a REPLACE - local LOCATION='' - - # Define entry location. Verify first argument to make this - # function reusable. If no value is passed as first argument use - # entry global information value as default value instead. - if [[ "$1" != '' ]];then - LOCATION="$1" - else - LOCATION="$ENTRY" - fi - - # Build the node string using entry location. - local NODE=$(echo "$LOCATION" \ - | cut -d / -f8- \ - | tr '/' ' ' \ - | sed -r \ - -e "s/(chapter-intro\.texi|\.texi)$//" \ - -e 's! !( |\\n)!g') - - # Define regular expression patterns to match removed message - # format produced by message_removeCrossReferences function. - PATTERN[0]="--- @strong\{`gettext "Removed"`\}\((pxref|xref|ref):(${NODE})\) ---" - PATTERN[1]="^@comment --- `gettext "Removed"`\((\* ${NODE}:(.*)?:(.*)?)\) ---$" - - # Define replacement string to turn removed message back to cross - # reference link. - REPLACE[0]='@\1{\2}' - REPLACE[1]='\1' - - # Define list of entries to process. - local ENTRIES=$(cli_getFilesList "${MANUAL_BASEDIR}" '.*\.texi') - - # Set action preamble. - cli_printActionPreamble "$ENTRIES" '' '' - - # Update node-related cross references. The node-related cross - # reference definition, long ones specially, could require more - # than one line to be set. By default, GNU sed does not matches - # newline characters in the pattern space, so we need to make use - # of `label' feature and the `N' command in order to build a - # pattern space that includes the newline character in it. Here we - # use the `a' letter to name the label we use, followed by N - # command to add a newline to the pattern space, the s command to - # make the pattern replacement using the `g' flag to make it - # global and finaly the command `b' to branch label named `a'. - sed -r -i ":a;N;s!${PATTERN[0]}!${REPLACE[0]}!g;ba" ${ENTRIES} - - # Update menu-related cross references. Menu-related cross - # references hardly appear in more than one line, so there is no - # need to complicate the replacement command. - sed -r -i "s!${PATTERN[1]}!${REPLACE[1]}!" ${ENTRIES} - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_searchIndex.sh b/Scripts/Bash/Cli/Functions/Manual/manual_searchIndex.sh deleted file mode 100644 index 7087f8a..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_searchIndex.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# manual_searchIndex.sh -- This function does an index search inside the -# info document. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_searchIndex { - - # Check flag filter. By default flag filter has the `.+' value - # which is not very descriptive in the sake of an index-search. - # So, when no value is passed through --filter option use top node - # as default value for index-search. - if [[ "$FLAG_FILTER" == '.+' ]];then - cli_printMessage "`gettext "Use the \\\`--filter' option to define the search pattern."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsReadingLine' - - # Execute info command to perform an index-search. - /usr/bin/info --index-search="$FLAG_FILTER" --file=${MANUAL_BASEFILE}.info.bz2 - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_searchNode.sh b/Scripts/Bash/Cli/Functions/Manual/manual_searchNode.sh deleted file mode 100755 index 29a7b9a..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_searchNode.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# manual_searchNode.sh -- This function does a node search inside the -# info document. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_searchNode { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsReadingLine' - - # Check entry inside documentation structure. If the entry - # exits use the info reader to open the info file at the - # specified node. Otherwise, ask the user for create it. - if [[ -f "$ENTRY" ]];then - /usr/bin/info --node="Filesystem $(manual_getNode)" --file=${MANUAL_BASEFILE}.info.bz2 - else - manual_editEntry - fi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersFiles.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersFiles.sh deleted file mode 100755 index 3119b8f..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersFiles.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# manual_updateChaptersFiles.sh -- This function updates chapter related -# files. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateChaptersFiles { - - # Define chapter's generic structure. - local CHAPTERBODY="\ - @node $MANUAL_CHAPTER_NAME - @chapter $MANUAL_CHAPTER_NAME - @cindex $(echo $MANUAL_CHAPTER_NAME | tr '[[:upper:]]' '[[:lower:]]') - @include $MANUAL_CHAPTER_NAME/chapter-intro.texi - @include $MANUAL_CHAPTER_NAME/chapter-menu.texi - @include $MANUAL_CHAPTER_NAME/chapter-nodes.texi" - - # Remove any space/tabs at the begining of @... lines. - CHAPTERBODY=$(echo "$CHAPTERBODY" | sed -r 's!^[[:space:]]+@!@!') - - # Create directory to store chapter files. - if [[ ! -d $MANUAL_CHAPTER_DIR ]];then - mkdir $MANUAL_CHAPTER_DIR - fi - - # Create files to store chapter information. If chapter files - # already exist, they will be re-written and any previous - # information inside them will be lost. - echo "$CHAPTERBODY" > $MANUAL_CHAPTER_DIR/chapter.texi - echo "" > $MANUAL_CHAPTER_DIR/chapter-menu.texi - echo "" > $MANUAL_CHAPTER_DIR/chapter-nodes.texi - - # Initialize chapter instroduction using template file. - cp ${FUNCCONFIG}/manual-cha-intro.texi $MANUAL_CHAPTER_DIR/chapter-intro.texi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersMenu.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersMenu.sh deleted file mode 100755 index 1e3542b..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersMenu.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# manual_updateChaptersMenu.sh - This function updates chapter menu. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateChaptersMenu { - - local ACTION=$1 - local MENUCHAPTERS='' - - # Build menu of chapters. The Index node is not included as other - # nodes are. The Index node is defined insde the master texinfo - # file (repository.texi). To create the final .info file - # correctly, the Index line in the menu should remain, even no - # other node exist. - if [[ -f ${MANUAL_BASEFILE}-menu.texi ]];then - MENUCHAPTERS=$(cat ${MANUAL_BASEFILE}-menu.texi \ - | egrep -v "^(@(end )?menu$|\* Index::.*)$") - fi - - # Re-defined menu of chapters based on action. - case $ACTION in - 'remove-entry' ) - # Remove chapter from menu. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" \ - | egrep -v "^\* ${MANUAL_CHAPTER_NAME}::[[:print:]]*$") - ;; - 'update-entry' | * ) - # Update chapter menu using texinfo format. - MENUCHAPTERS="${MENUCHAPTERS} - * ${MANUAL_CHAPTER_NAME}::" - ;; - esac - - # Remove opening spaces/tabs and empty line from the menu of - # chapters. Empty lines may occur the first time the menu of - # chapters is created. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ - | egrep -v '^[[:space:]]*$') - - # Organize menu of chapters alphabetically and verify that no - # duplicated line be included on the list. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sort | uniq ) - - # Give format to final menu output. - MENUCHAPTERS="@menu - ${MENUCHAPTERS} - * Index:: - @end menu" - - # Strip opening space/tabs from final menu of chapters. - MENUCHAPTERS=$(echo "${MENUCHAPTERS}" | sed -r 's!^[[:space:]]+!!' \ - | egrep -v '^[[:space:]]*$') - - # Dump organized menu of chapters into file. - echo "${MENUCHAPTERS}" > ${MANUAL_BASEFILE}-menu.texi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersNodes.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersNodes.sh deleted file mode 100755 index 7ebfe77..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateChaptersNodes.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# manual_updateChaptersNodes.sh - This function updates nodes of -# chapters based on menu of chapters. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateChaptersNodes { - - # Build list "nodes of chapters" based on menu of chapters. - local CHAPTERNODES=$(cat ${MANUAL_BASEFILE}-menu.texi \ - | egrep -v '^@(end )?menu$' \ - | egrep -v "^\* `gettext "Index"`::[[:print:]]*$" \ - | sed -r 's!^\* !!' | sed -r 's!::[[:print:]]*$!!g' \ - | sed -r 's! !_!g' | sort | uniq ) - - # Build list of texinfo inclusions to load chapters' nodes. - local FILENODE=$(\ - for CHAPTERNODE in ${CHAPTERNODES};do - - INCL=$(echo ${CHAPTERNODE} | sed -r "s!(${CHAPTERNODE})!\1/chapter\.texi!") - - # Output inclusion line using texinfo format. - echo "@include $INCL" - - done) - - # Dump organized nodes of chapters into file. - echo "$FILENODE" > ${MANUAL_BASEFILE}-nodes.texi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateMenu.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateMenu.sh deleted file mode 100755 index 50c423c..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateMenu.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# manual_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-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateMenu { - - # Specify which action to do inside chapter's menu. - local ACTION="$1" - - # Build the menu node related to the entry being processed - # currently. - local MENUNODE=$(echo "$ENTRY" | cut -d / -f8- | tr '/' ' ' \ - | sed 's!\.texi$!!') - - # Give format to menu line using texinfo style. - local MENULINE="* ${MANUAL_CHAPTER_NAME} $MENUNODE::" - - # Define chapter's menu. Remove `@menu', `@end menu', and empty lines - # from output. - local MENU=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ - | egrep -v '^[[:space:]]*$' | egrep -v '^@(end )?menu') - - # Re-defined chapter's menu based on action. - case $ACTION in - 'remove-entry' ) - # Remove menu line from chapter's menu. - MENU=$(echo "$MENU" | egrep -v "$MENULINE") - ;; - 'update-entry' | * ) - # Add menu line to chapter's menu. This is the default - # behaivour if no argument is passed to manual_updateMenu - # function. - MENU="$MENU - $MENULINE" - ;; - esac - - # Organize menu alphabetically, remove empty and duplicated lines. - # At this point, empty line may occur the first time the menu is - # created, don't let them to scape. - MENU=$(echo "$MENU" | egrep -v '^[[:space:]]*$' | sort | uniq ) - - # Rebuild chapter's menu structure adding '@menu' and '@end menu' - # lines back in menu. - MENU="@menu - $MENU - @end menu" - - # Remove opening spaces/tabs from final menu structure. - MENU=$(echo "$MENU" | sed -r 's!^[[:space:]]+!!g') - - # Dump final menu structure back into chapter's menu file. - echo "$MENU" > $MANUAL_CHAPTER_DIR/chapter-menu.texi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateNodes.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateNodes.sh deleted file mode 100755 index 60ccfb4..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateNodes.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# -# manual_updateNodes.sh -- This function updates chapter's nodes -# definition using the chapter's menu as reference. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateNodes { - - # Retrive nodes' entries from chapter-menu.texi file. - local NODES=$(cat $MANUAL_CHAPTER_DIR/chapter-menu.texi \ - | sed -r 's!^\* !!' | sed -r 's!:{1,2}.*$!!g' \ - | egrep -v '^@(end )?menu$' | sed -r 's! !:!g' | sort | uniq) - - # Re-build node structure based on menu information. - for NODE in $NODES;do - - NODE=$(echo "${NODE}" | sed -r 's!:! !g') - SECT=$(echo "$NODE" | sed -r 's! !/!g' | sed "s!${MANUAL_CHAPTER_NAME}/!!") - INCL=$(echo "$NODE" | sed -r 's! !/!g').texi - CIND=$(echo "$NODE") - - # Create an empty directory to store texinfo files. - if [[ ! -d ${MANUAL_BASEDIR}/$(dirname "$INCL") ]];then - mkdir -p ${MANUAL_BASEDIR}/$(dirname "$INCL") - fi - - # Create texinfo section file using its template. - if [[ ! -f ${MANUAL_BASEDIR}/$INCL ]];then - cp ${FUNCCONFIG}/manual-section.texi ${MANUAL_BASEDIR}/$INCL - fi - - # Output node information based on texinfo menu. - echo "@node $NODE" - echo "@section `eval_gettext "The @file{\\\$SECT} Directory"`" - echo "@cindex $CIND" - echo "@include $INCL" - echo "" - - # Dump node information into chapter node file. - done > $MANUAL_CHAPTER_DIR/chapter-nodes.texi - -} - diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileHtml.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileHtml.sh deleted file mode 100755 index c44d708..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileHtml.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFileHtml.sh -- This function exports -# documentation manual to HTML format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFileHtml { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}-html" 'AsUpdatingLine' - - # Check html output directory - [[ ! -d ${MANUAL_BASEFILE}-html ]] && mkdir -p ${MANUAL_BASEFILE}-html - - # Add html output directory into directory stack to make it the - # current working directory. Otherwise texi2html may produce - # incorrect paths to images included. - pushd ${MANUAL_BASEFILE}-html > /dev/null - - # Update html files. Use texi2html to export from texinfo file - # format to html using CentOS Web default visual style. - texi2html ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}-html --split section \ - --nosec-nav \ - --css-include=${HOME}/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \ - -I=${HOME}/artwork - - # Apply html transformations. Html transformations rely on - # Texi2html default html output. The main goal of these html - # transformations is to build specific html structures that match - # specific css definitions. This way we extend the visual style of - # Texi2html default html output. - sed -r -i \ - -f ${HOME}/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \ - ${MANUAL_BASEFILE}-html/*.html - - # Remove html output directory from directory stack. - popd > /dev/null - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileInfo.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileInfo.sh deleted file mode 100755 index 0dd59b7..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileInfo.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFileInfo.sh -- This function exports -# documentation manual to info format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFileInfo { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.info.bz2" 'AsUpdatingLine' - - # Update info file. - /usr/bin/makeinfo ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.info - - # Compress info file. - if [[ $? -eq 0 ]];then - bzip2 -f ${MANUAL_BASEFILE}.info - fi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFilePdf.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFilePdf.sh deleted file mode 100755 index ff2caac..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFilePdf.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFilePdf.sh -- This function exports documentation -# manual to PDF format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFilePdf { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.pdf" 'AsUpdatingLine' - - # Update plaintext output directory. - /usr/bin/texi2pdf --quiet \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.pdf - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFilePlaintext.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFilePlaintext.sh deleted file mode 100755 index 16aaf7c..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFilePlaintext.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFilePlaintext.sh -- This function exports -# documentation manual to plain-text format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFilePlaintext { - - # Output action message. - cli_printMessage "${MANUAL_BASEFILE}.txt.bz2" 'AsUpdatingLine' - - # Update plaintext output directory. - /usr/bin/makeinfo --plaintext \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.txt - - # Compress plaintext output file. - if [[ -f ${MANUAL_BASEFILE}.txt ]];then - bzip2 ${MANUAL_BASEFILE}.txt --force - fi - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileXml.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileXml.sh deleted file mode 100755 index 17b2704..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFileXml.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFileXml.sh -- This function exports documentation -# manual to XML format. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFileXml { - - # Print action message. - cli_printMessage "${MANUAL_BASEFILE}.xml" 'AsUpdatingLine' - - # Update xml output format. - /usr/bin/makeinfo --xml \ - ${MANUAL_BASEFILE}.texi --output=${MANUAL_BASEFILE}.xml \ - -} diff --git a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFiles.sh b/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFiles.sh deleted file mode 100755 index c3ded4b..0000000 --- a/Scripts/Bash/Cli/Functions/Manual/manual_updateOutputFiles.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# manual_updateOutputFiles.sh -- This function exports documentation -# manual to different output formats. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function manual_updateOutputFiles { - - # Remove extension from manual's base file. This way it is - # possible to reuse the same filename on different types of files. - MANUAL_BASEFILE=$(echo ${MANUAL_BASEFILE} | sed -r 's!\.texi!!') - - # 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 - - manual_updateOutputFileInfo - manual_updateOutputFileHtml - manual_updateOutputFileXml - manual_updateOutputFilePdf - manual_updateOutputFilePlaintext - - # Remove the working copy root directory from directory stack. - popd > /dev/null - -}