Commit Diff


commit - e733e1f3e0661718f83f59220c017cc3578207b5
commit + 14d86fd9156dd2aecbc0af532359e7fc3207415a
blob - 23136af5fef103ce02a1dc2506d9f42292b3bdf3
blob + 34f42f83d0770ec2ab269538aac80935c414dfec
--- template/parse.y
+++ template/parse.y
@@ -479,6 +479,7 @@ yylex(void)
 	int		 token;
 	int		 starting = 0;
 	int		 ending = 0;
+	int		 quote = 0;
 
 	if (!in_define && block == 0) {
 		while ((c = lgetc(0)) != '{' && c != EOF) {
@@ -604,7 +605,13 @@ newblock:
 		return (c);
 
 	do {
-		if (c == '|') {
+		if (!quote && isspace((unsigned char)c))
+			break;
+
+		if (c == '"')
+			quote = !quote;
+
+		if (!quote && c == '|') {
 			lungetc(c);
 			break;
 		}
@@ -618,7 +625,7 @@ newblock:
 			ending = 0;
 			lungetc(c);
 			c = block;
-		} else if (c == '}') {
+		} else if (!quote && c == '}') {
 			ending = 1;
 			continue;
 		}
@@ -628,11 +635,11 @@ newblock:
 			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
@@ -9,6 +9,8 @@
 	</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
@@ -1,2 +1,2 @@
-<!doctype html><html><head><title> *hello* </title></head><body> <h1> *hello* </h1></body></html>
-<!doctype html><html><head><title>&lt;hello&gt;</title></head><body> <h1>&lt;hello&gt;</h1></body></html>
+<!doctype html><html><head><title> *hello* </title></head><body> <h1> *hello* </h1> | other stuff</body></html>
+<!doctype html><html><head><title>&lt;hello&gt;</title></head><body> <h1>&lt;hello&gt;</h1> | other stuff</body></html>