#include "HTMLTag.h"
StringMapCI HTMLTag::m_tags; //HTML tags lookup
vector HTMLTag::m_ids; //id lookup
//static tag initialisation (enters into a map)
//For inline/block we distinguish between tags that are:
// 1. used always in text in-line just for in-line formatting (converted to formats in the Document class)
// 2. used almost always in text block for layout (converted to \n)
// 3. unknown usage (may require CSS analysis to be sure)
// 4. everything else: commonly used in unwanted markup
//processing instructions
//don't jump these because they don't have end tags
HTMLTag HTMLTag::tag_comment("--", PI, JUMP, BLOCK, NCSS, NORM, "-->"); //does not require a space after name
else {
//normal tagname resolution
tagEnd = tagStart;
while ((c = *tagEnd) && isAlphaNumeric(c)) tagEnd++; //nearest space or > or / (
) or EOF
}
if (c) thisTag = tag(tagStart, tagEnd); //EOF check, we have the tag name now :)
return thisTag;
}
HTMLTag *HTMLTag::tag(const char *text) {
StringMapCI::const_iterator i;
i = m_tags.find(text);
return (i == m_tags.end() ? 0 : i->second);
}
HTMLTag *HTMLTag::tag(const char *textstart, const char *textfinish) {
char *endc = (char*) textfinish;
char c = *endc; *endc = 0;
HTMLTag *t = tag(textstart);
*endc = c;
return t;
}