From 7b6c8b08e9d29332dcd0a1029e7421334bfb6f61 Mon Sep 17 00:00:00 2001 From: Daniel Glassey Date: Mon, 7 Sep 2015 11:14:57 +0100 Subject: Imported Upstream version 1.7.3+dfsg --- src/modules/filters/thmlheadings.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/modules/filters/thmlheadings.cpp') diff --git a/src/modules/filters/thmlheadings.cpp b/src/modules/filters/thmlheadings.cpp index 46498d0..99bd12a 100644 --- a/src/modules/filters/thmlheadings.cpp +++ b/src/modules/filters/thmlheadings.cpp @@ -3,7 +3,7 @@ * thmlheadings.cpp - SWFilter descendant to hide or show headings * in a ThML module * - * $Id: thmlheadings.cpp 2980 2013-09-14 21:51:47Z scribe $ + * $Id: thmlheadings.cpp 3195 2014-04-24 03:03:26Z greg.hellings $ * * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -86,13 +86,22 @@ char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo tag = token; if (hide && tag.isEndTag()) { if (module->isProcessEntryAttributes() && (option || (!preverse))) { + SWBuf heading; + SWBuf cls = startTag.getAttribute("class"); + if (!cls.startsWith("fromEntryAttributes")) { + cls = SWBuf("fromEntryAttributes ") + cls; + startTag.setAttribute("class", cls); + } + heading += startTag; + heading += header; + heading += tag; if (preverse) { sprintf(buf, "%i", pvHeaderNum++); - module->getEntryAttributes()["Heading"]["Preverse"][buf] = header; + module->getEntryAttributes()["Heading"]["Preverse"][buf] = heading; } else { sprintf(buf, "%i", headerNum++); - module->getEntryAttributes()["Heading"]["Interverse"][buf] = header; + module->getEntryAttributes()["Heading"]["Interverse"][buf] = heading; if (option) { // we want the tag in the text text.append(header); } @@ -143,8 +152,17 @@ char ThMLHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *mo } */ } - else + else { isheader = false; + SWBuf cls = tag.getAttribute("class"); + if (cls.startsWith("fromEntryAttributes ")) { + cls << SWBuf("fromEntryAttributes ").size(); + tag.setAttribute("class", cls); + token = tag; + token << 1; + token.setSize(token.size() - 1); + } + } } if (withinDiv && isheader) { -- cgit v1.2.3