PDA

View Full Version : Syntax highlight in forum [Code] posts



ErosOlmi
15-02-2006, 13:58
We have changed pnPhpBB forum source code in order to add syntax inside posted code. Before code block was all the same color.

An example of colored syntax:


[color=#0000FF]FUNCTION Factorial(InVal AS QUAD) AS EXT
LOCAL i AS QUAD
LOCAL r AS QUAD

r = 1
FOR i = 2 TO InVal
r = r * i
NEXT
FUNCTION = r

END FUNCTION


FUNCTION RecursiveExample(n AS NUMBER, MaxRecurse AS NUMBER) AS EXT
DIM s AS STRING VALUE REPEAT$(1000, "1")

IF n >= MaxRecurse THEN
FUNCTION = n
EXIT FUNCTION
ELSE
INCR n
FUNCTION = RecursiveExample(n, MaxRecurse)
END IF

END FUNCTION

DIM n AS NUMBER
n = 16
DIM f AS EXT = factorial(n)

MSGBOX(0, "Factorial of " + n + " = " + f)
MSGBOX(0, "I've called a recursive function " + RecursiveExample(1, 100) + " times")

DIM msg AS STRING
DIM count AS LONG

FOR count = 1 TO 64
msg = msg + FORMAT$(Count,"000") & " [" + FORMAT$(2^count,"#0") + "]"
IF MOD(count,2) = 0 THEN
msg = msg + CRLF
ELSE
msg = msg + " "
END IF
NEXT
MSGBOX(0, "From 2^1 to 2 ^ 64:\n" + msg)
MSGBOX 0, "RNDF:" & RNDF(10,20)

We have also add a new option into thinAir IDE that will allow you to automatically produce BBCodes from a script. New thinAir option is under menu "Tools/BBCode to clipboard". Selected script text (or full script text in case of no selection) will be parsed and colored syntax put into computer clipboard. Then you will be able to directly paste inside forum posts.

We hope you will like it. Just wait for the next thinBasic 1.0.9.2 update.

Regards
Eros

Petr Schreiber
15-02-2006, 21:07
Hi,

what a surprise !
I like this new feature a lot !


Thanks,
Petr

catventure
15-02-2006, 21:31
I agree.

This is a very handy feature to have in ThinAir.

Regards,
catventure.

ErosOlmi
16-02-2006, 12:57
We take care of our users :D