Module talk:Date table sorting
Appearance
This is an initial attempt at translating Template:Dts and Template:Dtsa to Lua. This was a request made here: Wikipedia:Lua/To_do#Templates_to_be_converted
we had a hackaton, I wanted to learn Lua templates while perhaps being useful, this proved to be fun enough to go back and improve bit by bit..
Any comment will be welcome.
A few questions for this module:
- dtsa - should the template mimic the dtsa template, or dts with abbr=true? The latter is both more consistent and easier to program.
- The original request mentioned subpages of dts AFAIU there are just used to build dts. Meaning - once I "pass" dts - I don't need to try and understand/replace the subpages. Am I right?
- I assume template-" " and " " are identical, and ignore other similar whitespace differences. I consider the current module to pass all tests even though these tests fail. Any comments on that?
- Parsing a date that was entered as a single parameter is one of the largest problems. The Template:Dts documentation says any date parsed by php is legal, and [php documentation] offers endless, sometimes conflicting, options. I found a semi-logical approach that handles all the examples from Template:Dts, re-using most code from date input as separate parameters. Php offers many more formats, and I would like to understand if all are important, and if not which are.
10x! Tsahee (talk) 20:18, 19 January 2014
- @Tsahee: How do I run this with specified arguments? Such as those from Template:Dts/doc? I think {{{1}}}, {{{2}}}, etc. becomes args[1], args[2], etc.
- I saw this line in the module:
:attr('data-sort-value', self:makeSortKey())
- I believe that I can console.log self:makeSortKey() to get its value. However, I don't know how to do this because this Lua code mostly doesn't make sense to me. --User123o987name (talk) 18:30, 31 December 2018 (UTC)