Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Libraries/BBCodeForDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public function parseAudio($text)
/**
* Handles:
* - Centre (centre).
* - Right (right).
*/
public function parseBlockSimple($text)
{
foreach (['centre'] as $tag) {
foreach (['centre', 'right'] as $tag) {
$text = preg_replace(
"#\[{$tag}](.*?)\[/{$tag}\]#s",
"[{$tag}:{$this->uid}]\\1[/{$tag}:{$this->uid}]",
Expand Down
9 changes: 9 additions & 0 deletions app/Libraries/BBCodeFromDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public function parseCentre($text)
return $text;
}

public function parseRight($text)
{
$text = str_replace("[right:{$this->uid}]", "<div class='right'>", $text);
$text = str_replace("[/right:{$this->uid}]", '</div>', $text);

return $text;
}

public function parseCode($text)
{
return preg_replace(
Expand Down Expand Up @@ -372,6 +380,7 @@ public function toHTML()
$text = $this->parseAudio($text);
$text = $this->parseBold($text);
$text = $this->parseCentre($text);
$text = $this->parseRight($text);
$text = $this->parseInlineCode($text);
$text = $this->parseColour($text);
$text = $this->parseEmail($text);
Expand Down
18 changes: 18 additions & 0 deletions resources/css/bbcode.less
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@
font-size: inherit;
}

.right {
text-align: right;

img,
iframe,
audio,
video,
.js-audio--player,
.imagemap {
margin-left: auto;
margin-right: 0;
}

.bbcode-spoilerbox {
display: inline-block;
}
}

.unordered {
list-style-type: disc;
}
Expand Down