mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 00:45:14 +02:00
New version of markdown. Playing with stylesheet. Testing line breaks.
This commit is contained in:
parent
064c843119
commit
b6d7777226
3 changed files with 404 additions and 504 deletions
|
@ -8,7 +8,7 @@ require_once('include/html2bbcode.php');
|
|||
|
||||
// we don't want to support a bbcode specific markdown interpreter
|
||||
// and the markdown library we have is pretty good, but provides HTML output.
|
||||
// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
|
||||
// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
|
||||
// and then clean up a few Diaspora specific constructs.
|
||||
|
||||
function diaspora2bb($s) {
|
||||
|
@ -35,17 +35,16 @@ function diaspora2bb($s) {
|
|||
|
||||
$s = str_replace('#','#',$s);
|
||||
|
||||
// Again: too many new lines
|
||||
//$s = str_replace("\n",'<br />',$s);
|
||||
$s = str_replace("\n",'<br />',$s);
|
||||
|
||||
$s = html2bbcode($s);
|
||||
// $s = str_replace('*','*',$s);
|
||||
|
||||
|
||||
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s);
|
||||
$s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s);
|
||||
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);
|
||||
$s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s);
|
||||
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s);
|
||||
$s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s);
|
||||
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);
|
||||
$s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s);
|
||||
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2$3$4[/url]',$s);
|
||||
// remove duplicate adjacent code tags
|
||||
$s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue