diff --git a/Automation/Modules/Tuneup/Modules/Xhtml/Configs/cleanup-after.sed b/Automation/Modules/Tuneup/Modules/Xhtml/Configs/cleanup-after.sed deleted file mode 100644 index a7f82b7..0000000 --- a/Automation/Modules/Tuneup/Modules/Xhtml/Configs/cleanup-after.sed +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sed -###################################################################### -# -# cleanup-after.sed -- This file is read by xhtml_setCleanUp -# function to convert special tags into HTML comments after cleanup -# process. -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2013 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. -# -###################################################################### - -# Convert Mailman-specific tags back into their original form (see: -# cleanup-before.sed). -s//<\1>/g -s/%3C!--%20((mm|MM)-[[:alnum:]_-]+)%20--%3E/<\1>/g -s/<!-- ((mm|MM)[[:alnum:]_-]+) -->/<\1>/g - -s//\1/g -s/%3C!--%20(%\([[:alnum:]_-]+\)[[:alpha:]])%20--%3E/\1/g -s/<!-- (%\([[:alnum:]_-]+\)[[:alpha:]]) -->/\1/g diff --git a/Automation/Modules/Tuneup/Modules/Xhtml/Configs/cleanup-before.sed b/Automation/Modules/Tuneup/Modules/Xhtml/Configs/cleanup-before.sed deleted file mode 100644 index 80eb2b5..0000000 --- a/Automation/Modules/Tuneup/Modules/Xhtml/Configs/cleanup-before.sed +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sed -###################################################################### -# -# cleanup-before.sed -- This file is read by xhtml_setCleanUp -# function to convert special tags into HTML comments before cleanup -# process. Once the file has been cleaned up, the special tags are -# converted back to their original form (see: cleanup-after.sed). -# -# Written by: -# * Alain Reguera Delgado , 2009-2013 -# -# Copyright (C) 2013 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. -# -###################################################################### - -# Remove HTML preable, if any. It will be added later by xmllint, -# based on its own interpretation of the document. -/{1}/d - -# Convert Mailman-specific tags into comments. These tags are found in -# Mailman's templates and should not be touched in any way because -# they are used to display dynamic content at Mailman's run time. -s/<((mm|MM)-[[:alnum:]_-]+)>//g -s/(%\([[:alnum:]_-]+\)[[:alpha:]])//g diff --git a/Automation/Modules/Tuneup/Modules/Xhtml/xhtml_setCleanUp.sh b/Automation/Modules/Tuneup/Modules/Xhtml/xhtml_setCleanUp.sh index 4ff454a..d3b48b1 100755 --- a/Automation/Modules/Tuneup/Modules/Xhtml/xhtml_setCleanUp.sh +++ b/Automation/Modules/Tuneup/Modules/Xhtml/xhtml_setCleanUp.sh @@ -27,12 +27,15 @@ function xhtml_setCleanUp { - sed -i -r -f "${MODULE_DIR_CONFIGS}/cleanup-before.sed" "${FILE}" - - /usr/bin/xmllint --html --xmlout --format --noblanks \ - --nonet --nowarning \ - --output ${FILE} ${FILE} 2&> /dev/null - - sed -i -r -f "${MODULE_DIR_CONFIGS}/cleanup-after.sed" "${FILE}" + grep '\-//W3C//DTD XHTML 1.0 Strict//EN' ${FILE} > /dev/null + if [[ $? -eq 0 ]];then + /usr/bin/xmllint --xmlout --format --noblanks \ + --nonet --nowarning \ + --output ${FILE} ${FILE} 2&> /dev/null + else + /usr/bin/xmllint --html --xmlout --format --noblanks \ + --nonet --nowarning \ + --output ${FILE} ${FILE} 2&> /dev/null + fi }