aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-01-23 16:29:30 -0800
committerFriendika <info@friendika.com>2011-01-23 16:29:30 -0800
commit00d2b583588ea1c55e9b478809e8041d6ba98639 (patch)
tree07ad38acb1beae1bce4bc56416cc64c8ad95abc8
parent1460fc0d710ce14d6c746eb06fc8f3a5372493c2 (diff)
downloadvolse-hubzilla-00d2b583588ea1c55e9b478809e8041d6ba98639.tar.gz
volse-hubzilla-00d2b583588ea1c55e9b478809e8041d6ba98639.tar.bz2
volse-hubzilla-00d2b583588ea1c55e9b478809e8041d6ba98639.zip
fix a few issues with code blocks, ignore tags within blocks, fold multi-line blocks to one, also turn html br into two LFs.
-rw-r--r--boot.php5
-rw-r--r--mod/item.php4
-rw-r--r--tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js5
-rw-r--r--tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css12
4 files changed, 24 insertions, 2 deletions
diff --git a/boot.php b/boot.php
index 05b33abd6..45fd8d16f 100644
--- a/boot.php
+++ b/boot.php
@@ -1687,6 +1687,11 @@ function activity_match($haystack,$needle) {
if(! function_exists('get_tags')) {
function get_tags($s) {
$ret = array();
+
+ // ignore anything in a code block
+
+ $s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
+
if(preg_match_all('/([@#][^ \x0D\x0A,:?]*)([ \x0D\x0A,:?]|$)/',$s,$match)) {
foreach($match[1] as $match) {
if(strstr($match,"]")) {
diff --git a/mod/item.php b/mod/item.php
index f964e7737..feef7c95f 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -165,7 +165,11 @@ function item_post(&$a) {
}
}
+ /**
+ * Fold multi-line [code] sequences
+ */
+ $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body);
/**
* Look for any tags and linkify them
diff --git a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
index 8728f0c0f..f12975ba2 100644
--- a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
+++ b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js
@@ -64,8 +64,8 @@
rep(/<u>/gi,"[u]");
rep(/<blockquote[^>]*>/gi,"[quote]");
rep(/<\/blockquote>/gi,"[/quote]");
- rep(/<br \/>/gi,"\n");
- rep(/<br\/>/gi,"\n");
+ rep(/<br \/>/gi,"\n\n");
+ rep(/<br\/>/gi,"\n\n");
rep(/<br>/gi,"\n");
rep(/<p>/gi,"");
rep(/<\/p>/gi,"\n");
@@ -98,6 +98,7 @@
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");
+// rep(/\[\/code\]\s*\[code\]/gi,"<br />"); // fold multiline code
rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");
diff --git a/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css b/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css
index 36f38aba2..444063a82 100644
--- a/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css
+++ b/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/content.css
@@ -18,6 +18,18 @@ del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
abbr {border-bottom:1px dashed #CCC; cursor:help}
+code {
+ font-family: Courier, monospace;
+ white-space: pre;
+ display: block;
+ overflow: auto;
+ border: 1px solid #444;
+ background: #EEE;
+ color: #444;
+ padding: 10px;
+ margin-top: 20px;
+}
+
/* IE */
* html body {