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

d3e9d7
#!/bin/bash
d3e9d7
#
993f6a
# texinfo_updateOutputFileXhtml.sh -- This function exports
5285d6
# documentation manual to HTML format.
d3e9d7
#
3b0984
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
d3e9d7
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d3e9d7
# General Public License for more details.
d3e9d7
#
d3e9d7
# You should have received a copy of the GNU General Public License
d3e9d7
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
d3e9d7
# ----------------------------------------------------------------------
d3e9d7
# $Id$
d3e9d7
# ----------------------------------------------------------------------
d3e9d7
993f6a
function texinfo_updateOutputFileXhtml {
d3e9d7
420e77
    # Verify initialization files used by texi2html.
6150a1
    cli_checkFiles ${MANUAL_TEMPLATE}/manual-init.pl
6150a1
    cli_checkFiles ${MANUAL_TEMPLATE_L10N}/manual-init.pl
420e77
420e77
    # Verify transformation files used to modify texi2html output.
6150a1
    cli_checkFiles ${MANUAL_TEMPLATE}/manual.sed
6150a1
    cli_checkFiles ${MANUAL_TEMPLATE_L10N}/manual.sed
420e77
5285d6
    # Output action message.
18be6e
    cli_printMessage "${MANUAL_BASEFILE}.xhtml.tar.bz2" --as-updating-line
d3e9d7
25b773
    # Redefine manual base file to use just the file base name.
25b773
    local MANUAL_BASEFILE=$(basename "$MANUAL_BASEFILE")
d3e9d7
25b773
    # Add manual base directory path into directory stack to make it
25b773
    # the current working directory. This is done to reduce the path
25b773
    # information packaged inside `repository.xhtml.tar.bz2' file.
5e989a
    pushd ${MANUAL_BASEDIR_L10N} > /dev/null
d3e9d7
25b773
    # Clean up directory structure where xhtml files will be stored.
25b773
    # We don't want to have unused files inside it.
5c12d7
    if [[ -d ${MANUAL_NAME}-xhtml ]];then
5c12d7
        rm -r ${MANUAL_NAME}-xhtml
5c12d7
    fi
5c12d7
5c12d7
    # Prepare directory structure where xhtml files will be stored in.
5c12d7
    mkdir ${MANUAL_NAME}-xhtml
25b773
bf016b
    # Add directory where xhtml files will be sotred in into directory
bf016b
    # stack to make it the current working directory. This is required
bf016b
    # in order for include paths to be constructed correctly.
5c12d7
    pushd ${MANUAL_NAME}-xhtml > /dev/null
bf016b
25b773
    # Update xhtml files.  Use texi2html to export from texinfo file
6150a1
    # format to xhtml using The CentOS Web default visual style.
420e77
    texi2html --lang=$(cli_getCurrentLocale --langcode-only) \
6150a1
        --init-file=${MANUAL_TEMPLATE}/manual-init.pl \
6150a1
        --init-file=${MANUAL_TEMPLATE_L10N}/manual-init.pl \
5e989a
        --output=${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}-xhtml \
5e989a
        ${MANUAL_BASEDIR_L10N}/${MANUAL_NAME}.${MANUAL_EXTENSION}
bf016b
bf016b
    # Remove directory where xhtml files are stored from directory
bf016b
    # stack. The xhtml files have been already created.
bf016b
    popd > /dev/null
d3e9d7
25b773
    # Apply xhtml transformations. This transformation cannot be built
420e77
    # inside the initialization script (repository-init.pl). For example,
420e77
    # Would it be a possible way to produce different quotation HTML
420e77
    # outputs from the same texinfo quotation definition?  Instead,
25b773
    # once the HTML code is produced we can take que quotation HTML
25b773
    # definition plus the first letters inside it and transform the
25b773
    # structure to a completly different thing that can be handle
25b773
    # through classed inside CSS definitions.
420e77
    sed -r -i \
6150a1
        -f ${MANUAL_TEMPLATE}/manual.sed \
6150a1
        -f ${MANUAL_TEMPLATE_L10N}/manual.sed \
5c12d7
        ${MANUAL_BASEFILE}-xhtml/*.xhtml
25b773
25b773
    # Compress directory structure where xhtml files are stored in.
25b773
    # This compressed version is the one we put under version control.
25b773
    # The directory used to build the compressed version is left
25b773
    # unversion for the matter of human revision.
5c12d7
    tar -cjf ${MANUAL_BASEFILE}.xhtml.tar.bz2 ${MANUAL_BASEFILE}-xhtml
d3e9d7
25b773
    # Remove manual base directory from directory stack.
d3e9d7
    popd > /dev/null
d3e9d7
d3e9d7
}