commit - e733e1f3e0661718f83f59220c017cc3578207b5
commit + 14d86fd9156dd2aecbc0af532359e7fc3207415a
blob - 23136af5fef103ce02a1dc2506d9f42292b3bdf3
blob + 34f42f83d0770ec2ab269538aac80935c414dfec
--- template/parse.y
+++ template/parse.y
int token;
int starting = 0;
int ending = 0;
+ int quote = 0;
if (!in_define && block == 0) {
while ((c = lgetc(0)) != '{' && c != EOF) {
return (c);
do {
- if (c == '|') {
+ if (!quote && isspace((unsigned char)c))
+ break;
+
+ if (c == '"')
+ quote = !quote;
+
+ if (!quote && c == '|') {
lungetc(c);
break;
}
ending = 0;
lungetc(c);
c = block;
- } else if (c == '}') {
+ } else if (!quote && c == '}') {
ending = 1;
continue;
}
yyerror("string too long");
return (findeol());
}
- } while ((c = lgetc(0)) != EOF && !isspace((unsigned char)c));
+ } while ((c = lgetc(0)) != EOF);
*p = '\0';
if (c == EOF) {
- yyerror("unterminated block");
+ yyerror(quote ? "unterminated quote" : "unterminated block");
return (0);
}
if (c == '\n')
blob - 05d5356f0237714e97f152adcb5775588cf6084c
blob + 59c8445f7cbb514f0ac71243231534fa2ce8aa50
--- template/regress/03-block.tmpl
+++ template/regress/03-block.tmpl
</head>
<body> {! /* TODO: frobnicate this line! */ !}
<h1>{{ title }}</h1>
+ {{ " | " }}
+ {{ "other stuff" }}
</body>
</html>
{{ finally }}
blob - 204658cfc35574683741428a182a05d8b4c43549
blob + 0f766820b9e5de1343ca8034bea3b2b0a4418221
--- template/regress/03.expected
+++ template/regress/03.expected
-<!doctype html><html><head><title> *hello* </title></head><body> <h1> *hello* </h1></body></html>
-<!doctype html><html><head><title><hello></title></head><body> <h1><hello></h1></body></html>
+<!doctype html><html><head><title> *hello* </title></head><body> <h1> *hello* </h1> | other stuff</body></html>
+<!doctype html><html><head><title><hello></title></head><body> <h1><hello></h1> | other stuff</body></html>