[gnumeric] handle superscript/subscript in html export



commit 94884f895b90fe29dd2df103fd61919a4212486e
Author: Andreas J. Guelzow <aguelzow math concordia ab ca>
Date:   Tue Sep 1 16:01:46 2009 -0600

    handle superscript/subscript in html export
    
    2009-09-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* html.c (cb_html_attrs_as_string): handle PANGO_ATTR_RISE
    	(html_write_cell_content): handle superscript/subscript

 NEWS                   |    1 +
 plugins/html/ChangeLog |    5 +++++
 plugins/html/html.c    |   30 +++++++++++++++++++++++++++++-
 3 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 826b6d1..08582a1 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Gnumeric 1.9.12
 Andreas:
 	* Add CHOLESKY.
 	* Fix ODF background colour export. [#593816]
+	* Handle super/subscript in html export. [#593851]
 
 Morten:
 	* Fix menu sensitivity problem.  [#593624]
diff --git a/plugins/html/ChangeLog b/plugins/html/ChangeLog
index 483c06f..90ba3d4 100644
--- a/plugins/html/ChangeLog
+++ b/plugins/html/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* html.c (cb_html_attrs_as_string): handle PANGO_ATTR_RISE
+	(html_write_cell_content): handle superscript/subscript
+
 2009-09-01  Jean Brefort  <jean brefort normalesup org>
 
 	* html.c (html_get_text_color): renamed GOColor macros.
diff --git a/plugins/html/html.c b/plugins/html/html.c
index 89c3cac..b8f665b 100644
--- a/plugins/html/html.c
+++ b/plugins/html/html.c
@@ -1,3 +1,4 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * html.c
  *
@@ -161,7 +162,14 @@ cb_html_attrs_as_string (GsfOutput *output, PangoAttribute *a, html_version_t ve
 	case PANGO_ATTR_SIZE :
 		break; /* ignored */
 	case PANGO_ATTR_RISE:
-		break; /* ignored */
+		if (((PangoAttrInt *)a)->value > 5) {
+			gsf_output_puts (output, "<sup>");
+			closure = "</sup>";
+		} else if (((PangoAttrInt *)a)->value < -5) {
+			gsf_output_puts (output, "<sub>");
+			closure = "</sub>";
+		} 
+		break;
 	case PANGO_ATTR_STYLE :
 		if (((PangoAttrInt *)a)->value == PANGO_STYLE_ITALIC) {
 			gsf_output_puts (output, "<i>");
@@ -271,6 +279,16 @@ 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)) {
+			case GO_FONT_SCRIPT_SUB:
+				gsf_output_puts (output, "<sub>");
+				break;
+			case GO_FONT_SCRIPT_SUPER:
+				gsf_output_puts (output, "<sup>");
+				break;
+			default:
+				break;
+			}
 		}
 
 		if (hlink_target)
@@ -307,6 +325,16 @@ 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)) {
+			case GO_FONT_SCRIPT_SUB:
+				gsf_output_puts (output, "</sub>");
+				break;
+			case GO_FONT_SCRIPT_SUPER:
+				gsf_output_puts (output, "</sup>");
+				break;
+			default:
+				break;
+			}
 			if (font_is_monospaced (style))
 				gsf_output_puts (output, "</tt>");
 			if (gnm_style_get_font_uline (style) != UNDERLINE_NONE)



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