- Input Format. There is the format that you type into the text window on the posting.php screen.
- DB Format. This is the format in which it is maintained within the forum database.
- Display Format. This is the format in which it is rendered for visual presentation within the post.
A case in point for such processing is that many tags are supposed to paired like bookends, but the fact is that there is no guarantee that the posting will maintain correct paring, and in this case if you have an unimpaired for example the lead is displayed as is. So the message_parse function which is responsible for converting the post from input format to DB format scans the post structure and validates all tag pairs. A UID is created for each tag pair so that a bold markup might be stored on the database in the format [b:36q9mv6g]Some Text to Be Bolded[/b:36q9mv6g]. The reason for this is that it makes the paring of such tags and their transformation into HTML a straightforward substitution task by the viewposting.php code. Moreover, if the user decides to edit or to quote an existing post and then such hidden markup can easily backed out for display in the text editing box for the post.
Hence each markup type within the BBCode needs to have functionality in three places:
- to parse and mark-up raw BBCode text
- to transform the marked up BBCode into HTML for insertion in the display post
- to strip out the markings and restore the raw BBCode text for edit and quoting.
Code: Select all
block markup functionality proposed in [b]bbGeshi[/b] mod. This doesn't follow the above practice. There is minimal be processing done in the [b]message_parse[/b] phase and most is left to the [b]viewpost.php[/b] processing. This means that there are a number of problems with its handling of constructs such as URLs which should be detected during message parse, and it also places quite the processing load on the server during the views.
But at least getting to grips with this is helping me to work out how to add usable improvements to BBcode :-)