|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# texinfo_updateOutputFileXhtml.sh -- This function exports
|
|
|
878a2b |
# documentation manual to HTML format.
|
|
|
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_updateOutputFileXhtml {
|
|
|
878a2b |
|
|
|
878a2b |
# Output action message.
|
|
|
878a2b |
cli_printMessage "${MANUAL_BASEFILE}.xhtml.tar.bz2" --as-response-line
|
|
|
878a2b |
|
|
|
878a2b |
# Verify initialization files used by texi2html.
|
|
|
878a2b |
cli_checkFiles ${MANUAL_TEMPLATE}/manual-init.pl
|
|
|
878a2b |
cli_checkFiles ${MANUAL_TEMPLATE_L10N}/manual-init.pl
|
|
|
878a2b |
|
|
|
878a2b |
# Verify transformation files used to modify texi2html output.
|
|
|
878a2b |
cli_checkFiles ${MANUAL_TEMPLATE}/manual.sed
|
|
|
878a2b |
cli_checkFiles ${MANUAL_TEMPLATE_L10N}/manual.sed
|
|
|
878a2b |
|
|
|
878a2b |
# Redefine manual base file to use just the file base name.
|
|
|
878a2b |
local MANUAL_BASEFILE=$(basename "$MANUAL_BASEFILE")
|
|
|
878a2b |
|
|
|
878a2b |
# Add manual base directory path into directory stack to make it
|
|
|
878a2b |
# the current working directory. This is done to reduce the path
|
|
|
878a2b |
# information packaged inside `repository.xhtml.tar.bz2' file.
|
|
|
878a2b |
pushd ${MANUAL_BASEDIR_L10N} > /dev/null
|
|
|
878a2b |
|
|
|
878a2b |
# Clean up directory structure where xhtml files will be stored.
|
|
|
878a2b |
# We don't want to have unused files inside it.
|
|
|
878a2b |
if [[ -d ${MANUAL_NAME}-xhtml ]];then
|
|
|
878a2b |
rm -r ${MANUAL_NAME}-xhtml
|
|
|
878a2b |
fi
|
|
|
878a2b |
|
|
|
878a2b |
# Prepare directory structure where xhtml files will be stored in.
|
|
|
878a2b |
mkdir ${MANUAL_NAME}-xhtml
|
|
|
878a2b |
|
|
|
878a2b |
# Add directory where xhtml files will be sotred in into directory
|
|
|
878a2b |
# stack to make it the current working directory. This is required
|
|
|
878a2b |
# in order for include paths to be constructed correctly.
|
|
|
878a2b |
pushd ${MANUAL_NAME}-xhtml > /dev/null
|
|
|
878a2b |
|
|
|
878a2b |
# Update xhtml files. Use texi2html to export from texinfo file
|
|
|
878a2b |
# format to xhtml using The CentOS Web default visual style.
|
|
|
878a2b |
texi2html --lang=$(cli_getCurrentLocale --langcode-only) \
|
|
|
878a2b |
--init-file=${MANUAL_TEMPLATE}/manual-init.pl \
|
|
|
878a2b |
--init-file=${MANUAL_TEMPLATE_L10N}/manual-init.pl \
|
|
|
878a2b |
--output=${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}-xhtml \
|
|
|
878a2b |
${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}.${MANUAL_EXTENSION}
|
|
|
878a2b |
|
|
|
878a2b |
# Remove directory where xhtml files are stored from directory
|
|
|
878a2b |
# stack. The xhtml files have been already created.
|
|
|
878a2b |
popd > /dev/null
|
|
|
878a2b |
|
|
|
878a2b |
# Apply xhtml transformations. This transformation cannot be built
|
|
|
878a2b |
# inside the initialization script (repository-init.pl). For example,
|
|
|
878a2b |
# Would it be a possible way to produce different quotation HTML
|
|
|
878a2b |
# outputs from the same texinfo quotation definition? Instead,
|
|
|
878a2b |
# once the HTML code is produced we can take que quotation HTML
|
|
|
878a2b |
# definition plus the first letters inside it and transform the
|
|
|
878a2b |
# structure to a completly different thing that can be handle
|
|
|
878a2b |
# through classed inside CSS definitions.
|
|
|
878a2b |
sed -r -i \
|
|
|
878a2b |
-f ${MANUAL_TEMPLATE}/manual.sed \
|
|
|
878a2b |
-f ${MANUAL_TEMPLATE_L10N}/manual.sed \
|
|
|
878a2b |
${MANUAL_BASEFILE}-xhtml/*.xhtml
|
|
|
878a2b |
|
|
|
878a2b |
# Compress directory structure where xhtml files are stored in.
|
|
|
878a2b |
# This compressed version is the one we put under version control.
|
|
|
878a2b |
# The directory used to build the compressed version is left
|
|
|
878a2b |
# unversion for the matter of human revision.
|
|
|
878a2b |
tar -cjf ${MANUAL_BASEFILE}.xhtml.tar.bz2 ${MANUAL_BASEFILE}-xhtml
|
|
|
878a2b |
|
|
|
878a2b |
# Remove manual base directory from directory stack.
|
|
|
878a2b |
popd > /dev/null
|
|
|
878a2b |
|
|
|
878a2b |
}
|