Blame Scripts/Bash/Functions/Render/Docbook/docbook_convertToXhtmlChunk.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# docbook_convertToXhtmlChunk.sh -- This function uses DocBook XML as
878a2b
# input and applies XSL stylesheets to produce a directory with many
878a2b
# XHTML files as output.  The procedure was taken from the
878a2b
# documentation of `docbook-style-xsl-1.69.1-5.1' package, which says:
878a2b
# ---To publish HTML from your XML documents, you just need an XSLT
878a2b
# engine.---.
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 docbook_convertToXhtmlChunk {
878a2b
878a2b
    local -a STYLE_TEMPLATE
878a2b
    local -a STYLE_INSTANCE
878a2b
    local STYLE_INSTANCE_FINAL=''
878a2b
878a2b
    # Define absolute path to PDF target file. This is the final
878a2b
    # location the PDF file produced as result of DocBook to PDF
878a2b
    # transformation will be stored in.
878a2b
    local DST="${FILE}-xhtml/"
878a2b
878a2b
    # Clean up output directory. This is required in order to prevent
878a2b
    # old files from remaining therein when they are no longer needed.
878a2b
    if [[ -d ${DST} ]];then
878a2b
        rm -r "${DST}"
878a2b
    fi 
878a2b
    mkdir ${DST}
878a2b
878a2b
    # Print action message.
878a2b
    cli_printMessage "${FILE}-xhtml" --as-creating-line
878a2b
878a2b
    # Define absolute path to DocBook source file. This is the
878a2b
    # repository documentation manual file where DOCTYPE and ENTITY
878a2b
    # definition lines are set.
878a2b
    local SRC=${INSTANCE}
878a2b
878a2b
    # Prepare XSL final instances used in transformations.
878a2b
    docbook_prepareStyles $(cli_getFilesList \
bec152
        ${DOCBOOK_XSL} --pattern='.*docbook2xhtml-(chunks|common)\.xsl')
878a2b
878a2b
    # Transform DocBook XML to XHTML supressing all stderr output.
878a2b
    xsltproc --output ${DST} ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null
878a2b
ab7043
    # Create `css' and `images' directories. In order to save disk
ab7043
    # space, these directories are linked (symbolically) to their
843009
    # respective locations inside the working copy. Be sure to remove
843009
    # previous links first to prevent a recursive creation of links.
843009
    ln -sf ${TCAR_WORKDIR}/trunk/Identity/Webenv/Themes/Default/Docbook/1.69.1/Css ${DST}/Css
843009
    ln -sf ${TCAR_WORKDIR}/trunk/Identity/Images/Webenv ${DST}/Images
ab7043
878a2b
    # Remove XSL instance files.
878a2b
    rm ${STYLE_INSTANCE[*]}
878a2b
878a2b
}