|
Alain Reguera Delgado |
8f60cb |
#!/bin/bash
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# texinfo_createStructure.sh -- This function creates the
|
|
Alain Reguera Delgado |
8f60cb |
# documentation structure of a manual using the current language as
|
|
Alain Reguera Delgado |
8f60cb |
# reference.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# Copyright (C) 2009-2013 The CentOS Project
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is free software; you can redistribute it and/or modify
|
|
Alain Reguera Delgado |
8f60cb |
# it under the terms of the GNU General Public License as published by
|
|
Alain Reguera Delgado |
8f60cb |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
Alain Reguera Delgado |
8f60cb |
# your option) any later version.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# This program is distributed in the hope that it will be useful, but
|
|
Alain Reguera Delgado |
8f60cb |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Alain Reguera Delgado |
8f60cb |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
8f60cb |
# General Public License for more details.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# You should have received a copy of the GNU General Public License
|
|
Alain Reguera Delgado |
8f60cb |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
8f60cb |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Alain Reguera Delgado |
8f60cb |
#
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
# $Id$
|
|
Alain Reguera Delgado |
8f60cb |
# ----------------------------------------------------------------------
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
function texinfo_createStructure {
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify manual main definition file. If it already exist, assume
|
|
Alain Reguera Delgado |
8f60cb |
# it was correctly created in the past. Otherwise try to create
|
|
Alain Reguera Delgado |
8f60cb |
# it. Don't use the manual base directory here, it would prevent
|
|
Alain Reguera Delgado |
8f60cb |
# documentation manuals from being created on different languages.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ -f ${MANUAL_BASEFILE}.${MANUAL_EXTENSION} ]];then
|
|
Alain Reguera Delgado |
8f60cb |
return
|
|
Alain Reguera Delgado |
8f60cb |
else
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`eval_gettext "The following documentation manual doesn't exist:"`" --as-stdout-line
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${MANUAL_BASEFILE}.${MANUAL_EXTENSION}" --as-response-line
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "Do you want to create it now?"`" --as-yesornorequest-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize manual's information (e.g., title, subtitle, abstract).
|
|
Alain Reguera Delgado |
8f60cb |
local MANUAL_TITLE=''
|
|
Alain Reguera Delgado |
8f60cb |
local MANUAL_SUBTITLE=''
|
|
Alain Reguera Delgado |
8f60cb |
local MANUAL_ABSTRACT=''
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Retrieve manual's information from standard input.
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "Enter manual's title"`" --as-request-line
|
|
Alain Reguera Delgado |
8f60cb |
read MANUAL_TITLE
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "Enter manual's subtitle"`" --as-request-line
|
|
Alain Reguera Delgado |
8f60cb |
read MANUAL_SUBTITLE
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "Enter manual's abstract"`" --as-request-line
|
|
Alain Reguera Delgado |
8f60cb |
read MANUAL_ABSTRACT
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify manual's information. The title information must be
|
|
Alain Reguera Delgado |
8f60cb |
# non-empty value.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ $MANUAL_TITLE == '' ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "`gettext "The manual title cannot be empty."`" --as-error-line
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Create manual's top-level directory using default version
|
|
Alain Reguera Delgado |
8f60cb |
# control system. This is the place where all texinfo
|
|
Alain Reguera Delgado |
8f60cb |
# documentation manuals are stored in.
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ! -d ${MANUAL_BASEDIR} ]];then
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${MANUAL_BASEDIR}" --as-creating-line
|
|
Alain Reguera Delgado |
8f60cb |
cli_runFnEnvironment vcs --quiet --mkdir ${MANUAL_BASEDIR}
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Create manual's base directory. This is the place where
|
|
Alain Reguera Delgado |
8f60cb |
# language-specific documentation source files are stored in.
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${MANUAL_BASEDIR_L10N}" --as-creating-line
|
|
Alain Reguera Delgado |
8f60cb |
cli_runFnEnvironment vcs --quiet --mkdir ${MANUAL_BASEDIR_L10N}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define file names required to build the manual.
|
|
Alain Reguera Delgado |
8f60cb |
local FILE=''
|
|
Alain Reguera Delgado |
8f60cb |
local FILES=$(cli_getFilesList "${MANUAL_TEMPLATE_L10N}" \
|
|
Alain Reguera Delgado |
8f60cb |
--maxdepth='1' \
|
|
Alain Reguera Delgado |
8f60cb |
--pattern="^.+/manual((-menu|-nodes|-index)?\.${MANUAL_EXTENSION}|\.conf)$")
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Verify manual base file. The manual base file is where the
|
|
Alain Reguera Delgado |
8f60cb |
# documentation manual is defined in the format format. Assuming
|
|
Alain Reguera Delgado |
8f60cb |
# no file exists (e.g., a new language-specific manual is being
|
|
Alain Reguera Delgado |
8f60cb |
# created), use texinfo templates for it.
|
|
Alain Reguera Delgado |
8f60cb |
for FILE in $FILES;do
|
|
Alain Reguera Delgado |
8f60cb |
if [[ ! -f ${MANUAL_BASEDIR_L10N}/$(basename ${FILE}) ]];then
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Be sure the file is inside the working copy and under
|
|
Alain Reguera Delgado |
8f60cb |
# version control.
|
|
Alain Reguera Delgado |
8f60cb |
cli_checkFiles ${FILE} --is-versioned
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Define target file.
|
|
Alain Reguera Delgado |
8f60cb |
local DST=${MANUAL_BASEDIR_L10N}/$(basename ${FILE} \
|
|
Alain Reguera Delgado |
8f60cb |
| sed -r "s!manual!${MANUAL_NAME}!")
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Print action name.
|
|
Alain Reguera Delgado |
8f60cb |
cli_printMessage "${DST}" --as-creating-line
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Copy using subversion to register this action.
|
|
Alain Reguera Delgado |
8f60cb |
cli_runFnEnvironment vcs --quiet --copy ${FILE} ${DST}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Expand common translation markers inside target file.
|
|
Alain Reguera Delgado |
8f60cb |
cli_expandTMarkers ${DST}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Expand specific translation markers inside target file.
|
|
Alain Reguera Delgado |
8f60cb |
sed -r -i -e "s!=MANUAL_NAME=!${MANUAL_NAME}!g" \
|
|
Alain Reguera Delgado |
8f60cb |
-e "s!=MANUAL_TITLE=!${MANUAL_TITLE}!g" \
|
|
Alain Reguera Delgado |
8f60cb |
-e "s!=MANUAL_SUBTITLE=!${MANUAL_SUBTITLE}!g" \
|
|
Alain Reguera Delgado |
8f60cb |
-e "s!=MANUAL_ABSTRACT=!${MANUAL_ABSTRACT}!g" $DST
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
fi
|
|
Alain Reguera Delgado |
8f60cb |
done
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Initialize chapter structure inside the manual.
|
|
Alain Reguera Delgado |
8f60cb |
texinfo_createStructureChapters
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
# Redefine absolute path to changed directory.
|
|
Alain Reguera Delgado |
8f60cb |
MANUAL_CHANGED_DIRS=${MANUAL_BASEDIR}
|
|
Alain Reguera Delgado |
8f60cb |
|
|
Alain Reguera Delgado |
8f60cb |
}
|