Template:File: Difference between revisions
Appearance
No edit summary |
m make params consistent |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 9: | Line 9: | ||
border-bottom: 0; | border-bottom: 0; | ||
margin-bottom: -1em; | margin-bottom: -1em; | ||
display: flow-root; | |||
"><span style=" | "><span style=" | ||
font-size: 120%; | font-size: 120%; | ||
color: {{{iconColor| | font-weight: 900; | ||
">{{unicon|{{{icon| | color: {{{iconColor|{{file/color|{{{lang|{{{language|{{{2}}}}}}}}}}}}}}; | ||
">{{unicon|{{{icon|{{file/icon|{{{lang|{{{language|{{{2}}}}}}}}}}}}}}}}</span> {{{name|{{{filename|{{{1}}}}}}}}}</div>{{code|lang={{{lang|{{{language|{{{2}}}}}}}}}|line={{{line|}}}|copy={{{copy|yes}}}|highlight={{{highlight|}}}|{{{contents|{{{3}}}}}}}}</div></includeonly><noinclude>{{Documentation}}</noinclude> | |||
Latest revision as of 17:16, 11 June 2025
Template Documentation [edit source| uses| help]
This template is used to display the content of a file, or otherwise a block of code with the context of which file it would belong to.
🐍︎ main.py
def main():
pass
if __name__ == "__main__":
main()
Usage
☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.
Simply include this template in your page, specifying the language, file name and content of the file. Note that you may have to surround the code in <nowiki> tags in order to display it correctly.
{{file|main.c|c|
<nowiki>
#include <stdio.h>
main( )
{
printf("hello, world\n");
}
</nowiki>
}}
Template data
Display a block of code alongside the name of the file it would belong to
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| File name | name | Name of the file the code belongs to | String | required |
| Programming language | lang | The programming language used in the code | String | required |
| Content | 3 | The code to be displayed | String | required |
| 1 | 1 | no description | Unknown | deprecated |
| 2 | 2 | no description | Unknown | deprecated |
| filename | filename | no description | Unknown | deprecated |
| file | file | no description | Unknown | deprecated |
| contents | contents | no description | Unknown | deprecated |
| language | language | no description | Unknown | deprecated |