Browse Source

New version of markdown. Playing with stylesheet. Testing line breaks.

pull/45/head
root 9 years ago
parent
commit
b6d7777226
3 changed files with 404 additions and 504 deletions
  1. +6
    -7
      include/bb2diaspora.php
  2. +387
    -497
      library/markdown.php
  3. +11
    -0
      view/theme/vier/style.css

+ 6
- 7
include/bb2diaspora.php View File

@ -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('&#42;','*',$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);


+ 387
- 497
library/markdown.php
File diff suppressed because it is too large
View File


+ 11
- 0
view/theme/vier/style.css View File

@ -122,6 +122,17 @@
.next { background-position: -110px -60px;}
.tagged { background-position: -130px -60px;}
.attachtype {
display: block; width: 20px; height: 23px;
background-image: url('../../../images/content-types.png');
}
.type-video { background-position: 0px 0px; }
.type-image { background-position: -20px 0px; }
.type-audio { background-position: -40px 0px; }
.type-text { background-position: -60px 0px; }
.type-unkn { background-position: -80px 0px; }
.icon.drop, .icon.drophide {
float: left;
}


Loading…
Cancel
Save