diff --git a/Tag.cpp b/Tag.cpp index 2ee6005..1c10823 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -3,6 +3,7 @@ #include "KeywordValue.h" #include "Log.h" #include "__mysql.h" +#include "__comment.h" #include "__for.h" #include "__if.h" #include "__read.h" @@ -103,6 +104,9 @@ namespace jet { if(ifTagName(in, "mysql")) { __mysql _mysql(in, out, global); continue; + } else if(ifTagName(in, "comment")) { + __comment _comment(in, out, global); + continue; } else if(ifTagName(in, "for")) { __for _for(in, out, global); continue; diff --git a/Tag.h b/Tag.h index 8aebee6..29d416a 100644 --- a/Tag.h +++ b/Tag.h @@ -31,7 +31,7 @@ namespace jet { bool output = true; bool evaluate = true; bool filterBlankLines = false; - bool trim = false; + bool trimLines = false; bool cleanWhitespace = false; private: diff --git a/__read.cpp b/__read.cpp index 7771db2..4eb37f7 100644 --- a/__read.cpp +++ b/__read.cpp @@ -7,15 +7,14 @@ namespace jet { __read::__read(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) { - if(!variableDefined(coreutils::ZString("file"))) + if(!variableDefined("file")) throw coreutils::Exception("file keyword must be specified."); + if(!variableDefined("name")) + throw coreutils::Exception("name keyword must be specified."); if(hasContainer) throw coreutils::Exception("read tag does not have a container."); fd = open(variables["file"].c_str(), O_RDONLY); - while(len = read(fd, &buffer, sizeof(buffer - 1))) { - buffer[len] = 0; - out << buffer; - } + global.variables[variables["name"]].read(fd); close(fd); } diff --git a/testjet b/testjet index ca0ed2b..ab6a25f 100755 Binary files a/testjet and b/testjet differ diff --git a/testjet.cpp b/testjet.cpp index 7de6f2e..9364ff7 100644 --- a/testjet.cpp +++ b/testjet.cpp @@ -6,6 +6,7 @@ int main(int argc, char **argv) { coreutils::ZString data("\n" + " This is a comment and should not show up in the output.\n" " \n" " \n" " \n" @@ -31,6 +32,8 @@ int main(int argc, char **argv) { " \n" " \n" " $[ls]\n" + " \n" + " $[file]\n" " \n" "\n");