[code][/code] tags now support syntax hightlighting

Started by SleepKiller, March 02, 2014, 03:35:18 PM

Previous topic - Next topic
I thought the title was pretty descriptive. Yesterday I tested it out, assuming no issues arise it'll stay installed. Using it is really simple just change

[code][/code]
to
[code=lua][/code]


Of course lua isn't the only language supported. The developers of the mod say it supports over 200 languages. Here are a couple of examples.

Code from SKFunctions.lua
Code (lua) Select

--LogProgress
--Creates a log entry, the file path will need editing for your map.
-- String Bool
function LogProgress(s,n)

if(newlog == 0) then
writeto("addon\\skmc2\\iofiles\\log.txt")
write("Starting log. \nMap ID:")
write(mapID)
write("\n\n")
-- write(date("%c"))
-- write("\n")
newlog = 1
end


if(s == nil) then --Has anything actually been sent to the funtion?
appendto("addon\\skmc2\\iofiles\\log.txt")
write("Bad argument sent to LogProgress, requires string or number. Exiting function.")
write("\n\n")
flush()
else
appendto("addon\\skmc2\\iofiles\\log.txt")
write(s)

if(n >= 1) then
write("\n\n")
end

flush()
end

end


Code from schMEe.au3
Code (AutoIT) Select
Func _MSH_get_parent_index($iThisTag)
For $iParent_index = $iThisTag To 1 Step -1
If _MSH_TagIsPossibleChildOfParent($aMSHTagList[$iParent_index], $aMSHTagList[$iThisTag]) Then ExitLoop
Next
Return $iParent_index
EndFunc   ;==>_MSH_get_parent_index

March 02, 2014, 03:55:42 PM #1 Last Edit: March 02, 2014, 04:13:13 PM by tirpider
That is really spiffy.

I'm looking through old posts for code tags to try it out on :)

-edit
Ah. Turns out I've been using the code tag to display lists with a fixed width font.
I feel like a code exploiter now.

btw, for batch files it uses
[code=dos]

example of something.bat from ages ago:
Code (dos) Select
@echo off
del addme.script
scriptmunge -platform pc -inputfile addme.lua
del scriptmunge.log