Avatar

Please add BBcode for RTL in version 2.5 (General)

by Micha ⌂, Saturday, March 14, 2020, 16:24 (1511 days ago) @ shian

Hi,

1) If the forum is in LTR direction and one wants to insert RTL text, we need:

<p dir="rtl"> ... </p>

2) If the forum is in RTL direction and one wants to insert LTR text, we need:

<p dir="ltr"> ... </p>

This way we cover all scenarios.

I changed the functions.inc.php and just added

  $bbcode->addCode ('rtl', 'simple_replace', null, array ('start_tag' => '<div dir="rtl">', 'end_tag' => '</div>'), 'rtl', array ('block','rtl'), array ());
  $bbcode->setCodeFlag ('rtl', 'paragraphs', true);
  $bbcode->setCodeFlag ('rtl', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
  $bbcode->setCodeFlag ('rtl', 'closetag.after.newline', BBCODE_NEWLINE_IGNORE);
  $bbcode->setCodeFlag ('rtl', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
  $bbcode->setCodeFlag ('rtl', 'closetag.before.newline', BBCODE_NEWLINE_DROP);

Now, it is possible to use the new BB code

[rtl]Some Text[/rtl]

as a block element (<div>-Element). You can try this modification in my forum - please use the preview option only ;-)

Does it works as expected?

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences


Complete thread:

 RSS Feed of thread