ID:278528
 
Hey guys, how complicated would it be to immitate the way byond's dm tags work and how would one go about doing that for external byond related forums and documents.

thanks in advance
Syntax Highlighter
DM Syntax Highlighter

These are two libraries in DM that can do it for a DM project.
If you can port this code to another language on whatever external thing you're using, then you'll get what you want.
You can find a javascript-based syntax highlighter that supports a language that's similar to DM (or customizable enough that you can make it recognize DM's keywords).
In response to Forum_account
Forum_account wrote:
You can find a javascript-based syntax highlighter that supports a language that's similar to DM (or customizable enough that you can make it recognize DM's keywords).

What would be close? PHP has some relevant highlighing on for while var etc
In response to A.T.H.K
You can take a look at GeSHi, the generic syntax highlighter.
So far, it comes with the ability to highlight over 150 programming languages. It is also easy to add new languages to highlight as well, so I am currently working on a GeSHi language file for DM. I need it for a BYOND wiki project (ATHK, are you still going to work on that Developer program? It has been offline for a while now).

I will put the language file up online once it's finished, and if I decide it's good enough, I can submit it to the GeSHi developers officially for inclusion in the next release. The developers want to include as many languages with their program as they can find, so I'm sure they would like to add in DM as well.
In response to Multiverse7
Great I would love that get some real time syntax highlighting in the code area.

Also no I haven't had much time, it is up now.
In response to A.T.H.K
JavaScript is a good fit for DM. It has the same words for loops and it also uses "var" as a keyword. I can't think of many languages that just call them vars. The one thing you probably won't get is the highlighting for expressions embedded in strings (ex: using []).
In response to Forum_account
Very true... thanks
In response to A.T.H.K
A JavaScript syntax highlighter may be easier to use, but it may not be the best choice if you plan on embedding a wiki into the DM built-in browser.

Fortunately, GeSHi uses PHP, so there shouldn't be any problems. Here is the first version of the DM language file that I made, so feel free to use it anywhere you like.

It would be helpful if someone could test this out for me to make sure it works right.

Here is a good test to use:
arg
as
break
const
continue
del
do
else
for
global
goto
if
in
new
proc
return
set
static
switch
tmp
to
var
verb
while

//test

/*

test*/


() [] {} . / : ~ ! + - * % <> & ^ | ?

'test'
"test[test]"

#test


It is not perfect yet, but it's mostly finished. I am aware that it will not yet highlight the dark teal color found here:"test[test]" (brackets within quotation marks). I believe that in order for it to work, I would have to use what are called, "regular expressions", but I'm a bit confused about how they work. I am not very familiar with PHP, so it would be great if someone who does can help me out. I do not have administrative access to the wiki, so I don't believe I am able to upload files to it, and that's why I cannot test this myself without creating a whole website.
In response to Multiverse7
Would be better with a real-time syntax highlighter go JavaScript! :)