[Commits] [SCM] claws branch, master, updated. 3.16.0-189-g6a413b8

ticho at claws-mail.org ticho at claws-mail.org
Mon Jun 4 09:04:27 CEST 2018


The branch, master has been updated
       via  6a413b886d2691ec1dafc191823800724e5a1cc0 (commit)
      from  6ad681664a23b9268016e779a94f83413127ad98 (commit)

Summary of changes:
 src/html.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 6a413b886d2691ec1dafc191823800724e5a1cc0
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Jun 1 08:01:05 2018 +0200

    Fix HTML <hX> header handling.
    
    Fix one-by-off error in detection of the end tag,
    and add an extra newline at the beginning to make
    the heading stand out visually.

diff --git a/src/html.c b/src/html.c
index e982794..ca8fd4c 100644
--- a/src/html.c
+++ b/src/html.c
@@ -395,8 +395,7 @@ static SC_HTMLState sc_html_parse_tag(SC_HTMLParser *parser)
 		   !strcmp(tag->name, "li")     ||
 		   !strcmp(tag->name, "table")  ||
 		   !strcmp(tag->name, "dd")     ||
-		   !strcmp(tag->name, "tr")     ||
-		   (tag->name[0] == 'h' && g_ascii_isdigit(tag->name[1]))) {
+		   !strcmp(tag->name, "tr")) {
 		if (!parser->newline) {
 			parser->space = FALSE;
 			sc_html_append_char(parser, '\n');
@@ -405,6 +404,12 @@ static SC_HTMLState sc_html_parse_tag(SC_HTMLParser *parser)
 			sc_html_append_str(parser, LI_STR, -1);
 		}
 		parser->state = SC_HTML_NORMAL;
+	} else if (tag->name[0] == 'h' && g_ascii_isdigit(tag->name[1])) {
+		if (!parser->newline) {
+			parser->space = FALSE;
+			sc_html_append_char(parser, '\n');
+		}
+		sc_html_append_char(parser, '\n');
 	} else if (!strcmp(tag->name, "blockquote")) {
 		parser->state = SC_HTML_NORMAL;
 		parser->indent++;
@@ -414,7 +419,7 @@ static SC_HTMLState sc_html_parse_tag(SC_HTMLParser *parser)
 	} else if (!strcmp(tag->name, "/table") ||
 		   (tag->name[0] == '/' &&
 		    tag->name[1] == 'h' &&
-		    g_ascii_isdigit(tag->name[1]))) {
+		    g_ascii_isdigit(tag->name[2]))) {
 		if (!parser->empty_line) {
 			parser->space = FALSE;
 			if (!parser->newline) sc_html_append_char(parser, '\n');

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list