diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-06-30 20:31:25 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-06-30 20:36:24 +0800 |
commit | bea93f95cb1ec338c3efff95407e6476996ec35d (patch) | |
tree | 995669fd83e103f0f6569d9ad246c845163c5c70 | |
parent | 277fd3307558eebeba240161bd600df32f65b700 (diff) | |
download | gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.tar gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.tar.gz gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.tar.bz2 gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.tar.lz gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.tar.xz gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.tar.zst gsoc2013-evolution-bea93f95cb1ec338c3efff95407e6476996ec35d.zip |
EHTMLEditorView - Refactor the code that triggers the surround of links with anchor elements
And add www to patterns.
-rw-r--r-- | 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 45dc747d67..56ec293b1a 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, |