BBCode Workarounds - CustodesTechnologia/System Wiki

Bolter and Chainsword

BBCode Work

The upgraded site is configured to honor BBCodes. But, it doesn't appear that the default configuration of the software (even when the BBcode enabled switch is on), that custom BBCodes are honored. So far, they are not. There's going to be some additional research in that regard.

Nevertheless, the updated software of the site does appear to let us configure new "buttons" that appear in the toolbar of the Editor.

In that case, using custom toolbar buttons, it's fairly straightforward to add new "tags" so to speak in that -- we can alter the format of selected content in the editor session to whatever the custom HTML is aligned with the custom button.

I've added one for an experiment.

The "caslonskullheader" concept.

There is already a BBCode defined in the DB for the custom BBcode caslonskullheader. That markup renders a header bar with an icon to the left and object text to the right with a user-defined background color.

The legacy custom BBCode relied on two elements:

  1. It relies on a hq2.gif icon to be the skull icon on the left. That is static content.
  2. It relies on some PHP code to generate text with a specific font (via PHP)

First, we're not going to do that anymore -- we're not going to generate "text in a font" via PHP. If you want to deploy a unique font, find the font on fonts.google.com and we'll apply it to a style by name and then refer to that style by name. So, no more PHP-dynamic text generation using font-files.

Anyway, the button in question has this definition:

<div style='background-color:#{option}; 
background-image:url("/customicons/hq2.gif");
background-repeat: no-repeat; 
background-position: 8px 6px; 
padding: 12px 8px 12px 8px; 
border: 1px solid #DDD; 
margin-left: 0 auto; 
text-align: left; 
color: #fff; 
text-indent:50px; 
font-size:130%; 
font-family: "Libre Caslon Text", serif;'>
{content}
</div>

What happens here is that the hq2.gif is used as the icon to the left as the original custom BBCode used. But the text (aka {content} placeholder) is going to be applied with the font-family Libre Caslon Text, serif. That's simple and puts the work on the CLIENT not the server to render.

Any number of custom formatting can be acheived this way, but the issue is that it's via buttons in the toolbar of the editor.

It appears that default (standard) BBCodes are honored as they are typed in by the user. Eg:

[b] I am bold [/b]

can be entered by the user and it will embolden the text in the final post. Interestingly, once that post is submitted, the user cannot ever again see the BBcode that produced that format change. It'll render as bold text even in the editor after the post is made.

The upshot is this: Yes, users can enter some BBCodes (and a list will be made). But unique custom BBCodes are going to be ruled out unless further research proves otherwise.

I will strenuously insist that we do away with custom BBCodes as we've come to know them. They are not easily handled in the platform and produce a wasted amount of processing on the SERVER side each time they are leveraged. Insist that the CLIENT does as much work as possible to render the output. Strive to make it that the server limits as much as possible repetitive processing just to produce HTML on the SERVER side.

What is going to need to occur is to sift through each post/message/etc.. in the legacy database and convert standard BBCodes to the CSS based rendering of those intents in the DB. For the custom BBCodes -- that's also going to be necessary, but it's a one-way process. Once they are converted, the editor (user) will not be able to ascertain the literal BBCode that was used to produce the CSS/HTML for any of the BBCode used, even if part of the default set of BBCodes used across industry.

Brace for it. It is the way.

⚠️ **GitHub.com Fallback** ⚠️