diff --git a/.#JetCore.txt b/.#JetCore.txt new file mode 120000 index 0000000..22dcfc6 --- /dev/null +++ b/.#JetCore.txt @@ -0,0 +1 @@ +barant@barant01.5084 \ No newline at end of file diff --git a/Global.h b/Global.h index fcea707..dcb147f 100644 --- a/Global.h +++ b/Global.h @@ -28,6 +28,7 @@ namespace jet { std::map cgiVariables; std::map sessions; std::map headers; + std::map tags; }; diff --git a/Tag.cpp b/Tag.cpp index 4ebf4f6..3e6a5d7 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -1,6 +1,7 @@ #include "Tag.h" #include "Exception.h" #include "KeywordValue.h" +#include "Global.h" #include "Log.h" #include "__mysql.h" #include "__sql.h" @@ -19,6 +20,7 @@ #include "__while.h" #include "__header.h" #include "__whiledir.h" +#include "__tag.h" #include namespace jet { @@ -163,6 +165,12 @@ namespace jet { } else if(ifTagName(in, "whiledir")) { __whiledir _whiledir(in, out, global); continue; + } else if(ifTagName(in, "tag")) { + __tag _tag(in, out, global); + continue; + } else if(tags.contains(in)) { + __tag _tag(in, out, global); + continue; } else { out.write(in.charAt(0)); in.nextChar(); @@ -175,7 +183,7 @@ namespace jet { } } } - + void Tag::scanContainer(coreutils::ZString &in) { while(!in.eod()) { if(ifEndTagName(in)) diff --git a/__tag.cpp b/__tag.cpp new file mode 100644 index 0000000..195a641 --- /dev/null +++ b/__tag.cpp @@ -0,0 +1,14 @@ +#include "__tag.h" +#include "Exception.h" + +namespace jet { + + __tag::__tag(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) { + if(!variableDefined("name")) + throw coreutils::Exception("tag must have a name."); + if(!hasContainer) + throw coreutils::Exception("tag requires a container to process."); + global.tags[variables["name"]] = container; + } +} + diff --git a/__tag.h b/__tag.h new file mode 100644 index 0000000..ed3f8c6 --- /dev/null +++ b/__tag.h @@ -0,0 +1,18 @@ +#ifndef ____tag_h__ +#define ____tag_h__ + +#include "Tag.h" +#include "ZString.h" + +namespace jet { + + class __tag : public Tag { + + public: + __tag(coreutils::ZString &in, coreutils::MString &parent, Global &global); + + }; + +} + +#endif diff --git a/jet-2.0 b/jet-2.0 deleted file mode 100755 index e042f85..0000000 Binary files a/jet-2.0 and /dev/null differ diff --git a/testjet.jet b/testjet.jet index 482c6e1..61e1425 100755 --- a/testjet.jet +++ b/testjet.jet @@ -11,13 +11,12 @@ --- $[nonexistant] $[%HOME] - - + select * from testdata $[1.id] $[1.text] $[1.value] - +