Blame Scripts/Bash/Functions/Help/Texinfo/texinfo_updateOutputFileXhtml.sh

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.
34b933
    cli_printMessage "${MANUAL_OUTPUT_BASEFILE}.xhtml.tar.bz2" --as-creating-line
878a2b
878a2b
    # Verify initialization files used by texi2html.
64a8e6
    cli_checkFiles -e ${MANUAL_TEMPLATE}/manual-init.pl
64a8e6
    cli_checkFiles -e ${MANUAL_TEMPLATE_L10N}/manual-init.pl
878a2b
878a2b
    # Verify transformation files used to modify texi2html output.
64a8e6
    cli_checkFiles -e ${MANUAL_TEMPLATE}/manual.sed
64a8e6
    cli_checkFiles -e ${MANUAL_TEMPLATE_L10N}/manual.sed
878a2b
878a2b
    # Clean up directory structure where xhtml files will be stored.
878a2b
    # We don't want to have unused files inside it.
777668
    if [[ -d ${MANUAL_OUTPUT_BASEFILE}-xhtml ]];then
777668
        rm -r ${MANUAL_OUTPUT_BASEFILE}-xhtml
878a2b
    fi
878a2b
878a2b
    # Prepare directory structure where xhtml files will be stored in.
777668
    mkdir -p ${MANUAL_OUTPUT_BASEFILE}-xhtml
878a2b
777668
    # Add manual base directory path into directory stack to make it
777668
    # the current working directory. This is done to reduce the path
777668
    # information packaged inside `repository.xhtml.tar.bz2' file.
777668
    pushd ${MANUAL_OUTPUT_BASEFILE}-xhtml > /dev/null
878a2b
777668
    # Update xhtml files. Use texi2html to export from texinfo file
878a2b
    # format to xhtml using The CentOS Web default visual style.
64a8e6
    texi2html --lang=${CLI_LANG_LL} \
878a2b
        --init-file=${MANUAL_TEMPLATE}/manual-init.pl \
878a2b
        --init-file=${MANUAL_TEMPLATE_L10N}/manual-init.pl \
777668
        -I ${TCAR_WORKDIR} \
777668
        --output=${MANUAL_OUTPUT_BASEFILE}-xhtml \
be94fe
        ${MANUAL_BASEFILE}.${MANUAL_EXTENSION}
878a2b
777668
    # Create `css' and `images' directories. In order to save disk
777668
    # space, these directories are linked (symbolically) to their
777668
    # respective locations inside the working copy. 
777668
    ln -s ${TCAR_WORKDIR}/trunk/Identity/Webenv/Themes/Default/Docbook/1.69.1/Css Css
777668
    ln -s ${TCAR_WORKDIR}/trunk/Identity/Images/Webenv Images
777668
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 \
777668
        ${MANUAL_OUTPUT_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.
777668
    tar -cjf ${MANUAL_OUTPUT_BASEFILE}.xhtml.tar.bz2 ${MANUAL_OUTPUT_BASEFILE}-xhtml > /dev/null 2>&1 
878a2b
878a2b
}