From: Michael Vogel Date: Sun, 1 Mar 2015 19:07:56 +0000 (+0100) Subject: New bbcode elements h1 to h6 for a better conversion of Diaspora content X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bf0f7c3d0aae1084f31e7a561e8281123b94f09f;p=friendica.git New bbcode elements h1 to h6 for a better conversion of Diaspora content --- diff --git a/include/bbcode.php b/include/bbcode.php index 1da9bf1d24..fa4fa72c7a 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -842,8 +842,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // removing multiplicated newlines if (get_config("system", "remove_multiplicated_lines")) { - $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n"); - $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]"); + $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n", + "\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n"); + $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]", + "[h1]", "[/h1]", "[h2]", "[/h2]", "[h3]", "[/h3]", "[h4]", "[/h4]", "[h5]", "[/h5]", "[h6]", "[/h6]"); do { $oldtext = $Text; $Text = str_replace($search, $replace, $Text); @@ -923,6 +925,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal $Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '$1', $Text); $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '$2', $Text); + // Check for headers + $Text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'

$1

',$Text); + $Text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'

$1

',$Text); + $Text = preg_replace("(\[h3\](.*?)\[\/h3\])ism",'

$1

',$Text); + $Text = preg_replace("(\[h4\](.*?)\[\/h4\])ism",'

$1

',$Text); + $Text = preg_replace("(\[h5\](.*?)\[\/h5\])ism",'
$1
',$Text); + $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'
$1
',$Text); + // Check for bold text $Text = preg_replace("(\[b\](.*?)\[\/b\])ism",'$1',$Text); diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 650bbdcae8..1021bcdf16 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -207,12 +207,19 @@ function html2bbcode($message) //node2bbcode($doc, 'tr', array(), "[tr]", "[/tr]"); //node2bbcode($doc, 'td', array(), "[td]", "[/td]"); - node2bbcode($doc, 'h1', array(), "\n\n[size=xx-large][b]", "[/b][/size]\n"); - node2bbcode($doc, 'h2', array(), "\n\n[size=x-large][b]", "[/b][/size]\n"); - node2bbcode($doc, 'h3', array(), "\n\n[size=large][b]", "[/b][/size]\n"); - node2bbcode($doc, 'h4', array(), "\n\n[size=medium][b]", "[/b][/size]\n"); - node2bbcode($doc, 'h5', array(), "\n\n[size=small][b]", "[/b][/size]\n"); - node2bbcode($doc, 'h6', array(), "\n\n[size=x-small][b]", "[/b][/size]\n"); + //node2bbcode($doc, 'h1', array(), "\n\n[size=xx-large][b]", "[/b][/size]\n"); + //node2bbcode($doc, 'h2', array(), "\n\n[size=x-large][b]", "[/b][/size]\n"); + //node2bbcode($doc, 'h3', array(), "\n\n[size=large][b]", "[/b][/size]\n"); + //node2bbcode($doc, 'h4', array(), "\n\n[size=medium][b]", "[/b][/size]\n"); + //node2bbcode($doc, 'h5', array(), "\n\n[size=small][b]", "[/b][/size]\n"); + //node2bbcode($doc, 'h6', array(), "\n\n[size=x-small][b]", "[/b][/size]\n"); + + node2bbcode($doc, 'h1', array(), "\n\n[h1]", "[/h1]\n"); + node2bbcode($doc, 'h2', array(), "\n\n[h2]", "[/h2]\n"); + node2bbcode($doc, 'h3', array(), "\n\n[h3]", "[/h3]\n"); + node2bbcode($doc, 'h4', array(), "\n\n[h4]", "[/h4]\n"); + node2bbcode($doc, 'h5', array(), "\n\n[h5]", "[/h5]\n"); + node2bbcode($doc, 'h6', array(), "\n\n[h6]", "[/h6]\n"); node2bbcode($doc, 'a', array('href'=>'/mailto:(.+)/'), '[mail=$1]', '[/mail]'); node2bbcode($doc, 'a', array('href'=>'/(.+)/'), '[url=$1]', '[/url]'); diff --git a/view/global.css b/view/global.css index 549e1216d2..0c6fb63209 100644 --- a/view/global.css +++ b/view/global.css @@ -125,4 +125,36 @@ blockquote.shared_content { .settings-heading a:after{ content: ' »'; -} \ No newline at end of file +} + +/* headers */ +h1, h2, h3, h4, h5, h6 { + margin: 10px 0px; + font-weight: normal; + line-height: normal; + text-rendering: optimizelegibility; +} + +h1 { + font-size: 38.5px; +} + +h2 { + font-size: 31.5px; +} + +h3 { + font-size: 24.5px; +} + +h4 { + font-size: 20.5px; +} + +h5 { + font-size: 16.5px; +} + +h6 { + font-size: 14.95px; +} diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 479fd348e2..779a194dd8 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -283,10 +283,6 @@ body { display: table; } -h4 { - font-size: 1.1em; -} - a { color: #36C; /* color: #3e3e8c; */ @@ -1202,10 +1198,6 @@ section.minimal { width: 350px; float: left; font-size: 12px; -}} - -h2 { - line-height: normal; } .wall-item-container .wall-item-content {