From 980d055f727f95d1a8f7f889d60bb7ea87ce06fb Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 24 May 2015 19:40:35 +0200
Subject: [PATCH] Allow for attributes in tags.
parse_tag() is called both for attributes inside a tag and the end of the tag itself. For most tags parse_tag() doesn't distinguish both cases. This means that the "tag action" is additionally triggered for every tag attribute. When the tag "action" is setting some state this doesn't hurt. For many tags the "tag action" is to render a newline. Superfluous newlines are sort of acceptable to keep the code as small as possible. However the "tag action" is to render a newline followed by an asterisk - and superfluous asterisks are ugly so we check for if parse_tag() was called for the end of the tag itself.
---
apps/webbrowser/htmlparser.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/apps/webbrowser/htmlparser.c b/apps/webbrowser/htmlparser.c
index bb59477b1..7ca5f7575 100644
--- a/apps/webbrowser/htmlparser.c
+++ b/apps/webbrowser/htmlparser.c
@@ -390,9 +390,11 @@ parse_tag(void)
newline();
break;
case TAG_LI:
- newline();
- add_char(ISO_asterisk);
- add_char(ISO_space);
+ if(s.tagattr[0] == 0) {
+ newline();
+ add_char(ISO_asterisk);
+ add_char(ISO_space);
+ }
break;
case TAG_SCRIPT:
case TAG_STYLE: