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