Virtual BBCode
Posted: Wed Nov 23, 2011 1:45 am
For fun, I decided to expand the BBCODE possibilities,
even though this is currently make-believe.
'Virtual BBCode' is an idea I invented to describe
a set of commands or combinations that don't yet exist,
or that are impossible.
Someone can design a program that
would read in anomalous BBCode from a text file.
Then this program would 'translate' that code into
equivalent code that really works for this forum.
So, for example, the user types in the extended BBCODE into a text file (.TXT);
then the special program reads the text file, and creates a new output text file,
which can then be pasted to forum posts.
Some popular examples of anomalous (irregular) code:
Line 1:
[color=blue]..text A..[color=red]..text B..[/color]..text C..[color=cyan]..text D..[/color]..text E..[/color]
Line 2:
[color=red]..text F..[b]..text G..[/color]..text H..[/b]
Line 3:
[size=9]..text I..[size=12]..text J..[/size]..text K..[/size]
Line 4:
[b]..text L..[b]..text M..[/b]..text N..[/b]
Line 5:
[b]..text O..[unbold]..text P..[/unbold]..text Q..[/b]
Line 6:
[u]..text R..[i]..text S..[b]..text T..[/i]..text U..[/u]..text V..[/b]..text V2..
Line 7:
[size=10]..text W..[size=11]..text X..[size=12]..text Y..[/size]..text Z..[/size]..text Z2..[/size]
Line 8:
[size=18][color=#784522][b]..text A1..[/size][/color][/b]
The correct output should be:
( I let the BBcodes appear for here for demonstrations purposes, so that your eye can follow the logic. )
Line 1:
[color=blue]..text A..[color=red]..text B..[/color]..text C..[color=cyan]..text D..[/color]..text E..[/color]
Line 2:
[color=red]..text F..[b]..text G..[/color]..text H..[/b]
Line 3:
[size=9]..text I..[size=12]..text J..[/size]..text K..[/size]
Line 4:
[b]..text L..[b]..text M..[/b]..text N..[/b]
Line 5:
[b]..text O..[unbold]..text P..[/unbold]..text Q..[/b]
Line 6:
[u]..text R..[i]..text S..[b]..text T..[/i]..text U..[/u]..text V..[/b]..text V2..
Line 7:
[size=10]..text W..[size=11]..text X..[size=12]..text Y..[/size]..text Z..[/size]..text Z2..[/size]
Line 8:
[size=18][color=#784522][b]..text A1..[/size][/color][/b]
My comments:
In general, all commands should be able to be nested.
In the case of Line 1, every time that a color function is encountered, the previous color (if any)
is 'saved' in memory (remaining dormant), and is activated again when the current
color encounters its termination command, [/color] .
The logic here would involve using memory stacks for many BBCode functions, using LIFO logic, (last in, first out).

In the case of Lines 2 and 6, it shouldn't matter what order the [color=], [u], [i], [b] is in.
All that matters is that the statement is eventually balanced with an equal number of [color=], [u], [i], [b]
towards the right side.
In reality, Lines 1 to 8 show up as follows: (not the way it should)
Line 1:
..text A....text B....text C....text D....text E..
Line 2:
..text F....text G....text H..
Line 3:
..text I....text J....text K..
Line 4:
..text L....text M....text N..
Line 5:
..text O..[unbold]..text P..[/unbold]..text Q..
Line 6:
..text R....text S....text T....text U....text V..
Line 7:
..text W....text X....text Y....text Z....text Z2..
Line 8:
..text A1.. (Line 8 is an exception and behaves properly. )
-----------------------------------------------------------------------
Some potential BBcode additions:
; set a variable A with RGB color values. Variable 'A' can be assumed to be a special type with 3 fields.
setColormem(A,"RGB", 101010, 223344, 440033);
; set a variable B with HSV color values.
setColormem(B,"HSV", 101010, 223344, 440033);
; set a variable C with a hex color value.
setColormem(C,"hex", #55AA44);
;
; RGB and HSV are some of the different methods to describe colors,
; each method of computing color values has its own +'s and -'s
; HSV = (hue, saturation, value),
; RGB = (red, green, blue)
; It's rather easy to transform between RGB, HSV, and hex.
; References:
; http://web.forret.com/tools/color.asp
; http://en.wikipedia.org/wiki/HSL_and_HSV
; The following fictional command would graduate the colors across a statement,
; starting with color variable 'A' and ending with color variable 'B'
; In other words, each letter would gradually change in color according to its
; position, the optional "HSV" or "RGB" variable would tell which computation method
; to use:
[colorspan=A,B,"HSV"]...Toto, I don't think we're in wonderland anymore!...[/colorspan]
; It would be painful to type and compute [color=######]x[/color] statements
; for a collection of 30+ letters (& words), so an automatic function like
; [colorspan=...] could be a great idea.
;
; If anyone can think of some irregular code that I missed,
; or they've got ideas for new BBCode functions, then list them here.
;
; Please note that if you quote this, that it will dramatically alter the formatting.
; To show demonstration BBCode that does not become active, you can use a Unicode bracket, [ = [ .
even though this is currently make-believe.
'Virtual BBCode' is an idea I invented to describe
a set of commands or combinations that don't yet exist,
or that are impossible.
Someone can design a program that
would read in anomalous BBCode from a text file.
Then this program would 'translate' that code into
equivalent code that really works for this forum.
So, for example, the user types in the extended BBCODE into a text file (.TXT);
then the special program reads the text file, and creates a new output text file,
which can then be pasted to forum posts.
Some popular examples of anomalous (irregular) code:
Line 1:

Line 2:

Line 3:

Line 4:

Line 5:

Line 6:

Line 7:

Line 8:

The correct output should be:
( I let the BBcodes appear for here for demonstrations purposes, so that your eye can follow the logic. )
Line 1:

Line 2:

Line 3:

Line 4:

Line 5:

Line 6:

Line 7:

Line 8:

My comments:









In reality, Lines 1 to 8 show up as follows: (not the way it should)
Line 1:

Line 2:

Line 3:

Line 4:

Line 5:

Line 6:

Line 7:

Line 8:

-----------------------------------------------------------------------
Some potential BBcode additions:





























