From 4f4ac9c923da7ed34830fd33792ca70ff866dcd9 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: May 10 2011 18:37:36 +0000 Subject: Update `render' functionality: - Move out files from Xhtml directory and delete the Xhtml directory. --- diff --git a/Scripts/Functions/Render/Xhtml/xhtml.sh b/Scripts/Functions/Render/Xhtml/xhtml.sh deleted file mode 100755 index f65d6cb..0000000 --- a/Scripts/Functions/Render/Xhtml/xhtml.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# xhtml.sh -- This function performs base-rendition action -# for Xhtml 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 xhtml { - - # Print action message. - if [[ -f ${FILE}.xhtml ]];then - cli_printMessage "${FILE}.xhtml" --as-updating-line - else - cli_doPrint "${FILE}.xhtml" --as-creating-line - fi - - # Create xhtml file from instance. - cp $INSTANCE ${FILE}.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/Xhtml/xhtml_convertToText.sh b/Scripts/Functions/Render/Xhtml/xhtml_convertToText.sh deleted file mode 100755 index b0e1c22..0000000 --- a/Scripts/Functions/Render/Xhtml/xhtml_convertToText.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# svg_convertHtmlToText.sh -- This function takes one HTML file -# and produces one plain-text file (i.e., without markup inside). -# -# 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 xhtml_convertToText { - - # Verify existence of HTML file. - cli_checkFiles ${FILE}.xhtml - - local COMMAND='' - local OPTIONS='' - - # Define the command path to text-based web browser and options - # used to produce plain-text files. Most of these programs have a - # dump option that print formatted plain-text versions of given - # HTML file to stdout. - if [[ -x '/usr/bin/lynx' ]];then - COMMAND='/usr/bin/lynx' - OPTIONS='-force_html -nolist -width 70 -dump' - elif [[ -x '/usr/bin/elinks' ]];then - COMMAND='/usr/bin/elinks' - OPTIONS='-force_html -no-numbering -no-references -width 70 -dump' - elif [[ -x '/usr/bin/w3m' ]];then - COMMAND='/usr/bin/w3m' - OPTIONS='-dump' - fi - - if [[ $COMMAND != '' ]];then - - # Print action message. - if [[ -f ${FILE}.txt ]];then - cli_printMessage "${FILE}.txt" --as-updating-line - else - cli_printMessage "${FILE}.txt" --as-creating-line - fi - - # Convert from HTML to plain-text without markup. - ${COMMAND} ${OPTIONS} ${FILE}.xhtml > ${FILE}.txt - - else - cli_printMessage "`gettext "No way to convert from HTML to plain-text found."`" --as-error-line - fi - -} diff --git a/Scripts/Functions/Render/render_xhtml.sh b/Scripts/Functions/Render/render_xhtml.sh new file mode 100755 index 0000000..f65d6cb --- /dev/null +++ b/Scripts/Functions/Render/render_xhtml.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# xhtml.sh -- This function performs base-rendition action +# for Xhtml 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 xhtml { + + # Print action message. + if [[ -f ${FILE}.xhtml ]];then + cli_printMessage "${FILE}.xhtml" --as-updating-line + else + cli_doPrint "${FILE}.xhtml" --as-creating-line + fi + + # Create xhtml file from instance. + cp $INSTANCE ${FILE}.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_xhtml_convertToText.sh b/Scripts/Functions/Render/render_xhtml_convertToText.sh new file mode 100755 index 0000000..b0e1c22 --- /dev/null +++ b/Scripts/Functions/Render/render_xhtml_convertToText.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# +# svg_convertHtmlToText.sh -- This function takes one HTML file +# and produces one plain-text file (i.e., without markup inside). +# +# 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 xhtml_convertToText { + + # Verify existence of HTML file. + cli_checkFiles ${FILE}.xhtml + + local COMMAND='' + local OPTIONS='' + + # Define the command path to text-based web browser and options + # used to produce plain-text files. Most of these programs have a + # dump option that print formatted plain-text versions of given + # HTML file to stdout. + if [[ -x '/usr/bin/lynx' ]];then + COMMAND='/usr/bin/lynx' + OPTIONS='-force_html -nolist -width 70 -dump' + elif [[ -x '/usr/bin/elinks' ]];then + COMMAND='/usr/bin/elinks' + OPTIONS='-force_html -no-numbering -no-references -width 70 -dump' + elif [[ -x '/usr/bin/w3m' ]];then + COMMAND='/usr/bin/w3m' + OPTIONS='-dump' + fi + + if [[ $COMMAND != '' ]];then + + # Print action message. + if [[ -f ${FILE}.txt ]];then + cli_printMessage "${FILE}.txt" --as-updating-line + else + cli_printMessage "${FILE}.txt" --as-creating-line + fi + + # Convert from HTML to plain-text without markup. + ${COMMAND} ${OPTIONS} ${FILE}.xhtml > ${FILE}.txt + + else + cli_printMessage "`gettext "No way to convert from HTML to plain-text found."`" --as-error-line + fi + +}