[evolution] EHTMLEditorView - Refactor the code that triggers the surround of links with anchor elements
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditorView - Refactor the code that triggers the surround of links with anchor elements
- Date: Mon, 30 Jun 2014 13:05:06 +0000 (UTC)
commit bea93f95cb1ec338c3efff95407e6476996ec35d
Author: Tomas Popela <tpopela redhat com>
Date: Mon Jun 30 14:31:25 2014 +0200
EHTMLEditorView - Refactor the code that triggers the surround of links with anchor elements
And add www to patterns.
e-util/e-html-editor-view.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 45dc747..56ec293 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3362,6 +3362,13 @@ replace_to_nbsp (const GMatchInfo *info,
return FALSE;
}
+static gboolean
+surround_links_with_anchor (const gchar *text)
+{
+ return (strstr (text, "http") || strstr (text, "ftp") ||
+ strstr (text, "www") || strstr (text, "@"));
+}
+
/* This parses the HTML code (that contains just text, and BR elements)
* into paragraphs.
* HTML code in that format we can get by taking innerText from some element,
@@ -3480,9 +3487,7 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
NULL);
g_free (truncated);
- if (strstr (rest_to_insert, "http") ||
- strstr (rest_to_insert, "ftp") ||
- strstr (rest_to_insert, "@")) {
+ if (surround_links_with_anchor (rest_to_insert)) {
truncated = g_regex_replace_eval (
regex_links,
rest_to_insert,
@@ -3543,9 +3548,7 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
NULL);
g_free (truncated);
- if (strstr (rest_to_insert, "http") ||
- strstr (rest_to_insert, "ftp") ||
- strstr (rest_to_insert, "@")) {
+ if (surround_links_with_anchor (rest_to_insert)) {
truncated = g_regex_replace_eval (
regex_links,
rest_to_insert,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]