[evolution-patches] Fix for Bug 270487 [gtkhtml]
- From: Rohini <srohini novell com>
- To: evolution-patches gnome org
- Subject: [evolution-patches] Fix for Bug 270487 [gtkhtml]
- Date: Fri, 27 Jan 2006 16:23:21 +0530
Hi
Attached Fix for Bug 270487 – autourlified URLs not html-escaped
Please Review.
Thanks,
Rohini
Index: htmltokenizer.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltokenizer.c,v
retrieving revision 1.78
diff -u -p -r1.78 htmltokenizer.c
--- htmltokenizer.c 13 May 2004 15:07:33 -0000 1.78
+++ htmltokenizer.c 27 Jan 2006 10:36:21 -0000
@@ -89,6 +89,7 @@ struct _HTMLTokenizerPrivate {
gboolean select; /* Are we in a <select> block? */
gboolean charEntity; /* Are we in an &... sequence? */
gboolean extension; /* Are we in an <!-- +GtkHTML: sequence? */
+ gboolean aTag; /* Are we in a <a/> tag*/
enum {
NoneDiscard = 0,
@@ -233,6 +234,7 @@ html_tokenizer_init (HTMLTokenizer *t)
p->select = FALSE;
p->charEntity = FALSE;
p->extension = FALSE;
+ p->aTag = FALSE;
p->discard = NoneDiscard;
p->pending = NonePending;
@@ -1091,6 +1093,10 @@ end_tag (HTMLTokenizer *t, const gchar *
}
else if (strncmp (p->buffer + 2, "tablesdkl", 9) == 0) {
html_tokenizer_blocking_push (t, Table);
+ }
+ else if (strncmp (p->buffer + 2, "/a", 2) == 0) {
+ //html_tokenizer_blocking_push (t, Table);
+ p->aTag = FALSE;
}
else {
if (p->blocking) {
@@ -1148,6 +1154,8 @@ in_crlf (HTMLTokenizer *t, const gchar *
static void
in_space_or_tab (HTMLTokenizer *t, const gchar **src)
{
+ gchar *ptr;
+
if (t->priv->tquote) {
if (t->priv->discard == NoneDiscard)
t->priv->pending = SpacePending;
@@ -1156,6 +1164,9 @@ in_space_or_tab (HTMLTokenizer *t, const
t->priv->searchCount = 0; /* Stop looking for <!-- sequence */
if (t->priv->discard == NoneDiscard)
t->priv->pending = SpacePending;
+ ptr = t->priv->buffer;
+ if (ptr[1] == '<' && ptr[2] == 'a' && strlen (ptr) == 3)
+ t->priv->aTag = TRUE;
}
else if (t->priv->pre || t->priv->textarea) {
if (t->priv->pending)
@@ -1285,7 +1296,7 @@ html_tokenizer_tokenize_one_char (HTMLTo
in_entity (t, src);
else if (p->startTag)
in_tag (t, src);
- else if (**src == '&')
+ else if (**src == '&' && !p->aTag)
start_entity (t, src);
else if (**src == '<' && !p->tag)
start_tag (t, src);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2157
diff -u -p -r1.2157 ChangeLog
--- ChangeLog 27 Jan 2006 08:08:36 -0000 1.2157
+++ ChangeLog 27 Jan 2006 10:48:09 -0000
@@ -1,3 +1,13 @@
+2006-01-27 Rohini S <srohini novell com>
+
+ * htmltokenizer.c (html_tokenizer_init), (end_tag), (in_space_or_tab),
+ (html_tokenizer_tokenize_one_char): Modified _HTMLTokenizerPrivate struct
+ to include a new boolean member variable aTag which checks if the tokenizer
+ is currently parsing a Link. The functions are modified to escape HTML
+ entities in a URL.
+
+ Fixes bug #270487
+
2006-01-20 Rohini S <srohini novell com>
* htmlengine.c (element_parse_tr): Function modified to set
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]