Difference between revisions of "Template:ListingFields"
m (Test) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
− | |style="padding: 1px 5px 1px 5px; background-color: #ffffff; vertical-align: top;"|{{#if: {{{ | + | |style="padding: 1px 5px 1px 5px; background-color: #ffffff; vertical-align: top;"|{{#if: {{{6|}}} |{{#if: {{{7|}}} |[[{{{6}}}|{{{7}}}]] |{{{1}}}}} |{{{1}}}}}||style="padding: 1px 5px 1px 5px; background-color: #ffffff; vertical-align: top;"|{{{2}}}||{{#if: {{{3|}}}|style="padding: 1px 5px 1px 5px; background-color: #f8fff8; vertical-align: top;"|style="padding: 1px 5px 1px 5px; background-color: #ffffff; vertical-align: top;"}}|{{#if: {{{3|}}}|[[File:Add.png|frameless|link=|alt=Added since]] {{{3}}}}} ||{{#if: {{{4|}}}|style="padding: 1px 5px 1px 5px; background-color: #fff8f8; vertical-align: top;"|style="padding: 1px 5px 1px 5px; background-color: #ffffff; vertical-align: top;"}}|{{#if: {{{4|}}}|[[File:Remove.png|frameless|link=|alt=Removed in]] {{{4}}}|{{#if: {{{5|}}}|[[File:Deprecate.png|frameless|link=|alt=Deprecated in]] {{{5}}}}}}} |
|- | |- | ||
− | </includeonly> | + | </includeonly><noinclude> |
+ | {{documentation}} | ||
+ | </noinclude> |
Latest revision as of 09:45, 30 December 2018
General usage
This template is usually used in combination with Semantic Mediawiki queries, like this:
{{#ask: [[Category:Functions]] [[parent::love.filesystem]] [[Concept:Current]] | headers=hide | format=template | template=ListingFields | introtemplate=ListingIntro | outrotemplate=ListingOutro | ?Description | ?PrettySince | ?PrettyRemoved | ?PrettyDeprecated }}
Template:ListingIntro and Template:ListingOutro accompany this template and format the result as a table.
The 4 fields correspond to the columns of the table, with the notable exception that PrettyDeprecated is shown in the PrettyRemoved field when a type/function/etc hasn't been removed yet.
The result then looks like this:
love.filesystem.append | Append data to an existing file. | 0.9.0 | |
love.filesystem.areSymlinksEnabled | Gets whether love.filesystem follows symbolic links. | 0.9.2 | |
love.filesystem.createDirectory | Creates a directory. | 0.9.0 | |
love.filesystem.enumerate | Returns all the files and subdirectories in the directory. | 0.3.0 | 0.9.0 |
love.filesystem.exists | Check whether a file or directory exists. | 11.0 | |
love.filesystem.getAppdataDirectory | Returns the application data directory (could be the same as getUserDirectory) | ||
love.filesystem.getCRequirePath | Gets the filesystem paths that will be searched for c libraries when require is called. | 11.0 | |
love.filesystem.getDirectoryItems | Returns all the files and subdirectories in the directory. | 0.9.0 | |
love.filesystem.getIdentity | Gets the write directory name for your game. | 0.9.0 | |
love.filesystem.getInfo | Gets information about the specified file or directory. | 11.0 | |
love.filesystem.getLastModified | Gets the last modification time of a file. | 0.7.1 | 11.0 |
love.filesystem.getRealDirectory | Gets the absolute path of the directory containing a filepath. | 0.9.2 | |
love.filesystem.getRequirePath | Gets the filesystem paths that will be searched when require is called. | 0.10.0 | |
love.filesystem.getSaveDirectory | Gets the full path to the designated save directory. | 0.5.0 | |
love.filesystem.getSize | Gets the size in bytes of a file. | 0.9.0 | 11.0 |
love.filesystem.getSource | Returns the full path to the .love file or directory. | 0.9.0 | |
love.filesystem.getSourceBaseDirectory | Returns the full path to the directory containing the .love file. | 0.9.0 | |
love.filesystem.getUserDirectory | Returns the path of the user's directory | ||
love.filesystem.getWorkingDirectory | Gets the current working directory. | 0.5.0 | |
love.filesystem.init | Initializes love.filesystem, will be called internally, so should not be used explicitly. | ||
love.filesystem.isDirectory | Check whether something is a directory. | 11.0 | |
love.filesystem.isFile | Check whether something is a file. | 11.0 | |
love.filesystem.isFused | Gets whether the game is in fused mode or not. | 0.9.0 | |
love.filesystem.isSymlink | Gets whether a filepath is actually a symbolic link. | 0.9.2 | 11.0 |
love.filesystem.lines | Iterate over the lines in a file. | 0.5.0 | |
love.filesystem.load | Loads a Lua file (but does not run it). | 0.5.0 | |
love.filesystem.mkdir | Creates a directory. | 0.9.0 | |
love.filesystem.mount | Mounts a zip file or folder in the game's save directory for reading. | 0.9.0 | |
love.filesystem.newFile | Creates a new File object. | ||
love.filesystem.newFileData | Creates a new FileData object from a file on disk, or from a string in memory. | 0.7.0 | |
love.filesystem.read | Read the contents of a file. | ||
love.filesystem.remove | Removes a file (or directory). | ||
love.filesystem.setCRequirePath | Sets the filesystem paths that will be searched for c libraries when require is called. | 11.0 | |
love.filesystem.setIdentity | Sets the write directory for your game. | ||
love.filesystem.setRequirePath | Sets the filesystem paths that will be searched when require is called. | 0.10.0 | |
love.filesystem.setSource | Sets the source of the game, where the code is present. Used internally. | ||
love.filesystem.setSymlinksEnabled | Sets whether love.filesystem follows symbolic links. | 0.9.2 | |
love.filesystem.unmount | Unmounts a zip file or folder previously mounted with love.filesystem.mount. | 0.9.0 | |
love.filesystem.write | Write data to a file. |
Display names for translated pages
Normally, an automatically generated list looks like this:
{{#ask: [[Category:Functions]] [[parent::love.audio (Português)]] [[Concept:Current]] | headers=hide | format=template | template=ListingFields | introtemplate=ListingIntro | outrotemplate=ListingOutro | ?Description | ?PrettySince | ?PrettyRemoved | ?PrettyDeprecated }}
You can see similar ones all over the wiki.
It works fine for the English wiki, but not so much for the translated ones, because if an English page name is "pagename", the Portuguese one is "pagename (Português). Now imagine that each big page has 20 links, all with (Português) appended to it. It's an annoyance. Now another situation: "number" in Portuguese is "número", but the link to the page is "number (Português). Not a big problem, but it can be better.
So I added the possibility of having two extra arguments:
{{#ask: [[Category:Functions]] [[parent::love.audio (Português)]] [[Concept:Current]] | headers=hide | format=template | template=ListingFields | introtemplate=ListingIntro | outrotemplate=ListingOutro | ?Description | ?PrettySince | ?PrettyRemoved | ?PrettyDeprecated | ?RealLink# - | ?DisplayName# - }}
If it finds a page with RealLink and DisplayName set, it displays the DisplayName instead. Here's an example of how it can be set:
{{#set:RealLink=number (Português)}} {{#set:DisplayName=número}}
Just put that anywhere on the page!
The above documentation is transcluded from Template:ListingFields/doc. (edit | history) Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |