36 static const char oName[] =
"Headings";
37 static const char oTip[] =
"Toggles Headings On and Off if they exist";
41 static const StringList oVals(&choices[0], &choices[2]);
60 currentHeadingName =
"";
61 currentHeadingTag =
"";
73 return new MyUserData(module, key);
84 MyUserData *u = (MyUserData *)userData;
91 if (u->currentHeadingName.size()) {
92 u->heading.append(u->lastTextNode);
94 if (name == u->currentHeadingName) {
96 if (!u->depth-- || u->sID) {
99 bool preverse = (
SWBuf(
"x-preverse") == u->currentHeadingTag.getAttribute(
"subType") ||
SWBuf(
"x-preverse") == u->currentHeadingTag.getAttribute(
"subtype"));
102 if (u->module->isProcessEntryAttributes() && (
option || u->canonical || !preverse)) {
108 if (u->currentHeadingName ==
"title") {
109 XMLTag wrapper = u->currentHeadingTag;
113 heading += u->heading;
116 else heading = u->heading;
117 u->module->getEntryAttributes()[
"Heading"][(preverse)?
"Preverse":
"Interverse"][hn] = heading;
119 StringList attributes = u->currentHeadingTag.getAttributeNames();
120 for (StringList::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
121 u->module->getEntryAttributes()[
"Heading"][hn][it->c_str()] = u->currentHeadingTag.getAttribute(it->c_str());
126 if (u->canonical) u->module->getEntryAttributes()[
"Heading"][hn][
"canonical"] =
"true";
131 if ((!preverse || !u->module->isProcessEntryAttributes()) && (
option || u->canonical)) {
132 buf.
append(u->currentHeadingTag);
136 u->suspendTextPassThru =
false;
147 else if ( name ==
"title"
152 u->currentHeadingName = name;
153 u->currentHeadingTag = tag;
157 u->suspendTextPassThru =
true;
virtual BasicFilterUserData * createUserData(const SWModule *module, const SWKey *key)
#define SWORD_NAMESPACE_START
SWBuf & appendFormatted(const char *format,...)
const char * setAttribute(const char *attribName, const char *attribValue, int partNum=-1, char partSplit= '|')
void setPassThruUnknownToken(bool val)
const char * getName() const
virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData)
static const StringList * oValues()
MyUserData(const SWModule *module, const SWKey *key)
std::list< SWBuf > StringList
SWBuf & append(const char *str, long max=-1)
static const char oName[]
static const char * choices[4]
const char * getAttribute(const char *attribName, int partNum=-1, char partSplit= '|') const
bool isEndTag(const char *eID=0) const
#define SWORD_NAMESPACE_END