ID:134883
 
Its kinda hard to display code in a blog, because for some reason ti likes to delete all the spaces at the beginning of the line.

Also, could we possibly use DM tages in the blog?
Jamesburrow wrote:
Its kinda hard to display code in a blog, because for some reason ti likes to delete all the spaces at the beginning of the line.

Also, could we possibly use DM tages in the blog?

Would definitely be nice, but I'm not smart enough for that, so will have to be on Mike's list...:)
On a related note, what about <dm> tags in the bwicki? It's probably already been suggested before, but now that my DM syntax highlighter has been released, it would be extremely easy.
In response to Wizkidd0123
By the way, your DM syntax highlighter doesn't always work.

Try putting this in your highlighter and you'll see what I mean.

var/list/dm_keywords = list("var","tmp","in","goto","global","static","return","del","do","if","else","continue",\
"const","while","break","switch","new","as","for","set","verb","proc","arg")

proc/get_dm_keywords(text)
var/list/result = list()
for(var/keyword in dm_keywords)
var/keyword_pos=findText(text, keyword)
while(keyword_pos)
if((keyword_pos < 2 || !isletter_or_underscore(copytext(text,keyword_pos-1,keyword_pos))) && (length(text) < keyword_pos+length(keyword) || !isletter_or_underscore(copytext(text,keyword_pos+length(keyword),keyword_pos+length(keyword)+1))))
result["[keyword_pos]"] = keyword
keyword_pos=findText(text, keyword, keyword_pos+1)
return result

proc/isletter_or_underscore(char)
var/ascii_char = text2ascii(char)
if(ascii_char >= 97 && ascii_char <= 122) return TRUE //lower
if(ascii_char >= 65 && ascii_char <= 90) return TRUE //upper
if(char == "_") return TRUE
In response to DeathAwaitsU
I've just fixed the bug and updated the library. Thanks for reporting that!
In response to Wizkidd0123
Wizkidd0123 wrote:
On a related note, what about <dm> tags in the bwicki? It's probably already been suggested before, but now that my DM syntax highlighter has been released, it would be extremely easy.

I'm giving Nadrew access to the Bwicki source, so he can integrate it if you talk him into it...:)

I'll put it on your list to port your code into Perl for syntax highlighting there, if Mike doesn't beat me to it.
In response to Wizkidd0123
Why not have lots of diffrent languages, not just DM? How about a c++ highlighter, or a php highlighter? Both of those are just about as simple in syntax as DM
In response to Wizkidd0123
Are you sure? It's still coming out weird for me.
In response to Scoobert
Because then you have to write them all. Which is annoying. =)

There are lexing tools that can use a "context-free grammar" (a simple description language) to do syntax highlighting, but AFAIK nobody has ever made a context-free grammar for DM. Could be an interesting project for someone. =) If we did have a context-free grammar thing working for DM, it would be easier to incorporate other context-free grammars into the forum/blog/whatever. In English, that means that C++/PHP/etc. would become more plausible. =)

There are no such lexing tools written for DM, however, so the bwicki would be out of luck... unless someone wants to write one!
In response to DeathAwaitsU
DeathAwaitsU wrote:
Are you sure? It's still coming out weird for me.

Yes -- it comes out okay for me. Have you updated? If so, try uninstalling the library, and then downloading it again. Maybe it didn't update properly.