aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorSebastian Egbers <sebastian@egbers.info>2012-06-26 08:33:41 +0200
committerSebastian Egbers <sebastian@egbers.info>2012-06-26 08:33:41 +0200
commit0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381 (patch)
tree8f38f64f6239f1c132b0e2118a4a9b42ba801752 /include/bb2diaspora.php
parent8c251aebc77a6daacfe20598fc861df4c243a726 (diff)
parenta4b407eb54c67a0c9b8137b44fbd20b43eccb224 (diff)
downloadvolse-hubzilla-0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381.tar.gz
volse-hubzilla-0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381.tar.bz2
volse-hubzilla-0f0fb2e2f3b9819e4f1b65c3ea1b96e78c008381.zip
Merge branch 'master' of https://github.com/friendica/friendica
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index ac693127b..25edb28d7 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -109,20 +109,22 @@ function bb2diaspora($Text,$preserve_nl = false) {
// "<li>" into a deeper nested element until it crashes. So pre-format
// the lists as Diaspora lists before sending the $Text to bbcode()
//
- // Note that regular expressions are really not suitable for parsing
- // text with opening and closing tags, so nested lists may make things
- // wonky
+ // Note that to get nested lists to work for Diaspora, we would need
+ // to define the closing tag for the list elements. So nested lists
+ // are going to be flattened out in Diaspora for now
$endlessloop = 0;
- while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) && (++$endlessloop < 20)) {
+ while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) &&
+ (strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) &&
+ (strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) {
$Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
$Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=I\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=a\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=A\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
+ $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text);
+ $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text);
}
- $Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text);
- $Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text);
// Convert it to HTML - don't try oembed
$Text = bbcode($Text, $preserve_nl, false);