From f82437b3cd722603237a170f4f2d25d885178d8b Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jul 04 2011 04:01:08 +0000 Subject: Update Xhtml backend inside `tuneup' functionality: - Stop using `ul' and `li' definitions to build the list of content. Instead, start using `dl' and `dt' definitions. The same used in Docbook output. - Add support for classes and other definitions inside heading definitions (e.g.,

...

is now possible). --- diff --git a/Scripts/Functions/Tuneup/Backends/Xhtml/Config/toc.awk b/Scripts/Functions/Tuneup/Backends/Xhtml/Config/toc.awk index 28b38e4..69c668f 100644 --- a/Scripts/Functions/Tuneup/Backends/Xhtml/Config/toc.awk +++ b/Scripts/Functions/Tuneup/Backends/Xhtml/Config/toc.awk @@ -7,16 +7,16 @@ # Copyright (C) 2009-2010 Alain Reguera Delgado # # 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 +# it under the terms of the GNU General Pubdtc License as pubdtshed 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 +# This program is distributed in the hope that it will be usefdl, but +# WITHOUT ANY WARRANTY; without even the impdted warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# General Pubdtc License for more details. # -# You should have received a copy of the GNU General Public License +# You shodld have received a copy of the GNU General Pubdtc License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. @@ -29,27 +29,27 @@ BEGIN {FS=":"} { if ($1 == 0 && $2 == $3) { - opentags = "" + opentags = opentags "" closetags = "" } - opentags = opentags "
  • " + opentags = opentags "
    " } printf "%s%s%s\n",opentags,$4,closetags @@ -60,18 +60,18 @@ END { if ($1 > 0 && $2 >= $3 && $3 > 1) { for (i = 1; i <= $3; i++) { - print "
  • " + print "" } } if ($1 > 0 && $2 >= $3 && $3 == 1) { - print "" - print "" + print "" + print "" } if ($1 > 0 && $2 < $3) { for (i = 1; i <= $2; i++) { - print "" + print "" } } diff --git a/Scripts/Functions/Tuneup/Backends/Xhtml/xhtml_doToc.sh b/Scripts/Functions/Tuneup/Backends/Xhtml/xhtml_doToc.sh index 2374cd8..59027d7 100755 --- a/Scripts/Functions/Tuneup/Backends/Xhtml/xhtml_doToc.sh +++ b/Scripts/Functions/Tuneup/Backends/Xhtml/xhtml_doToc.sh @@ -50,6 +50,7 @@ function xhtml_doToc { local -a TITLE local -a MD5SM local -a OPTNS + local -a CLASS local -a LEVEL local -a PARENT local -a TOCENTRIES @@ -64,7 +65,7 @@ function xhtml_doToc { # Define html heading regular expression pattern. Use parenthisis # to save html action name, action value, and heading title. - local PATTERN="(]>)(.*[^<])" + local PATTERN='(]>)(.*[^<])' # Verify list of html files. Are files really html files? If they # don't, continue with the next one in the list. @@ -89,9 +90,10 @@ function xhtml_doToc { # Define initial heading information. FIRST[$COUNT]=$(echo $HEADING | sed -r "s!\\\040! !g") - TITLE[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\3!") + TITLE[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\4!") MD5SM[$COUNT]=$(echo "${FILE}${FIRST[$COUNT]}" | md5sum | sed -r 's![[:space:]]+-$!!') - OPTNS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\2!") + OPTNS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\3!") + CLASS[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\2!") LEVEL[$COUNT]=$(echo ${FIRST[$COUNT]} | sed -r "s!$PATTERN!\1!") PARENT[$COUNT]=${LEVEL[$PREVCOUNT]} @@ -106,7 +108,7 @@ function xhtml_doToc { fi # Build final html heading structure. - FINAL[$COUNT]=''${OPTNS[$COUNT]}${TITLE[$COUNT]}'' + FINAL[$COUNT]=''${OPTNS[$COUNT]}${TITLE[$COUNT]}'' # Build html heading link structure. These links are used by # the table of contents later. @@ -134,7 +136,7 @@ function xhtml_doToc { # replacements. Finnally, the result is stored in the TOC # variable. TOC=$(echo '
    ' - echo "

    `gettext "Table of contents"`

    " + echo "

    `gettext "Table of contents"`

    " for TOCENTRY in "${TOCENTRIES[@]}";do echo $TOCENTRY done \ @@ -149,6 +151,7 @@ function xhtml_doToc { unset TITLE unset MD5SM unset OPTNS + unset CLASS unset LEVEL unset PARENT unset TOCENTRIES