From 836a6ad38278d9f44ebfcf8d19220a5d3718f5a1 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Sep 11 2012 00:04:40 +0000 Subject: Remove unused functions from Render->Docbook functionality. --- diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdf.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdf.sh deleted file mode 100755 index 790b8e8..0000000 --- a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdf.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# -# docbook_convertToPdf.sh -- This function takes DocBook XML as input -# and produces two different PDF as outputs; one from DocBook XML and -# another from DocBook SGML. We decided to provide support for both -# ways of output production from DocBook XML and DocBook SGML for you -# to evaluate and if possible correct. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function docbook_convertToPdf { - - # Tranform DocBook XML to PDF. - docbook_convertToPdfFromXml - - # Tranform DocBook SGML to PDF. - if [[ $(cli_getCurrentLocale) =~ '^en' ]];then - # FIXME: This is only possible when no localization is - # performed (i.e., xml2po is not involved.) to main DocBook - # file, otherwise there will be errors and the PDF output - # won't be created. The errors come out because when we passed - # the validated DocBook file to xml2po all XML decimal - # entities inside the main DocBook file are expanded and set - # in the msgid field. Such expanded characters are not - # recognized by openjade when they are used as source to - # produce the PDF output. - docbook_convertToPdfFromSgml - fi - -} diff --git a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromSgml.sh b/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromSgml.sh deleted file mode 100755 index b6bfd50..0000000 --- a/Scripts/Bash/Functions/Render/Docbook/docbook_convertToPdfFromSgml.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# -# docbook_convertToPdfFromSgml.sh -- This function transforms DocBook -# files which have set the SGML DTD in them. To produce PDF from -# DocBook SGML DTD, we take the DocBook XML DTD file and change its -# DTD from XML to SGML. Since XML is SGML shoudn't be any problem. -# Once the DTD has been changed from XML to SGML, we use openjade -# (through `jw' shell script) to convert the SGML-based DocBook file -# to PDF. Customization can be achieved through DSL -# (docbook-style-dsssl-1.79-4.1) shipped in this distribution. -# -# In this configuration and using default configuration settings, I've -# presented the following problems: -# -# 1. It is not possible to produce localized PDF outputs through -# `xml2po', the default way of producing localized content inside -# `centos-art.sh' script. -# -# In this configuration and using default configuration settins, I've -# presented the following advantages: -# -# 1. The PDF output produced from SGML-based files seem to be better -# looking an less buggy than PDF output produced from XML-based -# files, visually I mean. -# -# To make the whole process transparent, a temporal directory is -# created for intermediate works and final files are moved then to -# their final location. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function docbook_convertToPdfFromSgml { - - # Print action message. - if [[ -f ${FILE}.sgml.pdf ]];then - cli_printMessage "${FILE}.sgml.pdf" --as-updating-line - else - cli_printMessage "${FILE}.sgml.pdf" --as-creating-line - fi - - local -a STYLE_TEMPLATE - local -a STYLE_INSTANCE - local STYLE_INSTANCE_FINAL='' - - # Define name of temporal directory where the DocBook to PDF - # transformation will take place. - local TMPDIR=$(cli_getTemporalFile "docbook2pdf") - - # Define absolute path to DocBook source file. This is the - # repository documentation manual file where DOCTYPE and ENTITY - # definition lines are set. - local SRC=${INSTANCE} - - # Define absolute path to PDF target file. This is the final - # location the PDF file produced as result of DocBook to PDF - # transformation will be stored in. - local DST="${FILE}.sgml.pdf" - - # Define file name of PDF file. This is the file we were looking - # for and the one moved, once produced. - local PDF=$(basename ${SRC} | sed -r 's!\.docbook$!.pdf!') - - # Replace document definition from XML to SGML. - sed -i -r \ - -e 's!"-//OASIS//DTD DocBook XML!"-//OASIS//DTD DocBook!' \ - -e 's!"http://www\.oasis-open\.org/docbook/xml/([[:digit:]])\.([[:digit:]])/docbookx\.dtd"!"docbook/sgml-dtd-\1.\2-1.0-30.1/docbook.dtd"!' \ - $SRC - - # Prepare style final instance used in transformations. - docbook_prepareStyles "${DOCBOOK_STYLES_DIR}/docbook2pdf.dsl" - - # Verify temporal directory and create it if doesn't exist. - if [[ ! -d $TMPDIR ]];then - mkdir $TMPDIR - fi - - # Move inside temporal directory. - pushd $TMPDIR > /dev/null - - # Create PDF format. - docbook2pdf --dsl ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null - - # Verify `docbook2pdf' exit status and, if everything is ok, move - # PDF file from temporal directory to its target location. - if [[ $? -eq 0 ]];then - mv $PDF $DST - else - cli_printMessage "`gettext "Cannot produce the PDF file."`" --as-error-line - fi - - # Return to where we initially were. - popd > /dev/null - - # Remove temporal directory and temporal style instances created. - rm -r $TMPDIR - rm ${STYLE_INSTANCE[*]} - -}