Avatar

A proposal for making the parent entry visible when replying (Features)

by Micha ⌂, Wednesday, August 17, 2022, 14:17 (589 days ago) @ Auge

Hello,

So yes, the feature in the SelfHTML-forum is made with JavaScript but maybe not with Ajax/Fetch.
To complete the description: this doesn't include code highlightning (because it is made on the server side (PHP lib GesHi)) but it should be able to parse the rest of the BB-codes.

At SELFHTML, syntax is highlighted in the preview. So, yes, it is possible to convert Geshi to JavaScript but I cannot believe that redundant code (PHP and JS) is used. So, I think the code is generated by the server and added via JavaScript. However, this is not the point for the proposal but maybe for the implementation...

[1]: I personally don't like the list implementation because it adds <br /> after closing </li>. This seems to be a limitation of the BB-code-parser-class or a misconfiguration

Maybe it is incomplete. If one compares the example code given in the documentation and our implementation there are some differences.

Documentation:

$bbcode->addParser ('list', 'bbcode_stripcontents');
$bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => '<ul>', 'end_tag' => '</ul>'),
                  'list', array ('block', 'listitem'), array ());
$bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '<li>', 'end_tag' => '</li>'),
                  'listitem', array ('list'), array ());
$bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
$bbcode->setCodeFlag ('*', 'paragraphs', true);
$bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
$bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag ('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);

our implementation

  $bbcode->addParser ('list', 'bbcode_stripcontents');
  $bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => '<ul>', 'end_tag' => '</ul>'), 'list', array ('block', 'listitem', 'quote', 'rtl', 'ltr'), array ());
  $bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
  $bbcode->setCodeFlag ('list', 'closetag.after.newline', BBCODE_NEWLINE_IGNORE);
  $bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
  $bbcode->setCodeFlag ('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
  $bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '<li>', 'end_tag' => '</li>'), 'listitem', array ('list'), array ());
  $bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
  // $bbcode->setCodeFlag ('*', 'paragraphs', true);

/Micha

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


Complete thread:

 RSS Feed of thread