[gnumeric] html: export also file links.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] html: export also file links.
- Date: Mon, 29 Mar 2021 23:35:30 +0000 (UTC)
commit ff3cce0acb2478871e9dd2a9a3caf4b0150ab546
Author: Morten Welinder <terra gnome org>
Date: Mon Mar 29 19:34:08 2021 -0400
html: export also file links.
Probably not that useful, but still.
ChangeLog | 4 ++++
NEWS | 1 +
plugins/html/ChangeLog | 5 +++++
plugins/html/html.c | 19 ++++++++++++++-----
src/hlink.h | 3 +++
5 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a50a689df..0ecf92bed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-29 Morten Welinder <terra gnome org>
+
+ * src/hlink.h (GNM_HLINK_EXTERNAL_TYPE): Add checker macro.
+
2021-03-19 Morten Welinder <terra gnome org>
* src/commands.c (cmd_sort_undo): Paste cell comments too.
diff --git a/NEWS b/NEWS
index 2490818f3..167fb9f1e 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Morten:
* Fix undo problem with sorting and cell comments.
* Python loader cleanups.
* Use Python's bool type instead of rolling our own.
+ * Export also file links to html. [#569]
--------------------------------------------------------------------------
Gnumeric 1.12.49
diff --git a/plugins/html/ChangeLog b/plugins/html/ChangeLog
index 555c0534d..9a3868afb 100644
--- a/plugins/html/ChangeLog
+++ b/plugins/html/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-29 Morten Welinder <terra gnome org>
+
+ * html.c (html_write_cell_content): Export also external (file)
+ links.
+
2021-03-14 Morten Welinder <terra gnome org>
* Release 1.12.49
diff --git a/plugins/html/html.c b/plugins/html/html.c
index 901513ce4..76e3158bd 100644
--- a/plugins/html/html.c
+++ b/plugins/html/html.c
@@ -282,10 +282,17 @@ html_write_cell_content (GsfOutput *output, GnmCell *cell, GnmStyle const *style
char *rendered_string;
gboolean hidden = gnm_style_get_contents_hidden (style);
GnmHLink* hlink = gnm_style_get_hlink (style);
- const guchar* hlink_target = NULL;
-
- if (hlink && GNM_IS_HLINK_URL (hlink)) {
- hlink_target = gnm_hlink_get_target (hlink);
+ char* hlink_target = NULL;
+
+ if (hlink) {
+ const char *target = gnm_hlink_get_target (hlink);
+ if (GNM_IS_HLINK_URL (hlink)) {
+ hlink_target = go_url_encode (target, 1);
+ } else if (GNM_IS_HLINK_EXTERNAL (hlink)) {
+ char *et = go_url_encode (target, 1);
+ hlink_target = g_strconcat ("file://", et, NULL);
+ g_free (et);
+ }
}
if (version == HTML32 && hidden)
@@ -319,8 +326,10 @@ html_write_cell_content (GsfOutput *output, GnmCell *cell, GnmStyle const *style
}
}
- if (hlink_target)
+ if (hlink_target) {
gsf_output_printf (output, "<a href=\"%s\">", hlink_target);
+ g_free (hlink_target);
+ }
if (cell != NULL) {
const PangoAttrList * markup = NULL;
diff --git a/src/hlink.h b/src/hlink.h
index 9c2457625..d31484c23 100644
--- a/src/hlink.h
+++ b/src/hlink.h
@@ -15,6 +15,9 @@ G_BEGIN_DECLS
#define GNM_HLINK_URL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_HLINK_URL_TYPE, GnmHLinkURL))
#define GNM_IS_HLINK_URL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_HLINK_URL_TYPE))
+#define GNM_HLINK_EXTERNAL_TYPE (gnm_hlink_external_get_type ())
+#define GNM_IS_HLINK_EXTERNAL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_HLINK_EXTERNAL_TYPE))
+
GnmHLink *gnm_sheet_hlink_find (Sheet const *sheet, GnmCellPos const *pos);
GType gnm_hlink_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]