From 0c005b510506d341e7a8134a4eb2ad48fdbc8168 Mon Sep 17 00:00:00 2001 From: stanley lieber Date: Fri, 7 Mar 2014 11:44:05 -0500 Subject: mothra: handle blank lines inside
 tags

---
 sys/src/cmd/mothra/rdhtml.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/sys/src/cmd/mothra/rdhtml.c b/sys/src/cmd/mothra/rdhtml.c
index 88bb4f853..cf13c213f 100644
--- a/sys/src/cmd/mothra/rdhtml.c
+++ b/sys/src/cmd/mothra/rdhtml.c
@@ -540,9 +540,9 @@ int pl_gettag(Hglob *g){
 	return ENDTAG;
 }
 /*
- * The next token is a tag, an end tag or a sequence of
- * non-white characters.
- * If inside 
, newlines are converted to 
and spaces are preserved. + * The next token is a tag, an end tag or a sequence of non-white + * characters. If inside
, single newlines are converted to 
, + * double newlines are converted to

and spaces are preserved. * Otherwise, spaces and newlines are noted and discarded. */ int pl_gettoken(Hglob *g){ @@ -552,8 +552,15 @@ int pl_gettoken(Hglob *g){ case STAG: return pl_gettag(g); case EOF: return EOF; case '\n': - pl_tagparse(g, "br"); - return TAG; + switch(c=pl_nextc(g)){ + case '\n': + pl_tagparse(g, "p"); + return TAG; + default: + pl_tagparse(g, "br"); + pl_putback(g, c); + return TAG; + } default: tokp=g->token; while(c=='\t'){ -- cgit v1.2.3