read tag working.
This commit is contained in:
parent
e1be28e53b
commit
15f7b08d68
4
Tag.cpp
4
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;
|
||||
|
2
Tag.h
2
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:
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
coreutils::ZString data("<jet name=\"localname\" filterblanklines=\"true\">\n"
|
||||
" <comment>This is a comment and should not show up in the output.</comment>\n"
|
||||
" <html>\n"
|
||||
" <set name=\"ix\" value=\"1\" />\n"
|
||||
" <set name=\"theexpr\" expr=\"true\" />\n"
|
||||
@ -31,6 +32,8 @@ int main(int argc, char **argv) {
|
||||
" </for>\n"
|
||||
" <call pgm=\"/usr/bin/ls\" arg1=\"-al\" name=\"ls\" />\n"
|
||||
" $[ls]\n"
|
||||
" <read file=\"compile\" name=\"file\" />\n"
|
||||
" $[file]\n"
|
||||
" </html>\n"
|
||||
"</jet>\n");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user