diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-06-24 08:36:42 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-06-24 08:36:42 +0200 |
commit | f4480d1517834a7b64ba65c4fcf1087430ff17f0 (patch) | |
tree | a219a7c9df64dba498032fbd816397299255a3bc /sys/src/cmd/mothra/rdhtml.c | |
parent | f0b471efb9395509f944ae410d0869bc05d30f50 (diff) |
mothra/uhtml: properly handle quoting in tags
Diffstat (limited to 'sys/src/cmd/mothra/rdhtml.c')
-rw-r--r-- | sys/src/cmd/mothra/rdhtml.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/src/cmd/mothra/rdhtml.c b/sys/src/cmd/mothra/rdhtml.c index b7599a5d1..8e29b46c8 100644 --- a/sys/src/cmd/mothra/rdhtml.c +++ b/sys/src/cmd/mothra/rdhtml.c @@ -474,13 +474,23 @@ int lrunetochar(char *p, int v) */ int pl_gettag(Hglob *g){ char *tokp; - int c; + int c, q; tokp=g->token; if((c=pl_nextc(g))=='!' || c=='?') return pl_getcomment(g); pl_putback(g, c); - while((c=pl_nextc(g))!=ETAG && c!=EOF) - if(tokp < &g->token[NTOKEN-UTFmax-1]) tokp += lrunetochar(tokp, c); + q = 0; + while((c=pl_nextc(g))!=EOF){ + if(c == '\'' || c == '"'){ + if(q == 0) + q = c; + else if(q == c) + q = 0; + } else if(c == ETAG && q == 0) + break; + if(tokp < &g->token[NTOKEN-UTFmax-1]) + tokp += lrunetochar(tokp, c); + } *tokp='\0'; if(c==EOF) htmlerror(g->name, g->lineno, "EOF in tag"); pl_tagparse(g, g->token); |