Jump to content

Wikipedia:Lua/Requests: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Line 373: Line 373:
:::::but I carnt login into my original account on meta if it is locked [[Special:Contributions/86.141.190.129|86.141.190.129]] ([[User talk:86.141.190.129|talk]]) 10:15, 11 August 2013 (UTC)
:::::but I carnt login into my original account on meta if it is locked [[Special:Contributions/86.141.190.129|86.141.190.129]] ([[User talk:86.141.190.129|talk]]) 10:15, 11 August 2013 (UTC)
::::::Then you email your request to {{nospam|stewards}}wikimedia.org. [[User:Osiris|Osiris]] ([[User talk:Osiris|talk]]) 05:56, 13 August 2013 (UTC)
::::::Then you email your request to {{nospam|stewards}}wikimedia.org. [[User:Osiris|Osiris]] ([[User talk:Osiris|talk]]) 05:56, 13 August 2013 (UTC)
:::::::ok how long do I wait to ask for the account to be unblock due to me editing wikipedia recently and because I am block so how long should I wait before asking them to unblock me [[Special:Contributions/86.141.190.129|86.141.190.129]] ([[User talk:86.141.190.129|talk]]) 16:35, 13 August 2013 (UTC)


How can I add special pages in module so I use [[Special:ComparePages]] for diff [[Special:Contributions/86.159.26.136|86.159.26.136]] ([[User talk:86.159.26.136|talk]]) 15:48, 10 August 2013 (UTC)
How can I add special pages in module so I use [[Special:ComparePages]] for diff [[Special:Contributions/86.159.26.136|86.159.26.136]] ([[User talk:86.159.26.136|talk]]) 15:48, 10 August 2013 (UTC)

Revision as of 16:35, 13 August 2013

Template:WikiProject Lua/header

Lua scripts on Wikipedia are similar to templates but useful for performing more complex tasks for which templates are too complex or slow. Common examples include numeric computations, string manipulation and parsing, and decision trees. You can use this page to request help from Lua developers in writing a Lua module for a specific task on Wikipedia or another Wikimedia Foundation project. Both debugging help and full implementation are available.

To start a request, just make a new section below and describe what you need. You may wish to first check Special:PrefixIndex/Module: to see if you can find a suitable existing script.

It may help developers to provide examples of where the task is likely to be useful within Wikipedia. If the proposal would replace or improve upon existing templates, please note which ones.

Convert underscores to pipes for coordinates

At the Dutch Wikipedia we use nl:Sjabloon:Coördinaten for coordinates. The input is about the same as most Wikipedia's with one major difference: Underscores are used intead of pipes. So for example nl:Haarlem uses {{Coördinaten|52_22_49_N_4_38_26_E_type:city(146753)_region:NL-NH|52° 22′ 49″ N, 4° 38′ 26″ O}}. I would like to modify the coördinaten template to use #coordinates to fill nl:Special:Nearby. I'm trying at nl:Gebruiker:Multichill/Kladblok but I don't get it to work. Can someone assist me here or point me in the right direction? The problem seems to be in | as a special character and escaping it. Multichill (talk) 10:05, 6 July 2013 (UTC)[reply]

The problem is that you can't have the "|" for separating arguments to #coordinates be generated by the #invoke; this is also why {{!}} works to "escape" a | in template arguments. But you should be able to do this entirely within Lua with something like this:
function p.coordinates( frame )
    return frame:callParserFunction( '#coordinates', mw.text.split( frame.args[1], '_', true ) )
end
I haven't actually tested that, but it should give you the idea. Anomie 12:30, 6 July 2013 (UTC)[reply]
Thanks for the input. Looks like I missed the "true" part in mw.text.split: module update and template update. The table is now populating. Multichill (talk) 13:27, 6 July 2013 (UTC)[reply]
  • I was interested of using the method too, however it is very frigile method. It looks that the invalid arguments crashes the page rendering on server side if I created a simple call with invalid arguments.
function m.C(frame)
    return frame:callParserFunction('#coordinates', { '100', '200' } )
end

The result was a server error page with apologise and the following error details:

