From 2965a981b7ec22866fbdf2d567d87e2d068d3617 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 31 Jul 2015 16:04:08 -0400
Subject: [PATCH] Allow to search and import missing PGP pubkeys from keyservers using Publickey.js
---
program/lib/Roundcube/rcube_text2html.php | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/program/lib/Roundcube/rcube_text2html.php b/program/lib/Roundcube/rcube_text2html.php
index 0afc6d1..5c240d5 100644
--- a/program/lib/Roundcube/rcube_text2html.php
+++ b/program/lib/Roundcube/rcube_text2html.php
@@ -1,6 +1,6 @@
<?php
-/**
+/*
+-----------------------------------------------------------------------+
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2008-2014, The Roundcube Dev Team |
@@ -45,20 +45,23 @@
*/
protected $config = array(
// non-breaking space
- 'space' => "\xC2\xA0",
+ 'space' => "\xC2\xA0",
// enables format=flowed parser
'flowed' => false,
// enables wrapping for non-flowed text
- 'wrap' => true,
+ 'wrap' => true,
// line-break tag
- 'break' => "<br>\n",
+ 'break' => "<br>\n",
// prefix and suffix (wrapper element)
- 'begin' => '<div class="pre">',
- 'end' => '</div>',
+ 'begin' => '<div class="pre">',
+ 'end' => '</div>',
// enables links replacement
- 'links' => true,
+ 'links' => true,
// string replacer class
'replacer' => 'rcube_string_replacer',
+ // prefix and suffix of unwrappable line
+ 'nobr_start' => '<span style="white-space:nowrap">',
+ 'nobr_end' => '</span>',
);
@@ -277,10 +280,10 @@
// replace HTML special characters
$text = strtr($text, $table);
- $nbsp = $this->config['space'];
-
// replace some whitespace characters
$text = str_replace(array("\r", "\t"), array('', ' '), $text);
+
+ $nbsp = $this->config['space'];
// replace spaces with non-breaking spaces
if ($is_flowed) {
@@ -299,9 +302,13 @@
$text = $copy;
}
- else {
- // make the whole line non-breakable
- $text = str_replace(array(' ', '-', '/'), array($nbsp, '-⁠', '/⁠'), $text);
+ // make the whole line non-breakable if needed
+ else if ($text !== '' && preg_match('/[^a-zA-Z0-9_]/', $text)) {
+ // use non-breakable spaces to correctly display
+ // trailing/leading spaces and multi-space inside
+ $text = str_replace(' ', $nbsp, $text);
+ // wrap in nobr element, so it's not wrapped on e.g. - or /
+ $text = $this->config['nobr_start'] . $text . $this->config['nobr_end'];
}
return $text;
--
Gitblit v1.9.1