Blame Scripts/Functions/Help/help_updateOutputFileXhtml.sh

d3e9d7
#!/bin/bash
d3e9d7
#
dbbbe4
# help_updateOutputFileXhtml.sh -- This function exports
5285d6
# documentation manual to HTML format.
d3e9d7
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
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
fa95b1
# the Free Software Foundation; either version 2 of the License, or
fa95b1
# (at your option) any later version.
fa95b1
#
d3e9d7
# This program is distributed in the hope that it will be useful, but
d3e9d7
# 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
d3e9d7
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
d3e9d7
# USA.
d3e9d7
# ----------------------------------------------------------------------
d3e9d7
# $Id$
d3e9d7
# ----------------------------------------------------------------------
d3e9d7
dbbbe4
function help_updateOutputFileXhtml {
d3e9d7
5285d6
    # Output action message.
25b773
    cli_printMessage "${MANUAL_BASEFILE}.xhtml.tar.bz2" 'AsUpdatingLine'
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.
25b773
    pushd ${MANUAL_BASEDIR} > /dev/null
d3e9d7
25b773
    # Prepare directory structure where xhtml files will be stored in.
25b773
    [[ ! -d ${MANUAL_BASEFILE}.xhtml ]] && mkdir -p ${MANUAL_BASEFILE}.xhtml
25b773
25b773
    # Clean up directory structure where xhtml files will be stored.
25b773
    # We don't want to have unused files inside it.
25b773
    [[ $(ls ${MANUAL_BASEFILE}.xhtml > /dev/null) ]] && rm ${MANUAL_BASEFILE}.xhtml/*.xhtml
25b773
25b773
    # Update xhtml files.  Use texi2html to export from texinfo file
d3e9d7
    # format to html using CentOS Web default visual style.
25b773
    texi2html --init-file=${MANUAL_BASEFILE}.init \
25b773
        --output=${MANUAL_BASEFILE}.xhtml \
bf22b2
        ${MANUAL_BASEFILE}.texi
d3e9d7
25b773
    # Apply xhtml transformations. This transformation cannot be built
25b773
    # inside the initialization script (repository.init). For example,
25b773
    # I can't see a possible way to produce different quotation HTML
25b773
    # 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.
25b773
    sed -r -i -f ${MANUAL_BASEFILE}.sed ${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.
25b773
    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
}