Added h1 thru h6 bbcodes.
This commit is contained in:
parent
d423c53cde
commit
5760e15df5
8 changed files with 121 additions and 0 deletions
31
assets/css/misuzu/bb.css
Normal file
31
assets/css/misuzu/bb.css
Normal file
|
@ -0,0 +1,31 @@
|
|||
.bb-h1, .bb-h2,
|
||||
.bb-h3, .bb-h4,
|
||||
.bb-h5, .bb-h6 {
|
||||
font-weight: 700;
|
||||
line-height: 1.5em;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin-bottom: .25em;
|
||||
}
|
||||
|
||||
.bb-h1 {
|
||||
font-size: 2em;
|
||||
border-bottom: 1px solid var(--accent-colour);
|
||||
}
|
||||
.bb-h2 {
|
||||
font-size: 1.5em;
|
||||
border-bottom: 1px solid var(--accent-colour);
|
||||
}
|
||||
.bb-h3 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
.bb-h4 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.bb-h5 {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
.bb-h6 {
|
||||
font-size: 0.85em;
|
||||
color: var(--accent-colour);
|
||||
}
|
|
@ -19,6 +19,12 @@ class BBCodeParser implements ParserInterface {
|
|||
new Tags\VideoTag,
|
||||
|
||||
// Basic markup
|
||||
new Tags\H1Tag,
|
||||
new Tags\H2Tag,
|
||||
new Tags\H3Tag,
|
||||
new Tags\H4Tag,
|
||||
new Tags\H5Tag,
|
||||
new Tags\H6Tag,
|
||||
new Tags\BoldTag,
|
||||
new Tags\ItalicsTag,
|
||||
new Tags\UnderlineTag,
|
||||
|
|
14
src/Parsers/BBCode/Tags/H1Tag.php
Normal file
14
src/Parsers/BBCode/Tags/H1Tag.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
|
||||
|
||||
final class H1Tag extends BBCodeSimpleTag {
|
||||
public function getPattern(): string {
|
||||
return "/\[h1\](.+?)\[\/h1\]/";
|
||||
}
|
||||
|
||||
public function getReplacement(): string {
|
||||
return '<h1 class="bb-h1">$1</h1>';
|
||||
}
|
||||
}
|
14
src/Parsers/BBCode/Tags/H2Tag.php
Normal file
14
src/Parsers/BBCode/Tags/H2Tag.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
|
||||
|
||||
final class H2Tag extends BBCodeSimpleTag {
|
||||
public function getPattern(): string {
|
||||
return "/\[h2\](.+?)\[\/h2\]/";
|
||||
}
|
||||
|
||||
public function getReplacement(): string {
|
||||
return '<h2 class="bb-h2">$1</h2>';
|
||||
}
|
||||
}
|
14
src/Parsers/BBCode/Tags/H3Tag.php
Normal file
14
src/Parsers/BBCode/Tags/H3Tag.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
|
||||
|
||||
final class H3Tag extends BBCodeSimpleTag {
|
||||
public function getPattern(): string {
|
||||
return "/\[h3\](.+?)\[\/h3\]/";
|
||||
}
|
||||
|
||||
public function getReplacement(): string {
|
||||
return '<h3 class="bb-h3">$1</h3>';
|
||||
}
|
||||
}
|
14
src/Parsers/BBCode/Tags/H4Tag.php
Normal file
14
src/Parsers/BBCode/Tags/H4Tag.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
|
||||
|
||||
final class H4Tag extends BBCodeSimpleTag {
|
||||
public function getPattern(): string {
|
||||
return "/\[h4\](.+?)\[\/h4\]/";
|
||||
}
|
||||
|
||||
public function getReplacement(): string {
|
||||
return '<h4 class="bb-h4">$1</h4>';
|
||||
}
|
||||
}
|
14
src/Parsers/BBCode/Tags/H5Tag.php
Normal file
14
src/Parsers/BBCode/Tags/H5Tag.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
|
||||
|
||||
final class H5Tag extends BBCodeSimpleTag {
|
||||
public function getPattern(): string {
|
||||
return "/\[h5\](.+?)\[\/h5\]/";
|
||||
}
|
||||
|
||||
public function getReplacement(): string {
|
||||
return '<h5 class="bb-h5">$1</h5>';
|
||||
}
|
||||
}
|
14
src/Parsers/BBCode/Tags/H6Tag.php
Normal file
14
src/Parsers/BBCode/Tags/H6Tag.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Misuzu\Parsers\BBCode\Tags;
|
||||
|
||||
use Misuzu\Parsers\BBCode\BBCodeSimpleTag;
|
||||
|
||||
final class H6Tag extends BBCodeSimpleTag {
|
||||
public function getPattern(): string {
|
||||
return "/\[h6\](.+?)\[\/h6\]/";
|
||||
}
|
||||
|
||||
public function getReplacement(): string {
|
||||
return '<h6 class="bb-h6">$1</h6>';
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue