|
|
2c488f |
#!/bin/bash
|
|
|
2c488f |
#
|
|
|
993f6a |
# texinfo_createStructure.sh -- This function creates the
|
|
|
2c488f |
# documentation structure of a manual using the current language as
|
|
|
2c488f |
# reference.
|
|
|
2c488f |
#
|
|
|
2fe9b7 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
2c488f |
#
|
|
|
2c488f |
# This program is free software; you can redistribute it and/or modify
|
|
|
2c488f |
# it under the terms of the GNU General Public License as published by
|
|
|
2c488f |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
2c488f |
# your option) any later version.
|
|
|
2c488f |
#
|
|
|
2c488f |
# This program is distributed in the hope that it will be useful, but
|
|
|
2c488f |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
2c488f |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
2c488f |
# General Public License for more details.
|
|
|
2c488f |
#
|
|
|
2c488f |
# You should have received a copy of the GNU General Public License
|
|
|
2c488f |
# along with this program; if not, write to the Free Software
|
|
|
2c488f |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
2c488f |
#
|
|
|
2c488f |
# ----------------------------------------------------------------------
|
|
|
2c488f |
# $Id$
|
|
|
2c488f |
# ----------------------------------------------------------------------
|
|
|
2c488f |
|
|
|
993f6a |
function texinfo_createStructure {
|
|
|
2c488f |
|
|
|
2c488f |
# Verify manual base directory. The manual base directory is where
|
|
|
2c488f |
# the whole documentation manual is stored in. If it already
|
|
|
2c488f |
# exist, assume it was correctly created in the past.
|
|
|
2c488f |
if [[ -d $MANUAL_BASEDIR ]];then
|
|
|
2c488f |
return
|
|
|
6150a1 |
else
|
|
|
edaa9d |
cli_printMessage "-" --as-separator-line
|
|
|
edaa9d |
cli_printMessage "`eval_gettext "The following documentation manual will be created:"`"
|
|
|
edaa9d |
cli_printMessage "${MANUAL_BASEFILE}.texinfo" --as-response-line
|
|
|
edaa9d |
cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line
|
|
|
2c488f |
fi
|
|
|
2c488f |
|
|
|
6150a1 |
# Initialize manual's information (e.g., title, subtitle, abstract).
|
|
|
6150a1 |
local MANUAL_TITLE=''
|
|
|
6150a1 |
local MANUAL_SUBTITLE=''
|
|
|
6150a1 |
local MANUAL_ABSTRACT=''
|
|
|
6150a1 |
|
|
|
edaa9d |
# Create manual's top-level directory using subversion. This is
|
|
|
edaa9d |
# the place where all texinfo documentation manuals is stored in.
|
|
|
5e989a |
if [[ ! -d ${MANUAL_BASEDIR} ]];then
|
|
|
5e989a |
svn mkdir ${MANUAL_BASEDIR} --quiet
|
|
|
6150a1 |
fi
|
|
|
6150a1 |
|
|
|
6150a1 |
# Create manual's base directory. This is the place where
|
|
|
6150a1 |
# language-specific documentation source files are stored in.
|
|
|
f6c432 |
svn mkdir ${MANUAL_BASEDIR_L10N} --quiet
|
|
|
2c488f |
|
|
|
6150a1 |
# Retrive manual's information from standard input.
|
|
|
edaa9d |
cli_printMessage "`gettext "Manual Title"`" --as-request-line
|
|
|
6150a1 |
read MANUAL_TITLE
|
|
|
edaa9d |
cli_printMessage "`gettext "Manual Subtitle"`" --as-request-line
|
|
|
6150a1 |
read MANUAL_SUBTITLE
|
|
|
edaa9d |
cli_printMessage "`gettext "Manual Abstract"`" --as-request-line
|
|
|
6150a1 |
read MANUAL_ABSTRACT
|
|
|
6150a1 |
|
|
|
6150a1 |
# Print action message.
|
|
|
6150a1 |
cli_printMessage "-" --as-separator-line
|
|
|
edaa9d |
cli_printMessage "`gettext "Creating manual structure in texinfo format."`" --as-response-line
|
|
|
6150a1 |
|
|
|
6150a1 |
# Verify manual's information. The title information must be
|
|
|
6150a1 |
# non-empty value.
|
|
|
6150a1 |
if [[ $MANUAL_TITLE == '' ]];then
|
|
|
edaa9d |
cli_printMessage "`gettext "The manual title cannot be empty."`" --as-error-line
|
|
|
6150a1 |
fi
|
|
|
6150a1 |
|
|
|
420e77 |
# Define file names required to build the manual.
|
|
|
420e77 |
local FILE=''
|
|
|
6150a1 |
local FILES=$(cli_getFilesList "${MANUAL_TEMPLATE_L10N}" \
|
|
|
420e77 |
--maxdepth='1' \
|
|
|
2f2776 |
--pattern="manual((-menu|-nodes|-index)?\.${MANUAL_EXTENSION}|\.conf)")
|
|
|
420e77 |
|
|
|
2c488f |
# Verify manual base file. The manual base file is where the
|
|
|
2c488f |
# documentation manual is defined in the backend format. Assuming
|
|
|
2c488f |
# no file exists (e.g., a new language-specific manual is being
|
|
|
420e77 |
# created), use texinfo templates for it.
|
|
|
420e77 |
for FILE in $FILES;do
|
|
|
f2cecf |
if [[ ! -f ${MANUAL_BASEDIR_L10N}/$(basename ${FILE}) ]];then
|
|
|
6150a1 |
|
|
|
6150a1 |
# Be sure the file is inside the working copy and under
|
|
|
6150a1 |
# version control.
|
|
|
420e77 |
cli_checkFiles ${FILE} -wn
|
|
|
6150a1 |
|
|
|
6150a1 |
# Define target file.
|
|
|
f2cecf |
local DST=${MANUAL_BASEDIR_L10N}/$(basename ${FILE} \
|
|
|
6150a1 |
| sed -r "s!manual!${MANUAL_NAME}!")
|
|
|
6150a1 |
|
|
|
6150a1 |
# Copy using subversion to register this action.
|
|
|
edaa9d |
svn cp ${FILE} ${DST} --quiet
|
|
|
d286ed |
|
|
|
6150a1 |
# Expand common translation markers inside target file.
|
|
|
54cb18 |
cli_expandTMarkers ${DST}
|
|
|
6150a1 |
|
|
|
6150a1 |
# Expand specific translation markers inside target file.
|
|
|
6150a1 |
sed -r -i -e "s!=MANUAL_NAME=!${MANUAL_NAME}!g" \
|
|
|
6150a1 |
-e "s!=MANUAL_TITLE=!${MANUAL_TITLE}!g" \
|
|
|
6150a1 |
-e "s!=MANUAL_SUBTITLE=!${MANUAL_SUBTITLE}!g" \
|
|
|
6150a1 |
-e "s!=MANUAL_ABSTRACT=!${MANUAL_ABSTRACT}!g" $DST
|
|
|
6150a1 |
|
|
|
2c488f |
fi
|
|
|
2c488f |
done
|
|
|
2c488f |
|
|
|
edaa9d |
# Initialize chapter structure inside the manual.
|
|
|
ef43e2 |
texinfo_createStructureChapters
|
|
|
2c488f |
|
|
|
d286ed |
# Redefine absolute path to changed directory.
|
|
|
d286ed |
MANUAL_CHANGED_DIRS=${MANUAL_BASEDIR}
|
|
|
d286ed |
|
|
|
2c488f |
}
|