Patch attached to fix the order of quoting to prevents the corruption of format.

--
Regards,
Gehad Elrobey

>From 4caeaf9c033510c0b6660a60818240222e648bd0 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Fri, 30 May 2014 02:13:44 +0300
Subject: [PATCH] HTML: Quote the '<' and '>' operators before inserting break
 tags

The smaller than and greater than operators should be quoted before
inserting the <br> tags in HTML. Otherwise breaks will be quoted which
corrupts the format.

Signed-off-by: Gehad elrobey <[email protected]>
---
 save-html.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/save-html.c b/save-html.c
index 45bec2a..609ab9e 100644
--- a/save-html.c
+++ b/save-html.c
@@ -49,10 +49,10 @@ char *replace_char(char *str, char replace, char *replace_by)
 
 char *quote(char *string)
 {
-	char *new_line_removed = replace_char(string, '\n', "<br>");
-	char *less_than_removed = replace_char(new_line_removed, '<', "&lt;");
+	char *less_than_removed = replace_char(string, '<', "&lt;");
 	char *greater_than_removed = replace_char(less_than_removed, '>', "&gt;");
-	char *double_quotes_removed = replace_char(greater_than_removed, '"', "&quot;");
+	char *new_line_removed = replace_char(greater_than_removed, '\n', "<br>");
+	char *double_quotes_removed = replace_char(new_line_removed, '"', "&quot;");
 	char *single_quotes_removed = replace_char(double_quotes_removed, '\'', "&#39;");
 	free(new_line_removed);
 	free(less_than_removed);
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to