PHP fatal error in /usr/local/apache/common-local/php-1.22wmf8/includes/parser/Preprocessor_DOM.php line 955:
Argument 1 passed to DOMXPath::__construct() must be an instance of DOMDocument, null given, called in /usr/local/apache/common-local/php-1.22wmf8/extensions/Scribunto/engines/LuaCommon/LuaCommon.php on line 500 and defined 

However if I use {{#coordinates:...}} directly, a proper error is returned instead. So I give up of calling the coordinates directly from Lua until the method became more robust for invalid input. Paweł Ziemian (talk) 05:52, 7 July 2013 (UTC)[reply]

Ran into that too and opened Template:Bugzilla. Multichill (talk) 11:26, 7 July 2013 (UTC)[reply]

Need Lua version of urlencode

Has anyone created a Lua version of parser function {urlencode:} to retain slashes, ampersand, '?' and the '=' equals sign? The current bug in web-links ("[http:____]") always appends a slash after the URL when urlencode has encoded other slashes as "%2F" which the web-link bug does not realize is a slash, and so appends a slash at end-of-URL. Instead, we need a Lua urlencode which retains slashes, so that typical weblinks of the form "[http:____]" do not append an invalid slash "/" at end of URL. I have written Template:Encodelink to properly encode some URLs, but it skips encoding the first 43 characters so that WP URLs can be encoded while retaining slashes, plus the first '?' and '='. A full Lua urlencode is needed to simplify web links. -Wikid77 (talk) 12:40, 11 July 2013 (UTC)[reply]

I think it's just in the api: this one you mean? —TheDJ (talkcontribs) 13:14, 11 July 2013 (UTC)[reply]
That was my first thought too. Wikid, can you give an example of a link that causes the erroneous slash to appear? I think it will be easier for me to understand the problem with an example. — Mr. Stradivarius ♪ talk ♪ 13:19, 11 July 2013 (UTC)[reply]
Example of slash added: For "[http://{{urlencode: www.google.com/search?q=xyz}} googling xyz]" → googling xyz, the link fails due to extra slash "/" after "xyz" (as error "400: Your client has issued a malformed or illegal request."), because extra "/" is appended by parser not seeing 3rd "/" after "[ http://__]" when "/" is encoded as "%2F". I consider it a bug (for years) to auto-append slash in "[http:___]" but hey, some developers think edit-conflict is not a problem either, so we just work around wiki-bugs. -Wikid77 (talk) 05:33, 13 July 2013 (UTC)[reply]
Wikid77, you appear to be misusing the percent encoding. Per the HTTP spec, these are not the same:
In particular, the spec requires that control characters such as "/", "?", and "=" may never be percent encoded if you intend them to have their functional meaning. (If that is surprising, don't worry about it. I found it surprising too.) A HTTP server that strictly implements the HTTP spec will regard the former as a request for the literal page "search?q=xyz", while the latter is a request for the page "search" with a query having parameter "q" equal to "xyz". It is true that many web servers are actually permissive about this and treat those two requests as identical, but that is not formally consistent with what the HTTP spec requires. Similarly, encoding the the third slash as %2F is a violation of the HTTP spec so you shouldn't be horribly surprised if it doesn't behave as expected. If you want URLs that are compliant with the HTTP specification then you need to apply urlencode: only to those parts of the URL that are not expected to act as designated control characters, e.g. you can't apply it the "/", "?", "=", or "#" that define the parts of the URL itself. Dragons flight (talk) 06:05, 13 July 2013 (UTC)[reply]
Thank you for confirming what I said at top, in case people did not understand why I noted to retain slashes, "&" or "=" or "+" etc. -Wikid77 (talk) 22:53, 13 July 2013 (UTC)[reply]
Exactly, it is for url component encoding, not for entire urls. So: "[http://www.google.com/search?q={{urlencode:xyz}} googling xyz]" → googling xyz — Preceding unsigned comment added by TheDJ (talkcontribs) 07:43, 13 July 2013 (UTC)[reply]
Further, nothing in MediaWiki is even adding a slash. If you look at the generated source for your example above, Wikid77, it has
<a rel="nofollow" class="external text" href="http://www.google.com%2Fsearch%3Fq%3Dxyz">googling xyz</a>
No added slash. But it is linking to a nonexistent hostname "www.google.com/search?q=xyz", not any page on www.google.com at all. Anomie 18:21, 13 July 2013 (UTC)[reply]
  • Extra slash "/" when clicked: The extra slash is not in the generated page, but appended live in a browser when clicking the link which does not contain a 3rd "/" in the URL (try: http://www.google.com%2Fsearch?q=xyz). The slash is auto-appended before "?q" to form "/search/?q" as an invalid format, as an obscure bug in MediaWiki. URLs which contain a "/" do not auto-append another "/". -Wikid77 (talk) 22:53, 13 July 2013 (UTC)[reply]
    • You're doing it wrong: This isn't being done by MediaWiki, this is being done by your browser. If you want only part of the URL to be encoded than encode just that part. Arbitrarily skipping characters that need to be encoded when things are done right because you want to do it the wrong way is not the way to do things. Anomie 11:30, 14 July 2013 (UTC)[reply]
Some samples might help? I looked at this a little bit and took your example and created Module:Sandbox/Matroc/Testurlencode - Edit: 2+2=4 ... may still have issues with some characters, might be a possible avenue to investigate. Matroc (talk) 00:00, 12 July 2013 (UTC) -- This is for simple URL's -- more work required for doing mediawiki APIs.[reply]
Trying with Google: Matroc's Lua could allow {#invoke:Sandbox/Matroc/Testurlencode |encode| http://www.google.com/search?q=xyz |glink|x}, to generate "[glink x]" with slash "/" as valid inside the generated link "[http:__]". -Wikid77 (talk) 05:33, 13 July 2013 (UTC)[reply]
I faced the problem to implement in LUA {{FULLPAGENAMEE}} (with the extra E at the end). The {{FULLPAGENAME}} is available as fullText of the getCurrentTitle() described here. I tried various url enconding and nothing worked. I had to create a dedicated method to join optional namespace part with the title:partialUrl() to achieve the result. I think the uri.encode lacks some encoding and could be expanded with new enctype option for that purpose. Paweł Ziemian (talk) 11:20, 12 July 2013 (UTC)[reply]
uri.encode( title.nsText, "WIKI") . ":" . uri.encode( title.text, "WIKI" ) doesn't work for you ? —TheDJ (talkcontribs) 07:43, 13 July 2013 (UTC)[reply]
The problem here is apparently that {{FULLPAGENAMEE}} un-encodes various punctuation characters that technically should be encoded according to the relevant RFCs defining percent encoding. See wfUrlencode for the specific implementation. Anomie 18:21, 13 July 2013 (UTC)[reply]
Nice to know. Thank you. Paweł Ziemian (talk) 20:50, 13 July 2013 (UTC)[reply]
  • Re-focus on original issue, for encoding to retain slashes, etc.: Create a Lua-based template to link a URL which has been encoded, but retaining slashes, ampersands, the plus signs, etc. (keep: / ? & + = ). There's no hurry on this, as the "[http:__]" extra-slash bug has been in Wikipedia for years. -Wikid77 (talk) 22:53, 13 July 2013 (UTC)[reply]
    • Modified my test Lua module - Module:Sandbox/Matroc/Testurlencode - takes 2 arguments: the url and the link - it decodes 1st then encodes - does substitution in order to (keep: / ? & + = ) - Matroc (talk) 00:42, 14 July 2013 (UTC) Might be a solution...[reply]
      • Which will break if one of the query parameters needs to contain an actual '+' instead of a space, or for the links used by git.wikimedia.org that need both encoded and unencoded slashes to be used correctly. The bottom line here is that what Wikid77 is wanting to do is simply not the right way to do things, and any "solution" for him will be a hack of some sort. Anomie 11:30, 14 July 2013 (UTC)[reply]
  • Thinking to write smart template to encode parameters: The idea is to have "smart encoding" where the Lua logic would know when to encode "+" as a literal plus sign, but we can think about it a few weeks, then perhaps decide it is too complex to automate easily. As I said, there is no hurry on this, just a major problem in web links to discuss for possible ideas. -Wikid77 (talk) 16:39, 14 July 2013 (UTC)[reply]

File on commons vs simple string

There is property d:Property:P94 and d:Property:P281. the fist is name of image file on Commons and the second is just string. However both of them are identical in structure in LUA. I had to know what to do with the text i.e. whether to wrap it in [File:...] or display it as is. The wikidata knows something more, since there is difference in the property descriptions. Could be the database API expanded with function that provides the info? Paweł Ziemian (talk) 20:06, 14 July 2013 (UTC)[reply]

Wikidata is a frustrating and mysterious thing to me - any page where "edit" doesn't get me to a page source is something I don't know what to do with, nor is it very clear how to access them. I've generally written off the project in my mind entirely. If I use templates, {{subst:d:Property:P94}} and {{d:Property:P281}} get me... well, what you see here, nothing. So I can't edit it and I can't transclude it... Let's try {{#invoke:page|id|page=d:Property:P94}} --> 0 i.e. the data isn't available in a Lua title object. So what do you do with Wikidata anyway? Wnt (talk) 01:32, 18 July 2013 (UTC)[reply]
@Wnt: You can find more info here. As far as I know we have to access it by frame:preprocess() or similar in Lua. @Paweł Ziemian: I think your suggestion might be better suited for Bugzilla, as the developers need to hear it, and the only dev I'm aware of who watches this page is Anomie. — Mr. Stradivarius ♪ talk ♪ 08:45, 18 July 2013 (UTC)[reply]
  • Thanks for the response, however I missed to mention that I want to know the difference in the statements associated in the article pages (Q items) and not in the property definition. I had idea to create a module that display a property value in most pretty format as possible. That is, a link to article if available, a string if only label is available, a coordinates with proper precision that link to geohack, a date with proper precision (including time if possible), and finally a link to file on commons if the data is a type of 'file on commons'. If for example I list claims for Gdańsk there are:
[p94] = {
        [0] = {
                ["mainsnak"] = {
                        ["snaktype"] = "value"
                        ["property"] = "p94"
                        ["datavalue"] = {
                                ["value"] = "POL Gdańsk COA.svg"
                                ["type"] = "string"
                        }
                }
                ["type"] = "statement"
                ["id"] = "q1792$297F63DF-B20B-42BC-BFFB-D79BC2B42604"
                ["rank"] = "normal"
        }
...
[p281] = {
        [1] = {
                ["mainsnak"] = {
                        ["snaktype"] = "value"
                        ["property"] = "p281"
                        ["datavalue"] = {
                                ["value"] = "80-008"
                                ["type"] = "string"
                        }
                }
                ["type"] = "statement"
                ["id"] = "q1792$f14becf3-40ab-6ac1-469d-f53cee19b577"
                ["rank"] = "normal"
        }
        ...

There is not any hint telling that the [p94] is a file name on commons and [p281] is simple text. However I thought about it a while and realised that displaying pictures is rather complex process and needs additional attention due to many available properties formating the image. My conclusion is making the process automatically is hardly possible. So I revoke the requirement. Such properties shall never be displayed directly, rather formatted individually in target infobox according to their needs, and using only the raw property value as data reference. Paweł Ziemian (talk) 09:15, 18 July 2013 (UTC)[reply]

Hmmm, according to the link above, {{#property:p284}} would be the way to access this data, and furthermore, it can't be done from here, nor does {{#property:p284|of=Gdańsk}} actually work; however, playing with it in the page preview I've managed to see that when added at the article p281 delivers:
80-008 – 80-958, 80-008, 80-958
versus
POL Gdańsk COA.svg
for p94. I should note that the latter result is just a string as displayed in that page preview, not a link unless you'd put it in double brackets. Anyway, I see the data you posted above depicted in a cutesy form at [1] but where did you get that printout of the data structure with ids etc. that you pasted above?? Wnt (talk) 09:40, 18 July 2013 (UTC)[reply]
I have my private Lua script here [2] with method claims, which invoked in the article (in preview only of course) produces such list. Paweł Ziemian (talk) 11:36, 18 July 2013 (UTC)[reply]
Aha - I now see that we have mw:Extension:Wikibase Client/Lua. I didn't even know about that before. I might have a tinker around with it later on, but I don't really know enough about it now to answer your question, Paweł. — Mr. Stradivarius ♪ talk ♪ 12:07, 18 July 2013 (UTC)[reply]

Italics language dependent in Wikivoyage listings

If it's not kosher to add a request for a different project, please feel free to revert.

We are trying to get non-Latin scripts to show up without italics in the alt= and directions= fields of voy:Template:Listing, and the hunch is that a Lua module should be able to do this for us. But we don't have anyone with the expertise. If someone here is interested in helping, please see the discussion at voy:Template talk:Listing#Non-Latin scripts are italic. Thanks! --Peter Talk 19:21, 21 July 2013 (UTC)[reply]

Not sure if it's quite ready for prime time but I've done a function at voy:Module:IsLatin as a starting point. -- WOSlinker (talk) 22:10, 21 July 2013 (UTC)[reply]
I embedded Module:IsLatin in a test template - (Used an ifeq for a "yes" or "no" test condition. No issues so far. Matroc (talk) 02:13, 24 July 2013 (UTC)[reply]
{{#ifeq:no|{{#invoke:IsLatin|IsLatin|{{{param}}}}}| (''{{{param}}}'')| ({{{param|}}})}}
Thanks for testing. -- WOSlinker (talk) 06:34, 24 July 2013 (UTC)[reply]

Three-way parameter value

In wikicode, parameters can have three way input: 1. straight text, 2. a <blank> (whitespace), and 3. not-defined at all (=not present in the template call). How can we pass these through the #invoke: step (or: how can the module detect these three)?

In wikicode, I can detect all three using the {#if:} parser function. -DePiep (talk) 13:17, 26 July 2013 (UTC)[reply]

  • When needed encode blank parameters during #invoke processing: Do not be afraid to use {#if:_} to test for blank parameters and reset the blank values during the #invoke (such as to parameter value "#blank#" or such). Inside the #invoke, each {#if} runs at the rate of 800 per second, compared to the #invoke running 500 per second with 7 text parameters. In general, do not document templates with a "boilerplate" of 30 blank parameters, because I think 1/3 (33%) of all major template parameters are blank now in a million articles, due to promoting empty-parameter skeleton examples which list almost all parameters as blank. Plus extra blank parameters slow processing, exponentially, because each parameter must be compared to all prior parameters, in case it reuses one of the same names, to overwrite the prior parameter value, and re-process each prior parameter, over and over, for each next parameter passed, as extremely slow. So, 1,000 parameters is "four times" slower than 500 parameters, rather than twice as slow, roughly speaking. -Wikid77 18:27, 26 July 2013 (UTC)[reply]
i tried to read the last blob about 3 times, and did not understand either what you are saying, or how is it relevant to the request.
iiuc, the request is about a way to distinguish, inside the lua code itself, between a parameter given with no (=empty) value, and a parameter which is not given at all. i can see the value of a way to make such a distinction, but i think this request would probably be more appropriate in mw:Extension talk:Scribunto. peace - קיפודנחש (aka kipod) (talk) 19:15, 26 July 2013 (UTC)[reply]
I think they're suggesting to set the blank param to "#blank#" to then convert it to false/nil in Lua. — Lfdder (talk) 19:39, 26 July 2013 (UTC)[reply]
Those three input methods are detected in lua as follows. Below I used parameter one ({{{1}}} in wikicode) as an example. If you are planning to detect more than one parameter with the same value, then another aproach should be taken.
No. Wikitext Lua detection
1 {{template|some text}} if frame.args[1] == "some text" then
2a {{template|}} if frame.args[1] == "" then
2b {{template| }} if frame.args[1] == " " then
3 {{template}} if frame.args[1] == nil then
Now, what are you planning to do once you have detected those three inputs ?--Snaevar (talk) 21:50, 26 July 2013 (UTC)[reply]
simply said, I want to discern: 1. return text, 2. return <blank>, 3. return default error message (with class=error state). see {{IPAsym}} and module:IPA symbol, with their current developments. -DePiep (talk) 01:02, 27 July 2013 (UTC)[reply]
This has been answered, but if anyone wants to fiddle around, see test2. Feel free to edit anything there. By the way, the module is ten months old and uses the now obsolete frame:argumentPairs() which is the same as pairs(frame.args).
The page is a little baffling at first—read the "Explanation" at the top. Each test starts by showing the template used (example: {{Johnuniq/Testargs|}}), and that is followed by a table which includes "Parent (arguments passed to template)" that shows the template arguments as seen by the module (for this example, an empty string). Johnuniq (talk) 00:52, 27 July 2013 (UTC)[reply]

Thanks. I understand that Snaevar's table is defining. It could and should be in LUA help page. -DePiep (talk) 19:11, 27 July 2013 (UTC)[reply]

Wait wait. This works well when directly module-calling from template only: tplX #invoke:.... But how to pass when I call that template from page? -DePiep (talk) 21:35, 1 August 2013 (UTC)[reply]
See frame:getParent().args to access parameters of the template that directly calls function from Lua module. Paweł Ziemian (talk) 20:04, 2 August 2013 (UTC)[reply]
Resolved
Thanks again. -DePiep (talk) 06:13, 8 August 2013 (UTC)[reply]

[HELP] Module:documentation

Hi I would like some help to create the module:documentation

I found these codes on fr wikipedia but translated some words here are the codes could someone help me change the words and to create a sillier copy of documentation but in lua scripting please I also need help translating and making the same version of Template:documentation but in lua scripting please this is some that have been done but I need help to do the rest like transformation template:documentation into module:documentation please

Extended content
--This module implements {{Documentation}}.
 
local p = {}
 
function p.corps(frame)
    args = frame:getParent().args
    local page = mw.title.getCurrentTitle()
    doc = p.docname(page)
    local corps = {}
 
    if page.subpageText == 'sandbox' then
        table.insert(corps, '<div style="clear:both />')
        table.insert(corps, frame:preprocess('{{Template sandbox notice}}'))
    end
 
    table.insert(corps, p.header(page))
    table.insert(corps, p.content(frame, page))
    table.insert(corps, p.footer(page))
 
    if args.raw then
        return frame:preprocess('<nowiki>' .. table.concat(corps) .. '</nowiki>\n:' .. os.clock())
    end
 
    return table.concat(corps)
end
 
function p.docname(page)
    if not page.isSubpage then return page.subjectNsText .. ":" .. page.text .. "/doc" end
 
    if page.subpageText == 'doc'
    or page.subpageText == 'sandbox'
    or page.subpageText == 'testcases' then
        return page.subjectNsText .. ":" .. page.baseText .. "/doc"
    else
        return page.subjectNsText .. ":" .. page.text .. "/doc"
    end
end
 
function p.ifexist(page)
    if not page then return false end
    if mw.title.new(page).exists then return true end
    return false
end
 
function p.header(page)
    local header = {'<div class="template-documentation"'}
 
    if args.color then
        table.insert(header, ' style="background:')
        table.insert(header, args.color .. '"')
    end
 
    table.insert(header, '><div style="margin-bottom:1ex; border-bottom:1px solid #aaa; padding-bottom:3px;">')
    table.insert(header, '[[File:Template-info.png|50px|alt=Template documentation|link=]]')
    table.insert(header, '<span style="font-weight:bold; font-size:125%">&nbsp;')
 
    if args.heading then table.insert(header, args.heading)
    else table.insert(header, 'Template documentation') end
    table.insert(header, '</span>')
 
    if not args.content then
        table.insert(header, '<span class="mw-editsection plainlinks">&#91;[')
        local arg = mw.title.new(args[1] or doc)
 
        if args[1] and p.ifexist(args[1]) or p.ifexist(doc) then
            table.insert(header, arg:fullUrl('action=view') .. ' view]')
            table.insert(header, '&#93;&#32;&#91;[')
            table.insert(header, arg:fullUrl('action=edit') .. ' edit]')
            table.insert(header, '&#93;&#32;&#91;[')
            table.insert(header, arg:fullUrl('action=history') .. ' history]')
            table.insert(header, '&#93;&#32;&#91;[')
            table.insert(header, page:fullUrl('action=purge') .. ' purge]')
        else
            table.insert(header, arg:fullUrl({["action"]="edit", ["preload"]="Template:Documentation/preload"}))
            table.insert(header, ' create]')
        end
        table.insert(header, '&#93;</span>')
    end
 
    table.insert(header, '</div>')
    return table.concat(header)
end
 
function p.content(frame, page)
    local content = {}
    local arg = args[1] or doc
    if args.content then
        table.insert(content, '\n')
        table.insert(content, args.content)
    else
        table.insert(content, frame:preprocess('<nowiki />'))
        table.insert(content, '\n')
        if args[1] and p.ifexist(args[1]) or p.ifexist(doc) then
            table.insert(content, frame:preprocess('{{' .. arg .. '}}'))
        end
    end
 
    table.insert(content, '\n')
    table.insert(content, frame:preprocess('<nowiki />'))
    table.insert(content, '<div style="clear:both" />\n')
    return table.concat(content)
end
 
function p.footer(page)
    local footer = {}
    local arg = mw.title.new(args[1] or doc)
 
    table.insert(footer, '</div><div class="template-documentation plainlinks" ')
    table.insert(footer, 'style="font-style:italic; margin:2px 0px 0px; padding: 0.35em 0.9em')
 
    if args.color then
        table.insert(footer, '; background:')
        table.insert(footer, args.color)
    end
    table.insert(footer, ';">\n')
 
    if args.content then
        if args["link box"] then
            table.insert(footer, args["link box"])
        else
            table.insert(footer, 'This documentation is directly included in this page.')
        end
    else
        if args[1] and p.ifexist(args[1]) or p.ifexist(doc) then
            table.insert(footer, 'The above [[Wikipedia:Template documentation|documentation]] is ')
            table.insert(footer, '[[Wikipedia:Transclusion|transcluded]] from [[')
            table.insert(footer, tostring(arg)) 
            table.insert(footer, ']]&nbsp;<span style="font-size:89%; font-style:normal;">([')
            table.insert(footer, arg:fullUrl('action=edit'))
            table.insert(footer, ' edit]&nbsp;|&nbsp;[')
            table.insert(footer, arg:fullUrl('action=history') .. ' history])</span>.<br />')
        end
        table.insert(footer, 'Editors can experiment in this templates ')
 
        local sandbox = arg.subjectNsText .. ":" .. arg.baseText .. "/sandbox"
        local argsandbox = mw.title.new(sandbox)
        if p.ifexist(sandbox) then
            table.insert(footer, '[[' .. sandbox .. '|sandbox]]')
            table.insert(footer, '&nbsp;<span style="font-size:89%; font-style:normal;">([')
            table.insert(footer, argsandbox:fullUrl('action=edit'))
            table.insert(footer, ' edit])</span>')
        else
            table.insert(footer, 'sandbox&nbsp;<span style="font-size:89%; font-style:normal;">([')
            table.insert(footer, argsandbox:fullUrl({["action"]="edit", ["preload"]="Template:Documentation/preload-sandbox"}))
            table.insert(footer, ' create])</span>')
        end
        table.insert(footer, ' and ')
 
        local test = arg.subjectNsText .. ":" .. arg.baseText .. "/testcases"
        local argtest = mw.title.new(test)
        if p.ifexist(test) then
            table.insert(footer, '[[' .. test .. '|testcases]]')
            table.insert(footer, '&nbsp;<span style="font-size:89%; font-style:normal;">([')
            table.insert(footer, argtest:fullUrl('action=edit'))
            table.insert(footer, ' edit])</span>')
        else
            table.insert(footer, 'testcases&nbsp;<span style="font-size:89%; font-style:normal;">([')
            table.insert(footer, argtest:fullUrl({["action"]="edit", ["preload"]="Template:Documentation/preload-testcases"}))
            table.insert(footer, ' create])</span>')
        end
 
        table.insert(footer, ' pages.<br />Please add categories to the ')
        table.insert(footer, '<span class="plainlinks">[')
 
        if args[1] and p.ifexist(args[1]) or p.ifexist(doc) then
            table.insert(footer, arg:fullUrl('action=edit'))
        else
            table.insert(footer, arg:fullUrl({["action"]="edit", ["preload"]="Template:Documentation/preload"}))
        end
 
        table.insert(footer, ' /doc] subpage.')
    end
    table.insert(footer, '</div>')
    return table.concat(footer)
end
 
return p

Hi could some help me to get it to look like template:documentation/start box and template:documentation/end box you can have a look at my test of it at simple:template:documentation/sandbox I had help to do it because doint know how to script but thought it was a good idea and this is we're I am testing the module on simple wiki simple:Module:Documentation 109.151.161.64 (talk) 20:16, 29 July 2013 (UTC)[reply]

hi could someone please help me make template:documentation in lua scripting I am testing it at simple:module:documentation and please see the preview of it at simple:template:documentation/sandbox 86.159.74.81 (talk) 12:06, 4 August 2013 (UTC)[reply]
The simplewiki community hasn't actually discussed whether this would be worthwhile, and this request is from a block-evading sockpuppeteer. Anyone with the spare time is of course welcome to look into fulfilling it, but as I say the project has not even begun to discuss whether we'd actually use it. Osiris (talk) 14:12, 7 August 2013 (UTC)[reply]
Well, there's no question in my mind that this is a good idea, at least for enwiki's documentation template. It's one of the more complex ones, and could certainly stand to be simplified and speeded up through a Lua module if someone has the time to put one together. — Mr. Stradivarius ♪ talk ♪ 14:16, 7 August 2013 (UTC)[reply]
ok 86.159.26.136 (talk) 18:15, 7 August 2013 (UTC)[reply]
I did it on simple wiki because they allow you to create pages without needing an account 86.159.26.136 (talk) 18:16, 7 August 2013 (UTC)[reply]
Not if you're evading a block, though, so you need to log in to your original account on Meta and request an unblock before you resume editing. Osiris (talk) 23:01, 10 August 2013 (UTC)[reply]
Absolutely agree, it's a good idea. I'll leave the code on simplewiki if somebody needs it. It'd be better, though, if it was copied to this wiki where there are more users around with the expertise to help construction. Osiris (talk) 23:01, 10 August 2013 (UTC)[reply]
but I carnt login into my original account on meta if it is locked 86.141.190.129 (talk) 10:15, 11 August 2013 (UTC)[reply]
Then you email your request to stewards@wikimedia.org. Osiris (talk) 05:56, 13 August 2013 (UTC)[reply]
ok how long do I wait to ask for the account to be unblock due to me editing wikipedia recently and because I am block so how long should I wait before asking them to unblock me 86.141.190.129 (talk) 16:35, 13 August 2013 (UTC)[reply]

How can I add special pages in module so I use Special:ComparePages for diff 86.159.26.136 (talk) 15:48, 10 August 2013 (UTC)[reply]

Image aspect ratio

It would be great to auto-detect the approximate aspect ratio of an image (width/height), especially for use in commons:Template:Assessments. Is this feasible? --Ricordisamoa 23:04, 3 August 2013 (UTC)[reply]

There's no way to do this in Lua at the moment that I'm aware of. I've filed a feature request in bugzilla - let's see if it generates any interest. — Mr. Stradivarius ♪ talk ♪ 10:51, 4 August 2013 (UTC)[reply]
Thanks a lot, let's stay tuned. --Ricordisamoa 13:14, 4 August 2013 (UTC)[reply]

Make rowclass apply to headers in infoboxes

I'm trying to make the rowclass# parameters apply to header rows in infoboxes. Here was my attempt to do that. I modified the testcases page to see if it worked, and it appears that it didn't (I expected testclass to be on the tr in the sandbox one, and it wasn't), and I don't know why. Can someone take a look at it for me? Thanks, Jackmcbarn (talk) 18:02, 9 August 2013 (UTC)[reply]

I'm guessing you probably can't chain things between tag()s. Try using an lvar (like on line 56). — Lfdder (talk) 23:12, 9 August 2013 (UTC)[reply]
Still doesn't work. Jackmcbarn (talk) 00:12, 10 August 2013 (UTC)[reply]
rowclass depended on data...oddly. If I'm reading this correctly, it should be the other way around. — Lfdder (talk) 00:33, 10 August 2013 (UTC)[reply]