Template:Sourcecode

From NetHackWiki
Jump to navigation Jump to search

[[Source:{{{1}}}#line{{{2}}}|{{{1}}}, line {{{2}}}]]


This template can be used to reference a numbered line of the source code; use {{function}} to reference a named element.

The syntax is {{sourcecode|filename|linenumber}}. For example:

{{sourcecode|hack.c|2162}}

expands to:

hack.c, line 2162.

To link to the source code of a specific version or variant, use the optional "version" parameter. For example:

{{sourcecode|hack.c|2676|version=SLASH'EM 0.0.7E7F2}}

expands to:

hack.c in SLASH'EM 0.0.7E7F2, line 2676.

Please try to do this for every use of the template, because source line numbers have a tendency to change when a new NetHack version is released, causing the link to no longer go to the right place. (You may need to give the directory explicitly.)

Instead of using this template between <ref> and </ref> tags, use {{refsrc}}, which is less likely to change as a result of a version update.