20,741
edits
m (→Wiki updates) |
|||
Line 162: | Line 162: | ||
== Wiki updates == | == Wiki updates == | ||
Philosopher has brought native Nasal syntax highlighting support to the wiki by creating a GeSHi config file for Nasal. | |||
Using the <syntaxhighight> tag with a lang="nasal" attribute, we can have highlighting right here on the wiki. Use enclose="div" to wrap the text, if it happens to be particularly wide. | |||
<nowiki><syntaxhighlight lang="nasal"> | |||
# hello.nas | |||
print('Hello World!'); | |||
</syntaxhighlight></nowiki> | |||
Which renders into: | |||
<syntaxhighlight lang="nasal"> | |||
# hello.nas | |||
print('Hello World!'); | |||
</syntaxhighlight> | |||
We will be running a scripted bot to update all our existing uses of "php" markup to use "nasal" instead. | |||
To learn more, see [[Howto:Syntax highlighting for Nasal]]. | |||
<syntaxhighlight lang="nasal"> | |||
# this is a comment | |||
# operators (if applicable): | |||
!a ? a+b - c/d*e : f~g; | |||
# Builtin functions, strings | |||
print('Hello World!'); | |||
die("We have an error, Houston!", arg[0]); | |||
cmdarg().getNode("setting").getValue(); | |||
streq(typeof(id(keys(hash))),10); | |||
# Loopoids | |||
foreach (var a; ["haha", {command:"NASAL!"}, me]) { | |||
if(0) break; | |||
elsif(1) continue; | |||
else return; | |||
while(1) sprintf("%s%s\n%s=%f", "Spam", "spam", "spam", 0e-0); | |||
for (var i=0; i < 0.00; i += 0x0) printf("%d", int(i)); | |||
forindex(var o; a) (func { | |||
var o = o; | |||
setlistener("/", func print(o), 1, 2); | |||
})(); | |||
} | |||
# String escaping stress tests: | |||
'\a\b\c\"\\\?' # none of these | |||
"\e\?\'\f\a" # none of these | |||
'\'' # this one | |||
"\"\r\n\t\\\t" # and all of these | |||
# And optionally string formatting: | |||
"%s%%s%.0f%8d" # the second "s" shouldn't be highlighted, otherwise everything else | |||
# Syntax error!: | |||
%$@&^|\` | |||
</syntaxhighlight> | |||
=== Translators required === | === Translators required === |