summaryrefslogtreecommitdiff
path: root/server/src/templateparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/templateparser.cc')
-rw-r--r--server/src/templateparser.cc23
1 files changed, 19 insertions, 4 deletions
diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc
index 20270c6..b9c65f5 100644
--- a/server/src/templateparser.cc
+++ b/server/src/templateparser.cc
@@ -83,7 +83,7 @@ void TemplateParser::characterData(std::string &data)
{
}
-void TemplateParser::startTag(std::string name, std::map< std::string, std::string> attributes)
+void TemplateParser::startTag(std::string name, attributes_t &attr)
{
// Enable macro parsing
if(name == "template") {
@@ -92,7 +92,9 @@ void TemplateParser::startTag(std::string name, std::map< std::string, std::stri
assert(t); // A Template has not yet been allocated, cannot create template!
- t->attributes = attributes;
+ if(attr.find("name") != attr.end()) t->name = attr["name"];
+ if(attr.find("title") != attr.end()) t->title = attr["title"];
+ if(attr.find("version") != attr.end()) t->version = attr["version"];
return;
}
@@ -105,7 +107,19 @@ void TemplateParser::startTag(std::string name, std::map< std::string, std::stri
assert(t); // A Template has not yet been allocated, cannot create macro!
Macro m;
- m.attributes = attributes;
+
+ if(attr.find("name") != attr.end()) m.name = attr["name"];
+ if(attr.find("version") != attr.end()) m.version = attr["version"];
+ if(attr.find("caption") != attr.end()) m.caption = attr["caption"];
+ if(attr.find("requires") != attr.end()) m.requires = attr["requires"];
+ if(attr.find("ttl") != attr.end()) m.ttl = attr["ttl"];
+
+ m.isImportant = attr.find("important") != attr.end() &&
+ attr["important"] == "true";
+ m.isStatic = attr.find("static") != attr.end() && attr["static"] == "true";
+ m.isCompact = attr.find("compact") != attr.end() &&
+ attr["compact"] == "true";
+
m.isHeader = name == "header";
t->macros.push_back(m);
current_macro = &(t->macros.back());
@@ -139,7 +153,8 @@ int TemplateParser::readData(char *data, size_t size)
return r;
}
-void TemplateParser::parseError(const char *buf, size_t len, std::string error, int lineno)
+void TemplateParser::parseError(const char *buf, size_t len, std::string error,
+ int lineno)
{
fprintf(stderr, "TemplateParser[%s] error at line %d: %s\n",
file.c_str(), lineno, error.c_str());