Difference between revisions of "Template:Function 343"
(Experimental. Works like Template:Function, except that it always refers to NetHack 3.4.3 source.) |
m (Register in Category:Templates) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude><includeonly>[[Source:NetHack 3.4.3/{{{1}}}#{{{2}}}|{{{2}}}]]{{#if:{{{3|}}}||<nowiki> </nowiki>in [[Source:NetHack 3.4.3/{{{1}}}|{{{1}}}]]}}</includeonly></onlyinclude><noinclude> | <onlyinclude><includeonly>[[Source:NetHack 3.4.3/{{{1}}}#{{{2}}}|{{{2}}}]]{{#if:{{{3|}}}||<nowiki> </nowiki>in [[Source:NetHack 3.4.3/{{{1}}}|{{{1}}}]]}}</includeonly></onlyinclude><noinclude> | ||
− | |||
− | + | This template references a named element of a source file in the [[NetHack 3.4.3 source code]]. | |
+ | |||
+ | The restriction to NetHack 3.4.3 is deliberate. Even when new versions of NetHack are released, this template will never change. This template is useful for documenting the NetHack 3.4.3 source code itself, and for discussions that will preserve their meaning over time instead of becoming nonsense as their references quietly shift under them. | ||
+ | |||
+ | '''Syntax:''' | ||
+ | *Basic syntax: <nowiki>{{</nowiki>function_343|''filename''|''elementname''}} | ||
+ | *Hide filename: <nowiki>{{</nowiki>function_343|''filename''|''elementname''|x}} | ||
+ | |||
+ | The ''filename'' can be of the form ''src/attrib.c'' or just ''attrib.c''. ''src/attrib.c'' is preferred. Header files such as ''include/monattk.h'' and data files such as ''dat/Valkyrie.des'' are also supported. | ||
+ | |||
+ | The ''elementname'' can be a function name, a line number, or any tag provided by the source file page. | ||
+ | |||
+ | Usually, the output will include ''filename''. If a third argument is given, then the output will omit ''filename''. | ||
+ | |||
+ | '''Examples:''' | ||
+ | {| class="prettytable" | ||
+ | ! !! Syntax !! Shown as | ||
+ | |- | ||
+ | | Basic syntax || <nowiki>{{function_343|src/attrib.c|acurrstr}}</nowiki> || {{function_343|src/attrib.c|acurrstr}} | ||
+ | |- | ||
+ | | Hide filename || <nowiki>{{function_343|attrib.c|acurrstr|x}}</nowiki> || {{function_343|attrib.c|acurrstr|x}} | ||
+ | |- | ||
+ | | Line number || <nowiki>{{function_343|dat/rumors.tru|line232}}</nowiki> || {{function_343|dat/rumors.tru|line232}} | ||
+ | |} | ||
+ | |||
+ | '''Bugs:''' | ||
+ | |||
+ | Line numbers work only in some files, mostly data files. Most source files are marked for syntax highlighting and they lose their line number markings (and the syntax highlighting does not work either). | ||
-- [[User:Furey|Furey]] ([[User talk:Furey|talk]]) 13:31, 27 June 2024 (UTC) | -- [[User:Furey|Furey]] ([[User talk:Furey|talk]]) 13:31, 27 June 2024 (UTC) | ||
+ | [[Category:Templates|{{PAGENAME}}]] | ||
</noinclude> | </noinclude> |
Latest revision as of 09:56, 28 June 2024
This template references a named element of a source file in the NetHack 3.4.3 source code.
The restriction to NetHack 3.4.3 is deliberate. Even when new versions of NetHack are released, this template will never change. This template is useful for documenting the NetHack 3.4.3 source code itself, and for discussions that will preserve their meaning over time instead of becoming nonsense as their references quietly shift under them.
Syntax:
- Basic syntax: {{function_343|filename|elementname}}
- Hide filename: {{function_343|filename|elementname|x}}
The filename can be of the form src/attrib.c or just attrib.c. src/attrib.c is preferred. Header files such as include/monattk.h and data files such as dat/Valkyrie.des are also supported.
The elementname can be a function name, a line number, or any tag provided by the source file page.
Usually, the output will include filename. If a third argument is given, then the output will omit filename.
Examples:
Syntax | Shown as | |
---|---|---|
Basic syntax | {{function_343|src/attrib.c|acurrstr}} | acurrstr in src/attrib.c |
Hide filename | {{function_343|attrib.c|acurrstr|x}} | acurrstr |
Line number | {{function_343|dat/rumors.tru|line232}} | line232 in dat/rumors.tru |
Bugs:
Line numbers work only in some files, mostly data files. Most source files are marked for syntax highlighting and they lose their line number markings (and the syntax highlighting does not work either).