Blame Automation/Modules/centos-art.sh-help/Texinfo/texinfo_updateOutputFileXhtml.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# texinfo_updateOutputFileXhtml.sh -- This function exports
Alain Reguera Delgado 8f60cb
# documentation manual to HTML format.
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_updateOutputFileXhtml {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify texi2html package existence. If this package isn't
Alain Reguera Delgado 8f60cb
    # installed in the system, stop script execution with an error
Alain Reguera Delgado 8f60cb
    # message.
Alain Reguera Delgado 8f60cb
    cli_checkFiles texi2html --is-installed
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Output action message.
Alain Reguera Delgado 8f60cb
    cli_printMessage "${MANUAL_OUTPUT_BASEFILE}.xhtml.tar.bz2" --as-creating-line
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify initialization files used by texi2html.
Alain Reguera Delgado 8f60cb
    cli_checkFiles -e ${MANUAL_TEMPLATE}/manual-init.pl
Alain Reguera Delgado 8f60cb
    cli_checkFiles -e ${MANUAL_TEMPLATE_L10N}/manual-init.pl
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify transformation files used to modify texi2html output.
Alain Reguera Delgado 8f60cb
    cli_checkFiles -e ${MANUAL_TEMPLATE}/manual.sed
Alain Reguera Delgado 8f60cb
    cli_checkFiles -e ${MANUAL_TEMPLATE_L10N}/manual.sed
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Clean up directory structure where xhtml files will be stored.
Alain Reguera Delgado 8f60cb
    # We don't want to have unused files inside it.
Alain Reguera Delgado 8f60cb
    if [[ -d ${MANUAL_OUTPUT_BASEFILE}-xhtml ]];then
Alain Reguera Delgado 8f60cb
        rm -r ${MANUAL_OUTPUT_BASEFILE}-xhtml
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Prepare directory structure where xhtml files will be stored in.
Alain Reguera Delgado 8f60cb
    mkdir -p ${MANUAL_OUTPUT_BASEFILE}-xhtml
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Add manual base directory path into directory stack to make it
Alain Reguera Delgado 8f60cb
    # the current working directory. This is done to reduce the path
Alain Reguera Delgado 8f60cb
    # information packaged inside `repository.xhtml.tar.bz2' file.
Alain Reguera Delgado 8f60cb
    pushd ${MANUAL_OUTPUT_BASEFILE}-xhtml > /dev/null
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Update xhtml files. Use texi2html to export from texinfo file
Alain Reguera Delgado 8f60cb
    # format to xhtml using The CentOS Web default visual style.
Alain Reguera Delgado 8f60cb
    texi2html --lang=${CLI_LANG_LL} \
Alain Reguera Delgado 8f60cb
        --init-file=${MANUAL_TEMPLATE}/manual-init.pl \
Alain Reguera Delgado 8f60cb
        --init-file=${MANUAL_TEMPLATE_L10N}/manual-init.pl \
Alain Reguera Delgado 8f60cb
        -I ${TCAR_WORKDIR} \
Alain Reguera Delgado 8f60cb
        --output=${MANUAL_OUTPUT_BASEFILE}-xhtml \
Alain Reguera Delgado 8f60cb
        ${MANUAL_BASEFILE}.${MANUAL_EXTENSION}
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Create `css' and `images' directories. In order to save disk
Alain Reguera Delgado 8f60cb
    # space, these directories are linked (symbolically) to their
Alain Reguera Delgado 8f60cb
    # respective locations inside the working copy. 
Alain Reguera Delgado 8f60cb
    ln -s ${TCAR_WORKDIR}/Identity/Webenv/Themes/Default/Docbook/1.69.1/Css Css
Alain Reguera Delgado 8f60cb
    ln -s ${TCAR_WORKDIR}/Identity/Images/Webenv Images
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Remove directory where xhtml files are stored from directory
Alain Reguera Delgado 8f60cb
    # stack. The xhtml files have been already created.
Alain Reguera Delgado 8f60cb
    popd > /dev/null
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Apply xhtml transformations. This transformation cannot be built
Alain Reguera Delgado 8f60cb
    # inside the initialization script (repository-init.pl). For example,
Alain Reguera Delgado 8f60cb
    # Would it be a possible way to produce different quotation HTML
Alain Reguera Delgado 8f60cb
    # outputs from the same texinfo quotation definition?  Instead,
Alain Reguera Delgado 8f60cb
    # once the HTML code is produced we can take the quotation HTML
Alain Reguera Delgado 8f60cb
    # definition plus the first letters inside it and transform the
Alain Reguera Delgado 8f60cb
    # structure to a completely different thing that can be handle
Alain Reguera Delgado 8f60cb
    # through classed inside CSS definitions.
Alain Reguera Delgado 8f60cb
    sed -r -i \
Alain Reguera Delgado 8f60cb
        -f ${MANUAL_TEMPLATE}/manual.sed \
Alain Reguera Delgado 8f60cb
        -f ${MANUAL_TEMPLATE_L10N}/manual.sed \
Alain Reguera Delgado 8f60cb
        ${MANUAL_OUTPUT_BASEFILE}-xhtml/*.xhtml
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Compress directory structure where xhtml files are stored in.
Alain Reguera Delgado 8f60cb
    # This compressed version is the one we put under version control.
Alain Reguera Delgado 8f60cb
    # The directory used to build the compressed version is left
Alain Reguera Delgado 8f60cb
    # unversion for the matter of human revision.
Alain Reguera Delgado 8f60cb
    tar -cjf ${MANUAL_OUTPUT_BASEFILE}.xhtml.tar.bz2 ${MANUAL_OUTPUT_BASEFILE}-xhtml > /dev/null 2>&1 
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}