diff --git a/Scripts/Functions/Render/Docbook/docbook.sh b/Scripts/Functions/Render/Docbook/docbook.sh deleted file mode 100755 index 3fd9b2f..0000000 --- a/Scripts/Functions/Render/Docbook/docbook.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# docbook.sh -- This function performs base-rendition -# action for DocBook files. -# -# Copyright (C) 2009, 2010, 2011 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 { - - # Produce xhtml output from docbook template instance using XSL - # stylesheets as reference. - docbook_convertToXhtml - - # Produce plaintext output from html outout. - xhtml_convertToText - - # Perform post-rendition action for Docbook files. - #docbookPostActions - - # Perform base-rendition action for Docbook files. - #docbookLastActions - - -} diff --git a/Scripts/Functions/Render/Docbook/docbook_convertToXhtml.sh b/Scripts/Functions/Render/Docbook/docbook_convertToXhtml.sh deleted file mode 100755 index a41066d..0000000 --- a/Scripts/Functions/Render/Docbook/docbook_convertToXhtml.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# docbook_convertToXhtml.sh -- This function produces XHTML -# output from docbook template instance using XSL stylesheets as -# reference. -# -# Copyright (C) 2009, 2010, 2011 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_convertToXhtml { - - # Print action message. - if [[ -f ${FILE}.xhtml ]];then - cli_printMessage "${FILE}.xhtml" --as-updating-line - else - cli_printMessage "${FILE}.xhtml" --as-creating-line - fi - - # Define list of XSL stylesheets. - local XSL='/usr/share/sgml/docbook/xsl-stylesheets/xhtml/docbook.xsl' - - # Produce xhtml output from docbook template instance using XSL - # stylesheets as reference. - xsltproc ${XSL} $INSTANCE > ${FILE}.xhtml - -} diff --git a/Scripts/Functions/Render/Svg/svg.sh b/Scripts/Functions/Render/Svg/svg.sh index 8c431d8..f978fc5 100644 --- a/Scripts/Functions/Render/Svg/svg.sh +++ b/Scripts/Functions/Render/Svg/svg.sh @@ -25,15 +25,12 @@ function svg { - # Define export id used inside design templates. This value - # defines the design area we want to export. + # Initialize the export id used inside design templates. This + # value defines the design area we want to export. local EXPORTID='CENTOSARTWORK' - # Check export id inside design templates. - grep "id=\"$EXPORTID\"" $INSTANCE > /dev/null - if [[ $? -gt 0 ]];then - cli_printMessage "`eval_gettext "There is not export id (\\\$EXPORTID) inside \\\"\\\$TEMPLATE\\\"."`" --as-error-line - fi + # Verify the export id. + svg_checkExportId # Check existence of external files. Inside design templates and # their instances, external files are used to refere the @@ -55,5 +52,11 @@ function svg { | sed -r "s!^Background (RRGGBBAA):(.*)!`gettext "Background"`: \1 \2!")" cli_printMessage "$(echo "$INKSCAPE_OUTPUT" | egrep '^Bitmap saved as' \ | sed -r "s!^Bitmap saved as:!`gettext "Saved as"`: !")" + + # Perform post-rendition action for svg files. + svg_doPostActions + + # Perform last-rendition action for svg files. + svg_doLastActions } diff --git a/Scripts/Functions/Render/Xhtml/xhtml.sh b/Scripts/Functions/Render/Xhtml/xhtml.sh index 61d7bae..f65d6cb 100755 --- a/Scripts/Functions/Render/Xhtml/xhtml.sh +++ b/Scripts/Functions/Render/Xhtml/xhtml.sh @@ -38,4 +38,10 @@ function xhtml { # Produce plaintext output from html outout. xhtml_convertToText + # Perform post-rendition action for Docbook files. + #xhtmlPostActions + + # Perform base-rendition action for Xhtml files. + #xhtmlLastActions + } diff --git a/Scripts/Functions/Render/render_doBaseActions.sh b/Scripts/Functions/Render/render_doBaseActions.sh index e5f7f0a..8227cd9 100755 --- a/Scripts/Functions/Render/render_doBaseActions.sh +++ b/Scripts/Functions/Render/render_doBaseActions.sh @@ -182,40 +182,22 @@ function render_doBaseActions { # Apply translation markers replacements to template instance. cli_replaceTMarkers ${INSTANCE} - # Verify the extension of template instance and render content - # accordingly. + # Define what action to perform based on the extension of + # template instance. if [[ $INSTANCE =~ '\.(svgz|svg)$' ]];then - # Perform base-rendition action for svg files. - svg - - # Perform post-rendition action for svg files. - svg_doPostActions - - # Perform last-rendition action for svg files. - svg_doLastActions - + # Set function name to perform SVG base-rendition. + render_svg + elif [[ $INSTANCE =~ '\.docbook$' ]];then - # Perform base-rendition action for Docbook files. - docbook - - # Perform post-rendition action for Docbook files. - #docbookPostActions - - # Perform base-rendition action for Docbook files. - #docbookLastActions + # Set function name to perform Docbook base-rendition. + render_docbook elif [[ $INSTANCE =~ '\.xhtml$' ]];then - # Perform base-rendition action for XHTML files. - xhtml - - # Perform post-rendition action for Docbook files. - #xhtmlPostActions - - # Perform base-rendition action for Xhtml files. - #xhtmlLastActions + # Set function name to perform XHTML base-rendition. + render_xhtml else cli_printMessage "`gettext "The template file you try to render is not supported yet."`" --as-error-line diff --git a/Scripts/Functions/Render/render_docbook.sh b/Scripts/Functions/Render/render_docbook.sh new file mode 100755 index 0000000..3fd9b2f --- /dev/null +++ b/Scripts/Functions/Render/render_docbook.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# docbook.sh -- This function performs base-rendition +# action for DocBook files. +# +# Copyright (C) 2009, 2010, 2011 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 { + + # Produce xhtml output from docbook template instance using XSL + # stylesheets as reference. + docbook_convertToXhtml + + # Produce plaintext output from html outout. + xhtml_convertToText + + # Perform post-rendition action for Docbook files. + #docbookPostActions + + # Perform base-rendition action for Docbook files. + #docbookLastActions + + +} diff --git a/Scripts/Functions/Render/render_docbook_convertToXhtml.sh b/Scripts/Functions/Render/render_docbook_convertToXhtml.sh new file mode 100755 index 0000000..a41066d --- /dev/null +++ b/Scripts/Functions/Render/render_docbook_convertToXhtml.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# docbook_convertToXhtml.sh -- This function produces XHTML +# output from docbook template instance using XSL stylesheets as +# reference. +# +# Copyright (C) 2009, 2010, 2011 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_convertToXhtml { + + # Print action message. + if [[ -f ${FILE}.xhtml ]];then + cli_printMessage "${FILE}.xhtml" --as-updating-line + else + cli_printMessage "${FILE}.xhtml" --as-creating-line + fi + + # Define list of XSL stylesheets. + local XSL='/usr/share/sgml/docbook/xsl-stylesheets/xhtml/docbook.xsl' + + # Produce xhtml output from docbook template instance using XSL + # stylesheets as reference. + xsltproc ${XSL} $INSTANCE > ${FILE}.xhtml + +}