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

4f2050
#!/bin/bash
4f2050
#
bcfc42
# docbook_convertToXhtmlChunk.sh -- This function uses DocBook XML as
bcfc42
# input and applies XSL stylesheets to produce a directory with many
bcfc42
# XHTML files as output.  The procedure was taken from the
4f2050
# documentation of `docbook-style-xsl-1.69.1-5.1' package, which says:
4f2050
# ---To publish HTML from your XML documents, you just need an XSLT
4f2050
# engine.---.
4f2050
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
4f2050
#
4f2050
# This program is free software; you can redistribute it and/or modify
4f2050
# it under the terms of the GNU General Public License as published by
4f2050
# the Free Software Foundation; either version 2 of the License, or (at
4f2050
# your option) any later version.
4f2050
#
4f2050
# This program is distributed in the hope that it will be useful, but
4f2050
# WITHOUT ANY WARRANTY; without even the implied warranty of
4f2050
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4f2050
# General Public License for more details.
4f2050
#
4f2050
# You should have received a copy of the GNU General Public License
4f2050
# along with this program; if not, write to the Free Software
4f2050
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4f2050
#
4f2050
# ----------------------------------------------------------------------
4f2050
# $Id$
4f2050
# ----------------------------------------------------------------------
4f2050
4f2050
function docbook_convertToXhtmlChunk {
4f2050
2fa604
    local -a STYLE_TEMPLATE
2fa604
    local -a STYLE_INSTANCE
2fa604
    local STYLE_INSTANCE_FINAL=''
be62ec
c22407
    # Define absolute path to PDF target file. This is the final
c22407
    # location the PDF file produced as result of DocBook to PDF
c22407
    # transformation will be stored in.
c22407
    local DST="${FILE}-xhtml/"
c22407
c22407
    # Clean up output directory. This is required in order to prevent
c22407
    # old files from remaining therein when they are no longer needed.
4f76ef
    if [[ -d ${DST} ]];then
4f76ef
        rm -r "${DST}"
4f76ef
    fi 
4f76ef
    mkdir ${DST}
c22407
4f2050
    # Print action message.
c22407
    cli_printMessage "${FILE}-xhtml" --as-creating-line
4f2050
4f2050
    # Define absolute path to DocBook source file. This is the
4f2050
    # repository documentation manual file where DOCTYPE and ENTITY
4f2050
    # definition lines are set.
4f2050
    local SRC=${INSTANCE}
4f2050
be62ec
    # Prepare XSL final instances used in transformations.
2fa604
    ${RENDER_BACKEND}_prepareStyles $(cli_getFilesList \
2fa604
        ${DOCBOOK_STYLES_DIR} --pattern='.*docbook2xhtml-(chunks|common)\.xsl')
4f2050
4f2050
    # Transform DocBook XML to XHTML supressing all stderr output.
2fa604
    xsltproc --output ${DST} ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null
be62ec
be62ec
    # Remove XSL instance files.
2fa604
    rm ${STYLE_INSTANCE[*]}
4f2050
4f2050
}