mothra: handle blank lines inside <pre> tags
This commit is contained in:
parent
f88d0c372d
commit
0c005b5105
1 changed files with 12 additions and 5 deletions
|
@ -540,9 +540,9 @@ int pl_gettag(Hglob *g){
|
||||||
return ENDTAG;
|
return ENDTAG;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* The next token is a tag, an end tag or a sequence of
|
* The next token is a tag, an end tag or a sequence of non-white
|
||||||
* non-white characters.
|
* characters. If inside <pre>, single newlines are converted to <br>,
|
||||||
* If inside <pre>, newlines are converted to <br> and spaces are preserved.
|
* double newlines are converted to <p> and spaces are preserved.
|
||||||
* Otherwise, spaces and newlines are noted and discarded.
|
* Otherwise, spaces and newlines are noted and discarded.
|
||||||
*/
|
*/
|
||||||
int pl_gettoken(Hglob *g){
|
int pl_gettoken(Hglob *g){
|
||||||
|
@ -552,8 +552,15 @@ int pl_gettoken(Hglob *g){
|
||||||
case STAG: return pl_gettag(g);
|
case STAG: return pl_gettag(g);
|
||||||
case EOF: return EOF;
|
case EOF: return EOF;
|
||||||
case '\n':
|
case '\n':
|
||||||
pl_tagparse(g, "br");
|
switch(c=pl_nextc(g)){
|
||||||
|
case '\n':
|
||||||
|
pl_tagparse(g, "p");
|
||||||
return TAG;
|
return TAG;
|
||||||
|
default:
|
||||||
|
pl_tagparse(g, "br");
|
||||||
|
pl_putback(g, c);
|
||||||
|
return TAG;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
tokp=g->token;
|
tokp=g->token;
|
||||||
while(c=='\t'){
|
while(c=='\t'){
|
||||||
|
|
Loading…
Reference in a new issue