[sword-svn] r1954 - trunk/src/modules/filters
scribe at crosswire.org
scribe at crosswire.org
Sun Nov 12 16:30:19 MST 2006
Author: scribe
Date: 2006-08-05 15:48:37 -0700 (Sat, 05 Aug 2006)
New Revision: 1954
Modified:
trunk/src/modules/filters/osisheadings.cpp
trunk/src/modules/filters/thmlheadings.cpp
Log:
Added fix to preserve markup in headings (charcoal)
Modified: trunk/src/modules/filters/osisheadings.cpp
===================================================================
--- trunk/src/modules/filters/osisheadings.cpp 2006-08-04 22:03:40 UTC (rev 1953)
+++ trunk/src/modules/filters/osisheadings.cpp 2006-08-05 22:48:37 UTC (rev 1954)
@@ -34,6 +34,7 @@
bool intoken = false;
bool hide = false;
bool preverse = false;
+ bool withinTitle = false;
bool canonical = false;
SWBuf header;
int headerNum = 0;
@@ -57,6 +58,7 @@
intoken = false;
if (!strncmp(token.c_str(), "title", 5) || !strncmp(token.c_str(), "/title", 6)) {
+ withinTitle = (!strnicmp(token.c_str(), "title", 5));
tag = token;
if (!tag.isEndTag()) { //start tag
@@ -113,11 +115,17 @@
}
}
- // if not a heading token, keep token in text
- if (!hide) {
- text.append('<');
- text.append(token);
- text.append('>');
+ if (withinTitle) {
+ header.append('<');
+ header.append(token);
+ header.append('>');
+ } else {
+ // if not a heading token, keep token in text
+ if (!hide) {
+ text.append('<');
+ text.append(token);
+ text.append('>');
+ }
}
continue;
}
Modified: trunk/src/modules/filters/thmlheadings.cpp
===================================================================
--- trunk/src/modules/filters/thmlheadings.cpp 2006-08-04 22:03:40 UTC (rev 1953)
+++ trunk/src/modules/filters/thmlheadings.cpp 2006-08-05 22:48:37 UTC (rev 1954)
@@ -35,6 +35,7 @@
bool intoken = false;
bool hide = false;
bool preverse = false;
+ bool withinDiv = false;
SWBuf header;
int headerNum = 0;
int pvHeaderNum = 0;
@@ -57,6 +58,7 @@
intoken = false;
if (!strnicmp(token.c_str(), "div", 3) || !strnicmp(token.c_str(), "/div", 4)) {
+ withinDiv = (!strnicmp(token.c_str(), "div", 3));
tag = token;
if (hide && tag.isEndTag()) {
if (module->isProcessEntryAttributes() && (option || (!preverse))) {
@@ -117,11 +119,17 @@
}
}
- // if not a heading token, keep token in text
- if (!hide) {
- text.append('<');
- text.append(token);
- text.append('>');
+ if (withinDiv) {
+ header.append('<');
+ header.append(token);
+ header.append('>');
+ } else {
+ // if not a heading token, keep token in text
+ if (!hide) {
+ text.append('<');
+ text.append(token);
+ text.append('>');
+ }
}
continue;
}
More information about the sword-cvs
mailing list