diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-30 18:18:28 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-30 18:18:28 -0700 |
commit | d3cad5a651d32557d92457b347c0d67372d2482c (patch) | |
tree | 733ade8a68e6d39769468b1caaaa4a7282d9e6a5 /include | |
parent | 893ae17b99d1a1a720a58879e8075fc9bb1de087 (diff) | |
parent | 14229d0dd3205ea1e85d2c26d6c79bd68d19eda3 (diff) | |
download | volse-hubzilla-d3cad5a651d32557d92457b347c0d67372d2482c.tar.gz volse-hubzilla-d3cad5a651d32557d92457b347c0d67372d2482c.tar.bz2 volse-hubzilla-d3cad5a651d32557d92457b347c0d67372d2482c.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
Diffstat (limited to 'include')
-rw-r--r-- | include/markdown.php | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/markdown.php b/include/markdown.php index a20c0d8ba..1c42937b3 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -152,6 +152,7 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) { + function bb_to_markdown($Text) { /* @@ -161,6 +162,7 @@ function bb_to_markdown($Text) { $Text = preg_replace_callback('/#\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/[(zu)]rl\]/i', create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[3]);'), $Text); + $Text = preg_replace('/#\^\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text); // Converting images with size parameters to simple images. Markdown doesn't know it. @@ -173,17 +175,14 @@ function bb_to_markdown($Text) { $Text = bbcode($Text, $preserve_nl, false); // Markdownify does not preserve previously escaped html entities such as <> and &. - $Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text); // Now convert HTML to Markdown - $md = new HtmlConverter(); - $Text = $md->convert($Text); + $Text = html2markdown($Text); // It also adds backslashes to our attempt at getting around the html entity preservation for some weird reason. - $Text = str_replace(array('&\\_lt\\_;','&\\_gt\\_;','&\\_amp\\_;'),array('<','>','&'),$Text); // If the text going into bbcode() has a plain URL in it, i.e. @@ -204,4 +203,4 @@ function bb_to_markdown($Text) { return $Text; -}
\ No newline at end of file +} |