diff --git a/Tag.cpp b/Tag.cpp index 53ed10e..264db9a 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -222,13 +222,20 @@ namespace jet { in.skipWhitespace(); if(in.ifNext(">")) break; - else if(in.getTokenExclude("=").getLength() != 0) { + else if(coreutils::ZString attrName = in.getTokenExclude("="); attrName.getLength() != 0) { bool dq = in.ifNext("=\""); bool sq = !dq && in.ifNext("='"); if(dq || sq) { + // Keep the attribute (e.g. ) - it used + // to be skipped and dropped, so never + // stored the error and every caught error read as "". + char *valueStart = in.getCursor(); while(1) { - if(in.ifNext(dq ? "\"" : "'")) - break; + char *valueEnd = in.getCursor(); + if(in.ifNext(dq ? "\"" : "'")) { + splitKeywords[coreutils::MString(attrName)] = coreutils::MString(coreutils::ZString(valueStart, valueEnd - valueStart)); + break; + } in.nextChar(); } } else { diff --git a/Tag.h b/Tag.h index eb4c0a4..2e70666 100644 --- a/Tag.h +++ b/Tag.h @@ -139,6 +139,12 @@ namespace jet { void scanContainerNamed(coreutils::ZString &in, const char *tagName); coreutils::MString processModifier(coreutils::MString &value, coreutils::MString &modifier); + + public: + // The split tag's own attributes (raw, unresolved) - e.g. 's + // , so __trytag can bind the error to that name. + // Last member on purpose: adding it changes no other member's offset. + std::map splitKeywords; }; } diff --git a/__trytag.cpp b/__trytag.cpp index 12ef1a5..f22c48d 100644 --- a/__trytag.cpp +++ b/__trytag.cpp @@ -30,9 +30,13 @@ namespace jet { // without this a caught mid-render failure would leave partial // try-block output mixed in ahead of the catch block's own. out = ""; + // or (the usual form). if(keywordDefined("name")) storeVariable(resolveKeyword("name"), errorText, keywordDefined("scope") ? resolveKeyword("scope") : "global"); + else if(splitKeywords.count("name")) + storeVariable(splitKeywords["name"], errorText, + splitKeywords.count("scope") ? coreutils::ZString(splitKeywords["scope"]) : coreutils::ZString("global")); if(hasContainer2) processContainer(container2); }