|
|
522184 |
#!/bin/bash
|
|
|
522184 |
#
|
|
|
22d055 |
# texinfo.sh -- This function initilializes Texinfo documentation
|
|
|
22d055 |
# backend used by `centos-art.sh' script to produce and maintain
|
|
|
22d055 |
# documentation manuals written in Texinfo format, inside the working
|
|
|
22d055 |
# copy of The CentOS Artwork Repository.
|
|
|
522184 |
#
|
|
|
2fe9b7 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
522184 |
#
|
|
|
522184 |
# This program is free software; you can redistribute it and/or modify
|
|
|
522184 |
# it under the terms of the GNU General Public License as published by
|
|
|
2fe9b7 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
2fe9b7 |
# your option) any later version.
|
|
|
522184 |
#
|
|
|
522184 |
# This program is distributed in the hope that it will be useful, but
|
|
|
522184 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
522184 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
522184 |
# General Public License for more details.
|
|
|
522184 |
#
|
|
|
522184 |
# You should have received a copy of the GNU General Public License
|
|
|
522184 |
# along with this program; if not, write to the Free Software
|
|
|
522184 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
522184 |
#
|
|
|
522184 |
# ----------------------------------------------------------------------
|
|
|
522184 |
# $Id$
|
|
|
522184 |
# ----------------------------------------------------------------------
|
|
|
522184 |
|
|
|
522184 |
function texinfo {
|
|
|
522184 |
|
|
|
e0c375 |
# Verify documentation entry to be sure it coincides with
|
|
|
e0c375 |
# Texinfo's supported structuring (e.g., texinfo-4.8 doesn't
|
|
|
e0c375 |
# support structuring through parts, but chapters and sections
|
|
|
e0c375 |
# only).
|
|
|
e0c375 |
if [[ $MANUAL_PART_NAME != '' ]];then
|
|
|
e0c375 |
cli_printMessage "The documentation entry provided isn't supported." --as-error-line
|
|
|
e0c375 |
fi
|
|
|
e0c375 |
|
|
|
e0c375 |
# Define file extension used by source files inside manuals.
|
|
|
e0c375 |
MANUAL_EXTENSION="${MANUAL_BACKEND}"
|
|
|
e0c375 |
|
|
|
e9a725 |
# Define absolute path to template directory. This is the place
|
|
|
e9a725 |
# where we store locale directories (e.g., en_US, es_ES, etc.)
|
|
|
e9a725 |
# used to build manuals in texinfo format.
|
|
|
e9a725 |
MANUAL_TEMPLATE=${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}/$(cli_getRepoName \
|
|
|
e9a725 |
${MANUAL_BACKEND} -d)/Templates
|
|
|
e9a725 |
|
|
|
e9a725 |
# Define absolute path to language-specific template directory.
|
|
|
e9a725 |
# This is the place where we store locale-specific files used to
|
|
|
e9a725 |
# build manuals in texinfo format.
|
|
|
e9a725 |
MANUAL_TEMPLATE_L10N=${MANUAL_TEMPLATE}/${MANUAL_L10N}
|
|
|
e9a725 |
|
|
|
e9a725 |
# Verify absolute path to language-speicific template directory.
|
|
|
e9a725 |
# If it doesn't exist, use English language as default location to
|
|
|
e9a725 |
# retrive template files.
|
|
|
e9a725 |
if [[ ! -d $MANUAL_TEMPLATE_L10N ]];then
|
|
|
e9a725 |
MANUAL_TEMPLATE_L10N=${MANUAL_TEMPLATE}/en_US
|
|
|
e9a725 |
fi
|
|
|
e9a725 |
|
|
|
848ff6 |
# Initialize document structure for new manuals.
|
|
|
ef43e2 |
texinfo_createStructure
|
|
|
522184 |
|
|
|
e7414c |
# Define documentation entry default values. To build the
|
|
|
e9a725 |
# documentation entry, we combine the manual's name, part, chapter
|
|
|
e9a725 |
# and section information retrived from the command-line.
|
|
|
48d877 |
if [[ $MANUAL_CHAPTER_NAME == '' ]];then
|
|
|
48d877 |
|
|
|
48d877 |
# When chapter option is not provided, discard the section
|
|
|
48d877 |
# name and define documentation entry based on manual's main
|
|
|
48d877 |
# definition file.
|
|
|
48d877 |
MANUAL_ENTRY="${MANUAL_BASEFILE}.${MANUAL_EXTENSION}"
|
|
|
48d877 |
|
|
|
48d877 |
elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME == '' ]];then
|
|
|
48d877 |
|
|
|
48d877 |
# When chapter option is provided whith out a section name,
|
|
|
48d877 |
# verify chapter's directory inside the manual,
|
|
|
ef43e2 |
texinfo_createChapter
|
|
|
48d877 |
|
|
|
48d877 |
# and define documentation entry based on chapter's main
|
|
|
48d877 |
# definition file.
|
|
|
48d877 |
MANUAL_ENTRY="${MANUAL_BASEDIR_L10N}/${MANUAL_CHAPTER_NAME}/chapter.${MANUAL_EXTENSION}"
|
|
|
48d877 |
|
|
|
48d877 |
elif [[ $MANUAL_CHAPTER_NAME != '' ]] && [[ $MANUAL_SECTION_NAME != '' ]];then
|
|
|
48d877 |
|
|
|
48d877 |
# When both the chapter option and non-option arguments are
|
|
|
48d877 |
# provided, define documentation entries based on manual,
|
|
|
48d877 |
# chapter and non-option arguments.
|
|
|
ef43e2 |
MANUAL_ENTRY="$(texinfo_getEntry "$MANUAL_SECTION_NAME")"
|
|
|
48d877 |
|
|
|
48d877 |
else
|
|
|
48d877 |
cli_printMessage "`gettext "The parameters you provided are not supported."`" --as-error-line
|
|
|
48d877 |
fi
|
|
|
48d877 |
|
|
|
e7414c |
# Execute action names. Notice that we've separated execution of
|
|
|
e7414c |
# action names in order to control and save differences among
|
|
|
e7414c |
# them.
|
|
|
e7414c |
if [[ $ACTIONNAM == "" ]];then
|
|
|
edaa9d |
|
|
|
e7414c |
# When no action name is provided to `centos-art.sh' script,
|
|
|
e7414c |
# read manual's output in info format in order to provide a
|
|
|
e7414c |
# way for people to get oriented about The CentOS Artwork
|
|
|
e7414c |
# Repository and its automation tool, the centos-art.sh
|
|
|
e7414c |
# script. Be sure the manual's output file does exist and
|
|
|
e7414c |
# terminate the script execution once the reading is done.
|
|
|
edaa9d |
|
|
|
499af4 |
# Update manual's output files.
|
|
|
ef43e2 |
texinfo_updateOutputFiles
|
|
|
e7414c |
|
|
|
22d055 |
# Read manual's Top node from its info output file.
|
|
|
22d055 |
info --node="Top" --file="${MANUAL_BASEFILE}.info.bz2"
|
|
|
edaa9d |
|
|
|
e7414c |
elif [[ $ACTIONNAM =~ "^(copy|rename)Entry$" ]];then
|
|
|
522184 |
|
|
|
e7414c |
# Both `--copy' and `--rename' actions interpret non-option
|
|
|
e7414c |
# arguments passed to `centos-art.sh' script in a special way.
|
|
|
e7414c |
# In this configuration, only two non-option arguments are
|
|
|
499af4 |
# processed in the first loop of their interpretation.
|
|
|
ef43e2 |
texinfo_${ACTIONNAM}
|
|
|
522184 |
|
|
|
22d055 |
# Rebuild output files to propagate recent changes, if any.
|
|
|
ef43e2 |
texinfo_updateOutputFiles
|
|
|
22d055 |
|
|
|
22d055 |
# Break interpretation of non-option arguments to prevent the
|
|
|
499af4 |
# second and further non-option arguments from being
|
|
|
22d055 |
# considered as source location.
|
|
|
e7414c |
break
|
|
|
e7414c |
|
|
|
e7414c |
elif [[ $ACTIONNAM =~ "^(search(Node|Index)|updateOutputFiles)$" ]];then
|
|
|
e7414c |
|
|
|
e7414c |
# The two final actions of help functionality are precisely to
|
|
|
e7414c |
# update manual output files and commit all changes from
|
|
|
e7414c |
# working copy to central repository. In this situation, when
|
|
|
e9a725 |
# the `--update-output' option is provided to `centos-art.sh',
|
|
|
e7414c |
# don't duplicate the rendition of manual output files (e.g.,
|
|
|
e9a725 |
# one for the option and other for help's normal execution
|
|
|
e7414c |
# flow) nor commit any change form working copy to central
|
|
|
e9a725 |
# repository (e.g., output files aren't under version
|
|
|
e7414c |
# control).
|
|
|
ef43e2 |
texinfo_${ACTIONNAM}
|
|
|
e7414c |
|
|
|
522184 |
else
|
|
|
522184 |
|
|
|
e9a725 |
# Execute action names as part of normal help's execution
|
|
|
e9a725 |
# flow, without any extra modification.
|
|
|
ef43e2 |
texinfo_${ACTIONNAM}
|
|
|
edaa9d |
|
|
|
22d055 |
# Rebuild output files to propagate recent changes, if any.
|
|
|
ef43e2 |
texinfo_updateOutputFiles
|
|
|
22d055 |
|
|
|
edaa9d |
fi
|
|
|
522184 |
|
|
|
522184 |
}
|