[gnumeric] Fix HTML export of strikethrough and subscript/superscript. [#600163]



commit 12bf7f7a65099be540713421bfa77fed1d31baa1
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sat Oct 31 15:50:46 2009 -0600

    Fix HTML export of strikethrough and subscript/superscript. [#600163]
    
    2009-10-31  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* html.c (html_write_cell_content): handle strikethrough
    	  (and fix handling of superscript/suscript)
    	(cb_html_attrs_as_string): write valid HTML4 strict.

 NEWS                   |    1 +
 plugins/html/ChangeLog |    6 ++++++
 plugins/html/html.c    |   27 +++++++++++++++++++++++----
 3 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index fca2c27..188eec1 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Andreas:
 	* Make Autofilter addition & removal undoable. [#478152]
 	* Fix autocorrection exception lists. [#600055]
 	* Move autocorrection setup into preferences.
+	* Fix HTML export of strikethrough and subscript/superscript. [#600163]
 
 Jean:
 	* Fixed graph size issues. [#599887]
diff --git a/plugins/html/ChangeLog b/plugins/html/ChangeLog
index 6060b35..ce2c8a0 100644
--- a/plugins/html/ChangeLog
+++ b/plugins/html/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-31  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* html.c (html_write_cell_content): handle strikethrough 
+	  (and fix handling of superscript/suscript)
+	(cb_html_attrs_as_string): write valid HTML4 strict.
+
 2009-10-11  Morten Welinder <terra gnome org>
 
 	* Release 1.9.14
diff --git a/plugins/html/html.c b/plugins/html/html.c
index e329390..2e304c9 100644
--- a/plugins/html/html.c
+++ b/plugins/html/html.c
@@ -184,8 +184,16 @@ cb_html_attrs_as_string (GsfOutput *output, PangoAttribute *a, html_version_t ve
 		break;
 	case PANGO_ATTR_STRIKETHROUGH :
 		if (((PangoAttrInt *)a)->value == 1) {
-			gsf_output_puts (output, "<strike>");
-			closure = "</strike>";
+			if (version == HTML32) {
+				gsf_output_puts (output, "<strike>");
+				closure = "</strike>";
+			} else {
+				gsf_output_puts 
+					(output, 
+					 "<span style=\"text-decoration: "
+					 "line-through;\">");
+				closure = "</span>";
+			}
 		}
 		break;
 	case PANGO_ATTR_UNDERLINE :
@@ -279,7 +287,13 @@ html_write_cell_content (GsfOutput *output, GnmCell *cell, GnmStyle const *style
 				gsf_output_puts (output, "<u>");
 			if (font_is_monospaced (style))
 				gsf_output_puts (output, "<tt>");
-			switch (gnm_style_get_font_strike (style)) {
+			if (gnm_style_get_font_strike (style))
+				if (version == HTML32)
+					gsf_output_puts (output, "<strike>");
+				else
+					gsf_output_puts (output, 
+							 "<span style=\"text-decoration: line-through;\">");
+			switch (gnm_style_get_font_script (style)) {
 			case GO_FONT_SCRIPT_SUB:
 				gsf_output_puts (output, "<sub>");
 				break;
@@ -325,7 +339,12 @@ html_write_cell_content (GsfOutput *output, GnmCell *cell, GnmStyle const *style
 		if (hlink_target)
 			gsf_output_puts (output, "</a>");
 		if (style != NULL) {
-			switch (gnm_style_get_font_strike (style)) {
+			if (gnm_style_get_font_strike (style))
+				if (version == HTML32)
+					gsf_output_puts (output, "</strike>");
+				else
+					gsf_output_puts (output, "</span>");
+			switch (gnm_style_get_font_script (style)) {
 			case GO_FONT_SCRIPT_SUB:
 				gsf_output_puts (output, "</sub>");
 				break;



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