diff options
| author | deva <deva> | 2011-07-01 11:54:26 +0000 | 
|---|---|---|
| committer | deva <deva> | 2011-07-01 11:54:26 +0000 | 
| commit | 23f39df8b8edeacfa5821050abbdc855acb2edd6 (patch) | |
| tree | e56f7826c361a85a3bac9e0b3206086c81114748 /server/src/templateparser.cc | |
| parent | 2c53b5ef16626112dfc738420eec3e1963b1a343 (diff) | |
removed macrotool.
add lua wrapper for praxisd.
new type attributes_t for sax parser and children.
make macros/templates use real vars instead of var map.
add data ttl on macro level.
add 'important' attribute to macrotags in templates.
Diffstat (limited to 'server/src/templateparser.cc')
| -rw-r--r-- | server/src/templateparser.cc | 23 | 
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()); | 
