[goffice] replace gnm:style with gnm:[ap]m-suffix



commit 130d1f2dcd655b049412da5544c4ae581cc7f41c
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri Jan 1 19:50:49 2016 -0700

    replace gnm:style with gnm:[ap]m-suffix
    
    2016-01-01 Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * utils/go-format.c (go_format_output_date_to_odf): write
        gnm:am-suffix and gnm:pm-suffix attributes instead of the
        gnm:style attribute for number:style

 ChangeLog                 |    6 ++++++
 goffice/utils/go-format.c |   17 ++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index efd6b23..900c1c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2016-01-01 Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * utils/go-format.c (go_format_output_date_to_odf): write
+       gnm:am-suffix and gnm:pm-suffix attributes instead of the 
+       gnm:style attribute for number:style
+
+2016-01-01 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * utils/go-format.c (go_format_output_date_to_odf): write
        gnm:style attribute of number:style
 
 2015-12-28  Morten Welinder <terra gnome org>
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index e9cbf73..017b5c4 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -7923,8 +7923,14 @@ go_format_output_date_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                        ODF_CLOSE_STRING;
                        element_written = TRUE;
                        gsf_xml_out_start_element (xout, NUMBER "am-pm");
-                       if (with_extension)
-                               gsf_xml_out_add_cstr (xout, GNMSTYLE "style", "short");                 
+                       if (with_extension) {
+                               gchar *suffix = g_strndup (token, 1);
+                               gsf_xml_out_add_cstr (xout, GNMSTYLE "am-suffix", suffix);
+                               g_free (suffix);
+                               suffix = g_strndup (token + 2, 1);
+                               gsf_xml_out_add_cstr (xout, GNMSTYLE "pm-suffix", suffix);
+                               g_free (suffix);
+                       }               
                        gsf_xml_out_end_element (xout); /* </number:am-pm> */
                        break;
 
@@ -7933,7 +7939,12 @@ go_format_output_date_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
                        seen_ampm = TRUE;
                        ODF_CLOSE_STRING;
                        element_written = TRUE;
-                       gsf_xml_out_simple_element (xout, NUMBER "am-pm", NULL);
+                       gsf_xml_out_start_element (xout, NUMBER "am-pm");
+                       if (with_extension) {
+                               gsf_xml_out_add_cstr (xout, GNMSTYLE "am-suffix", "AM");
+                               gsf_xml_out_add_cstr (xout, GNMSTYLE "pm-suffix", "PM");
+                       }                       
+                       gsf_xml_out_end_element (xout); /* </number:am-pm> */
                        break;
 
                case TOK_ELAPSED_H:


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