From 0de087f14d9c1e489a787570fae07beec7915304 Mon Sep 17 00:00:00 2001 From: Brad Arant Date: Thu, 7 Nov 2024 10:44:20 -0800 Subject: [PATCH] Fixed ability to not have to enclose jet tag. --- Tag.cpp | 2 +- Tag.h | 3 ++- tests/testvar.jet | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Tag.cpp b/Tag.cpp index dcc2100..5bcf22b 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -31,7 +31,7 @@ namespace jet { Tag::Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName) : ZString(in), parentOut(parentOut), global(global), parent(parent) { this->splitTagName = splitTagName; - if(in.ifNext("<")) { + if(parent && in.ifNext("<")) { name = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_!"); if(in.startsWith(" ") || in.startsWith("/") || in.startsWith(">")) { bool finished = false; diff --git a/Tag.h b/Tag.h index b95bf2e..a35d1c7 100644 --- a/Tag.h +++ b/Tag.h @@ -11,7 +11,7 @@ namespace jet { class Tag : public coreutils::ZString { public: - Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName = ""); + Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent = NULL, coreutils::ZString splitTagName = ""); virtual ~Tag(); std::map variables; @@ -40,6 +40,7 @@ namespace jet { bool cleanWhitespace = false; private: + bool containerOnly = false; coreutils::ZString splitTagName; int skipBlankLine(coreutils::ZString in); diff --git a/tests/testvar.jet b/tests/testvar.jet index 39d4ecc..93445ab 100755 --- a/tests/testvar.jet +++ b/tests/testvar.jet @@ -1,12 +1,13 @@ #!../jet-2.0 - + + -$[$test] + $[$[ix]var$[ix]] $[var$[ix]] $[var$[ix]var] @@ -14,4 +15,4 @@ $[var$[i$[letterx]]var] $[letterx;TOHEX] $[var$[i$[letterx]]$[ix]] $[var$[i$[letterx]]$[i$[letterx]]] - +