Re: [evolution-patches] [gtkhtml] pre tags around table fix



ok after looking at it a bit more and ignoring the monospace issue, this
patch should be replaced by the one I've attached, which does
essentially the same thing but does it when a cell starts not when the
table starts because content between the <table> and <td> tags should
still be pre.  The table parser does special things already to make make
content like that work properly and there is no need to change that.

On the other hand the patch as sent is ok to go into this point release
it won't break valid html and we can just apply this one after.

--Larry

On Thu, 2004-08-26 at 18:13 -0500, Larry Ewing wrote:
> hmmm firefox seems to render the table contents as monospace too, are
> you sure this is the right fix?
> 
> --Larry
> 
> On Fri, 2004-08-13 at 16:39 +0200, Radek Doulík wrote:
> > attached patch fixes problem which was demonstrated by NotZed's
> > signature in his replies. it happens in such cases:
> > 
> > <PRE>
> > <TABLE>
> > ....
> > </TABLE>
> > </PRE>
> > 
> > where content inside TABLE tag is used as pre-formatted.
> > 
> > R.
> 
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
Index: htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.616
diff -u -p -r1.616 htmlengine.c
--- htmlengine.c	29 Jul 2004 13:25:27 -0000	1.616
+++ htmlengine.c	27 Aug 2004 00:00:57 -0000
@@ -1195,12 +1195,14 @@ push_clue (HTMLEngine *e, HTMLObject *cl
 	/* CLUECHECK */
 	html_stack_push (e->body_stack, e->parser_clue);
 	html_stack_push (e->body_stack, e->flow);
+	html_stack_push (e->body_stack, GINT_TO_POINTER (e->inPre));
 
 	//e->span_stack = html_stack_new (free_elementggs);
 	e->clueflow_style_stack = html_stack_new (NULL);
 	e->listStack = html_stack_new ((HTMLStackFreeFunc)html_list_destroy);
 	e->parser_clue = clue;
 	e->flow = NULL;
+	e->inPre = 0;
 
 	html_stack_push (e->body_stack, GINT_TO_POINTER (e->avoid_para));
 	
@@ -1218,6 +1220,7 @@ pop_clue (HTMLEngine *e)
 	html_stack_destroy (e->clueflow_style_stack);
 	//html_stack_destroy (e->span_stack);
 
+	e->inPre = GPOINTER_TO_INT (html_stack_pop (e->body_stack));
 	e->flow = html_stack_pop (e->body_stack);
 	/* CLUECHECK */
 	e->parser_clue = html_stack_pop (e->body_stack);
@@ -1258,6 +1261,18 @@ element_parse_title (HTMLEngine *e, HTML
 	push_block (e, "title", DISPLAY_NONE, block_end_title, 0, 0);
 }
 
+static void
+parse_text (HTMLEngine *e, HTMLObject *clue, char *str)
+{
+       if (e->inOption || e->inTextArea) {
+               g_string_append (e->formText, str);
+       } else if (e->inTitle) {
+               g_string_append (e->title, str);
+       } else {
+               insert_text (e, clue, str);
+       }
+}
+
 static gchar *
 new_parse_body (HTMLEngine *e, const gchar *end[])
 {
@@ -1282,13 +1297,7 @@ new_parse_body (HTMLEngine *e, const gch
 			continue;
 
 		if (*str != TAG_ESCAPE) {
-			if (e->inOption || e->inTextArea) {
-				g_string_append (e->formText, str);
-			} else if (e->inTitle) {
-				g_string_append (e->title, str);
-			} else {
-				insert_text (e, clue, str);
-			}
+			parse_text (e, clue, str);
 		} else {
 			gint i  = 0;
 			str++;
@@ -1301,9 +1310,16 @@ new_parse_body (HTMLEngine *e, const gch
 			}
 			
 			/* The tag used for line break when we are in <pre>...</pre> */
-			if (*str == '\n')
-				add_line_break (e, clue, HTML_CLEAR_NONE);
-			else
+			if (*str == '\n') {
+				if (e->inPre)
+					add_line_break (e, clue, HTML_CLEAR_NONE);
+				else {
+					char *str_copy = g_strdup (str);
+					*str_copy = ' ';
+					parse_text (e, clue, str_copy);
+					g_free (str_copy);
+				}
+			} else 
 				parse_one_token (e, clue, str);
 		}
 	}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]