changed literal text operator from ' to (
This commit is contained in:
parent
a4674d7eee
commit
17da357871
22
main.c
22
main.c
@ -129,6 +129,12 @@ int parse_attr(FILE * stream, attr_set_t * output) {
|
||||
isKey = 1;
|
||||
continue;
|
||||
}
|
||||
if (isKey && buffer == '.') {
|
||||
isKey = 0;
|
||||
current_attr.name.c_str = "class";
|
||||
current_attr.name.len = 6;
|
||||
continue;
|
||||
}
|
||||
if (buffer == '=') {
|
||||
isKey = 0;
|
||||
continue;
|
||||
@ -146,12 +152,15 @@ int parse_attr(FILE * stream, attr_set_t * output) {
|
||||
|
||||
// append last attribute
|
||||
attr_set_append(output, ¤t_attr);
|
||||
#ifdef DEBUG
|
||||
printf("parsed attr: %s=%s\n", current_attr.name.c_str, current_attr.value);
|
||||
#endif
|
||||
|
||||
//memset(output, 0, sizeof(attr_set_t));
|
||||
return strip(stream);
|
||||
}
|
||||
|
||||
int parse_text(FILE * stream, FILE * output) {
|
||||
int parse_text(int mode, FILE * stream, FILE * output) {
|
||||
#ifdef DEBUG
|
||||
printf("parse text\n");
|
||||
#endif
|
||||
@ -163,12 +172,11 @@ int parse_text(FILE * stream, FILE * output) {
|
||||
escaped = 1;
|
||||
continue;
|
||||
}
|
||||
if (!escaped && buffer == '"') {
|
||||
if (!escaped && buffer == mode) {
|
||||
break;
|
||||
}
|
||||
escaped = 0;
|
||||
|
||||
if (html_escape(buffer, output)) {
|
||||
if (mode == '"' && html_escape(buffer, output)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -247,8 +255,10 @@ enum node_type {
|
||||
};
|
||||
|
||||
int parse_node(int current, FILE * stream, FILE * output) {
|
||||
if (current == '"') {
|
||||
return parse_text(stream, output);
|
||||
if (current == '"' || current == '(') {
|
||||
if (current == '(') current = ')';
|
||||
|
||||
return parse_text(current, stream, output);
|
||||
}
|
||||
|
||||
// normal node
|
||||
|
25
test.nhtml
25
test.nhtml
@ -1,26 +1,39 @@
|
||||
!DOCTYPE[html]
|
||||
head {
|
||||
title { "was geht" }
|
||||
title { "Alle meine Entchen" }
|
||||
meta[charset=utf-8]
|
||||
|
||||
style {
|
||||
(.strophe {
|
||||
border-width:1px;
|
||||
border-type:solid;
|
||||
border-color:black;
|
||||
background-color:gray;
|
||||
font-type:italic;
|
||||
color: white;
|
||||
padding: 0.5em;
|
||||
})
|
||||
$index.html$
|
||||
}
|
||||
}
|
||||
body {
|
||||
h1 { "Alle Meine Endchen schwimmen auf dem See" }
|
||||
p {
|
||||
h3{ "Alle meine Entchen" }
|
||||
p[.strophe] {
|
||||
"Alle meine Entchen schwimmen auf dem See,
|
||||
schwimmen auf dem See,
|
||||
Köpfchen in das Wasser, Schwänzchen in die Höh'."
|
||||
}
|
||||
p {
|
||||
p[.strophe] {
|
||||
"Alle meine Täubchen gurren auf dem Dach,
|
||||
gurren auf dem Dach,
|
||||
eins fliegt in die Lüfte, fliegen alle nach."
|
||||
}
|
||||
p {
|
||||
p[.strophe] {
|
||||
"Alle meine Hühner scharren in dem Stroh,
|
||||
scharren in dem Stroh,
|
||||
finden sie ein Körnchen, sind sie alle froh."
|
||||
}
|
||||
p {
|
||||
p[.strophe] {
|
||||
"Alle meine Gänschen watscheln durch den Grund,
|
||||
watscheln durch den Grund,
|
||||
suchen in dem Tümpel, werden kugelrund."
|
||||
|
Loading…
Reference in New Issue
Block a user