Jump to content

User talk:Trappist the monk/Archive 7

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia


Module:Webarchive

[edit]

Hi, i saw you rewritten whole module. Its now easy to localise. Please add title, url, date to Module:Webarchive/data. Please also add something like date_name_xlate() which automatically convert date to local date, so every time i don't have to be worry when module gets updated (Currently 1. Module gives bengali date when date is in english but adds Date mismatch 2. Module gives no result if date is in bengali & Y-M-D format). --আফতাবুজ্জামান (talk) 18:13, 14 September 2018 (UTC)[reply]

Precious anniversary

[edit]
Precious
Five years!

--Gerda Arendt (talk) 07:22, 20 September 2018 (UTC)[reply]

Cheers, —PaleoNeonate19:52, 21 September 2018 (UTC)[reply]

I made a mess at Template:Ohio class ballistic missile submarine displacement

[edit]

See Wikipedia:Village pump (technical)#Updating template causes lots of big red warnings. The template has named refs that are apparently re-used (with the same content) in other templates, so updating the refs causes warnings. Kendall-K1 (talk) 13:11, 23 September 2018 (UTC)[reply]

{{Ohio class ballistic missile submarine template references}}
Trappist the monk (talk) 14:50, 23 September 2018 (UTC)[reply]

Clipping the Google Book URL to remove the search query

[edit]

You might want to weigh in at User talk:Smasongarrison#Clipping the Google Book URL to remove the search query. Flyer22 Reborn (talk) 23:03, 29 September 2018 (UTC)[reply]

CS1 errors.

[edit]

Hi Trappist; i use Category:CS1 errors: external links to find errors to correct, and have done for quite some time. I was largely away from WP for about a month recently, and since i've come back i've noticed a huge number of new pages listed in the category which make it seem that something has changed. Occasionally in the past there'd be a Draft article listed, now there are lots; even more of a change, there are large numbers of deletion discussions listed, which seems counter-intuitive, as they are archived, so not going to be changed, so surely don't need to be in this tracking category. So, after a long-winded explanation, my question is what has changed? Something in the category, or...well, i don't know. Whatever, it just seems a little strange, so i come to you who, i believe, created the category and much of the CS1 stuff. Happy days, LindsayHello 09:10, 6 October 2018 (UTC)[reply]

I don't think that anything has changed as far as what Module:Citation/CS1 adds to Category:CS1 errors: external links; the code that does that hasn't changed since the 5 December 2015 update. The module has never excluded archive or log pages. There has been some discussion about that but we have never elected to exclude those kinds of pages and editors do repair cs1|2 templates in them.
One way of gauging change in the cs1|2 category pages is to look at archives of those pages at archive.org. This link:
https://web.archive.org/web/*/https://wiki.riteme.site/wiki/Category:CS1_errors:_external_links
should give you a calendar display from which you can choose a day and snapshot so that you can compare article count at the time of the snapshot to the current count. Alas, for me, archive.org isn't working this morning (returns a blank page).
I don't know for certain how many of these kinds of errors are attributable to tools and concomitant operator laziness because the operator is responsible for the edits made by the tool. There is one tool in particular, reFill, that very often produces crap cs1|2 templates. I picked one article from the category more-or-less at random, Bell Boeing V-22 Osprey, see line 205 and its result.
Trappist the monk (talk) 12:02, 6 October 2018 (UTC)[reply]

Adding local month

[edit]

In the module ഘടകം:Citation/CS1/Configuration (Malayalam wikipedia), I would like to know whether I can add a alternative month name in the section D A T E _ N A M E S. For eg.Can I add a statement like ['long'] = ['January']|['xyz']=1. The actual problem is that for the month August, it can be written both as ഓഗസ്റ്റ് as well as ആഗസ്റ്റ്. Adithyak1997 (talk) 10:08, 13 October 2018 (UTC)[reply]

Not like that. Include each spelling of August separately:
['ഓഗസ്റ്റ്'] = 8, ['ആഗസ്റ്റ്'] = 8,
Trappist the monk (talk) 11:21, 13 October 2018 (UTC)[reply]
Thank You.Adithyak1997 (talk) 13:20, 13 October 2018 (UTC)[reply]

Renaming articles in Article Page

[edit]

In Malayalam Wikipedia, not many users visit the talk page. So, they may not be able to see the rename request. I need help from you in making the module Module:Requested move(link is:[this])in such a way that the rename request needs to be displayed in the article page instead of talk page. In current scenario, when I do that, I am getting the error as shown in the page [this].Adithyak1997 (talk) 18:00, 14 October 2018 (UTC)[reply]

Are you sure that what you propose is a good idea? That template and module are designed to work with User:RMCD bot. If you modify the module, implementing the bot on ml.wiki will be broken. Perhaps, instead, you might create a 'information' template that can be placed on an article's page that would link to the move discussion on the article's talk page where ml:Template:Requested move has also been placed. Then in future, if someone elects to implement RMCD bot, nothing is broken and your 'information' template can be deprecated and deleted.
Trappist the monk (talk) 19:03, 14 October 2018 (UTC)[reply]
Ok. I will do as directed by you.Adithyak1997 (talk) 04:01, 15 October 2018 (UTC)[reply]
Just to be clear, I have given you a suggestion, I have not given you a directive.
Trappist the monk (talk) 08:57, 15 October 2018 (UTC)[reply]

A barnstar for you!

[edit]
The Technical Barnstar
For your work with CS1|2 Hawkeye7 (discuss) 05:07, 17 October 2018 (UTC)[reply]

Deletion of tagged empty categories

[edit]

Could you please react in this discussion? Thanks in advance. Marcocapelle (talk) 21:06, 17 October 2018 (UTC)[reply]

Module:Webarchive

[edit]

Hi, I started to translate Module:Webarchive/data in Bengali. I am having trouble making the sentence in Bengali. I need to swap some words but i don't see any option for them. see following examples:

  • Archived August 1, 2016, at the Wayback Machine. so Archived + August 1, 2016, + at the Wayback Machine. = word + date + prefix.archive service name.suffix but in bengali i need to rearrange this sentence like this: prefix.archive service name.suffix + date.a suffix for date + word
  • Page title at the Wayback Machine (archived August 1, 2016) so Page title + at the Wayback Machine + (archived + August 1, 2016) = title + prefix.archive service name.suffix (word + date) but in bengali i need to rearrange this sentence like this: prefix.archive service name.suffix + title (date.a suffix for date + word)

I guess local function createRendering() is responsible for this. so i made this edit and able to fix last part of second example. Please move this sentence making part to '/data'. or please show me how can i fix this in bengali. Thank you. --আফতাবুজ্জামান (talk) 20:40, 17 October 2018 (UTC)[reply]

Sigh. I thought I was done with this. I'll think about how to fix it.
Trappist the monk (talk) 08:47, 18 October 2018 (UTC)[reply]

Need your assistance

[edit]

Hey Trappist and thanks for all the help so far. I'm almost done with my little project but while testing the final layout I noticed a very serious and strange bug. My sandbox received the article ranking of two of the pages I tested, so it now had both GA and FA rankings and also received the error Warning: Display title "Through the Looking Glass (Lost)" was ignored since it is not equivalent to the page's actual title. while previewing the changes to my sandbox. This is what I was testing:

  • {{Television episode disambiguation description|Through the Looking Glass (Lost)}} {{User:Gonnym/sandbox/Test|22|1|Lost|y}}
  • {{Television episode disambiguation description|The Constant}} {{User:Gonnym/sandbox/Test|5|4|Lost}}

The modules this uses are: Module:Television episode disambiguation description, Module:Sandbox/Gonnym/Episode short discription; and the templates: Template:Television episode disambiguation description, User:Gonnym/sandbox/Test and Template:Extract short description, but as far as I can tell, I'm not using in any of them the DISPLAYTITLE magic word or really anything other than simple strings. From testing I'm pretty sure the issue is only with the first half (not the sandbox module and template) as it happens when that part is by itself, but other than that I'm pretty much stumped. --Gonnym (talk) 20:54, 22 September 2018 (UTC)[reply]

{{extract short description}} has this:
{{#invoke:string|match|s = {{:{{{1|}}}}}|pattern = {{lessthan}}div class="shortdescription.->(.-)<|ignore_errors = 1}}
when the template runs, {{{1|}}} is replaced with Through the Looking Glass (Lost):
{{#invoke:string|match|s = {{:Through the Looking Glass (Lost)}}|pattern = {{lessthan}}div class="shortdescription.->(.-)<|ignore_errors = 1}}
before module:string is invoked, the transclusions are performed; in this case {{lessthan}} is replaced with < and {{:Through the Looking Glass (Lost)}} is replaced with the rendered content of Through the Looking Glass (Lost); this becomes s in the invoke.
The Through the Looking Glass (Lost) article has {{DISPLAYTITLE:Through the Looking Glass (''Lost'')}} and this is where the warning message comes from.
Trappist the monk (talk) 21:54, 22 September 2018 (UTC)[reply]
Thanks again! I've reached out to the creator of that template to see if he can fix it. --Gonnym (talk) 22:00, 22 September 2018 (UTC)[reply]
If I have a string which is = "<number> then either </> or <and> and <number>" ("1 and 2" or "1 / 2" or "1/2") and I want to extract the first number, what would be the regex pattern? I've tried string.match(doubleEpisodeNumberText, "(%d+)/%a") but that didn't work and returns nil. Any idea? --Gonnym (talk) 10:59, 24 September 2018 (UTC)[reply]
Lua doesn't do regex.
One possible solution is this:
result = string.match (doubleEpisodeNumberText, '(%d+) */ *%d+') or string.match (doubleEpisodeNumberText, '(%d+) *and *%d+')
Another, if you know that the separator will always be </> or <and> and never <nad>, <n>, or some other string made from one or more of the four characters in the set:
result = string.match (doubleEpisodeNumberText, '(%d+) *[/and]+ *%d+')
edit: fixed
Trappist the monk (talk) 11:44, 24 September 2018 (UTC)[reply]
Oh, I read pattern here and automatically converted in my head to regex. Do both examples always expect either "/" and "and"? Is there no way of telling it "slash character" or "any letter"? Or is that possible but just costly in terms of time? --Gonnym (talk) 11:57, 24 September 2018 (UTC)[reply]
In my first example above, the pattern '(%d+) */ *%d+' returns the first digit character(s) from the string doubleEpisodeNumberText only when the first digit characters are followed by 0 or more space characters, a / character, 0 or more space characters, and 1 or more digit characters. In the second example, '(%d+) *[/and]+ *%d+' returns the first digit character(s) from the string doubleEpisodeNumberText only when the first digit characters are followed by 0 or more space characters, any combination of 1 or more characters in the set [/and] (any order, any length), 0 or more space characters, and 1 or more digit characters. In both cases, when matches are not found, result is nil.
Lua patterns don't support the alternation operator (|) so the strict / OR and is not supported in a single pattern though the [/and] pattern will accomplish that IFF the source string separator is guaranteed to use only / and and as separators.
The debug console (bottom of every module edit page) is a handy tool for experimenting with Lua patterns. Copy this into the console ('and' intentionally misspelled):
=string.match ('1 nad 2', '(%d+) *[/and]+ *%d+')
press enter. Use up and down keys to scroll to previous tests.
Trappist the monk (talk) 12:39, 24 September 2018 (UTC)[reply]
Ok, I think I got it now. Thanks for the debug info, I was actually trying to find information on how to use it but couldn't quite understand. Really helpful! --Gonnym (talk) 12:46, 24 September 2018 (UTC)[reply]
One more question (well a few questions on the same issue) - what is the best practice, using numbered variables or named ones? And if the answer is named ones, how do I force specific names? And do named variables also work as numbered variables? I couldn't find the tutorial for this. --Gonnym (talk) 16:50, 24 September 2018 (UTC)[reply]
I guess that the answer depends on whether we're talking about template parameters or Lua variables, the application and its complexity. So what are we talking about?
Trappist the monk (talk) 17:05, 24 September 2018 (UTC)[reply]
This specific module (Module:Sandbox/Gonnym/Episode short discription) takes its params from a template via a helper template. --Gonnym (talk) 17:09, 24 September 2018 (UTC)[reply]
Perhaps we are not communicating. Are we talking about this kind of numbered variable (table indexes):
local episodeNumberText = frame.args[1]
or template parameters that are positional ({{{1}}}) or named (|episode=123)?
Examples are often helpful.
Trappist the monk (talk) 17:19, 24 September 2018 (UTC)[reply]
I was referring to the second option - template parameters that are positional. I know some templates have things like "year=2008" but also accept "|2008". --Gonnym (talk) 17:27, 24 September 2018 (UTC)[reply]
(talk page stalker) Positional parameters can seem like a good idea, because they are simple to implement, but with any template, human editors will inevitably create instances of the template that are broken. If a template accepts more than one positional parameter, that brokenness can be harder to detect and fix. – Jonesey95 (talk) 17:44, 24 September 2018 (UTC)[reply]
(edit conflict)Yeah, what he↑ said. But with at least one caveat. For simple templates with only a handful of parameters, where all of the parameters are required, then no need for named parameters. Once positional parameters become optional then, were I writing a new template, I would require named parameters and not allow positional parameters. Yes, having both is possible but mixing them can be problematic because a positional parameter that also has a named alias can make life difficult for the programmer and for editors who use the template:
Suppose {{{1}}} is an alias of |episode= and a template takes two required parameters. Then, from:
{{template|episode=1|param2}}
MediaWiki assigns the value param2 to {{{1}}} or in Lua frame.args[1]. Now, which to use? frame.args[1] or frame.args['episode']? And what about the {{{2}}} value that is now missing?
For me then, the general rule is: don't alias named and positional parameters. A template can have both kinds of parameters, so long as they aren't aliased.
Trappist the monk (talk) 18:18, 24 September 2018 (UTC)[reply]
I had a feeling. Could you point me to where I can read on how to do it correctly then? --Gonnym (talk) 17:51, 24 September 2018 (UTC)[reply]
Ok, so to create a named param "|episode=" I just need to call frame.args['episode']? And if I understand correctly, in this situation, it's not needed, right? --Gonnym (talk) 18:31, 24 September 2018 (UTC)[reply]
Umm, what? And if I understand correctly, in this situation, it's not needed, right? What is it that's not needed? Were it me, I would create local variables to hold the content of named parameters so for the |episode= example:
local episode = frame.args['episode']
One other thing to worry about with positional parameters: leading and trailing whitespace isn't stripped as is done with named parameters; those extra whitespace characters can gum up the works.
Trappist the monk (talk) 19:06, 24 September 2018 (UTC)[reply]
Oh, I misunderstood you then. I thought For simple templates with only a handful of parameters, where all of the parameters are required, then no need for named parameters covered this scenario. --Gonnym (talk) 19:09, 24 September 2018 (UTC)[reply]

Sorry to keep on asking you questions, but it's like each time I move one step forward, I end up moving two more backwards. I've converted the params in the module to named params. I've changed the invoke in the template to {{#invoke:Sandbox/Gonnym/Episode short discription|getShortDescription|episode_num={{{1}}}|season_num={{{2}}}|season_num_uk={{{3}}}|series_name={{{4}}}|multi_episodes={{{5}}}}}. I changed the usage of the template to {{User:Gonnym/sandbox/Test|{{{episode}}}|{{{season}}}|{{{series_no}}}|{{{series}}}|{{{multi_episodes}}}}}}}, but now nothing shows up. I previously also had problems with validation of data of the params. I'm assuming that they are now not nil or named "{{{multi_episodes}}}", but I also don't know what value they do have when empty. Any ideas? --Gonnym (talk) 20:40, 24 September 2018 (UTC)[reply]

if the plain template call looks like this:
{{User:Gonnym/sandbox/Test|1|2|3|name|multi}}
then this is the correct form for the invoke:
{{#invoke:Sandbox/Gonnym/Episode short discription|getShortDescription|episode_num={{{1}}}|season_num={{{2}}}|season_num_uk={{{3}}}|series_name={{{4}}}|multi_episodes={{{5}}}}}
If you are including {{User:Gonnym/sandbox/Test}} inside some other template and that template has parameters |episode=, |season=, |series_no=, |series=, and |multi_episodes= then the {{User:Gonnym/sandbox/Test}} call wants to look like this (inside the 'other' template):
{{User:Gonnym/sandbox/Test|{{{episode}}}|{{{season}}}|{{{series_no}}}|{{{series}}}|{{{multi_episodes}}}}}}}
which also produces:
{{#invoke:Sandbox/Gonnym/Episode short discription|getShortDescription|episode_num={{{1}}}|season_num={{{2}}}|season_num_uk={{{3}}}|series_name={{{4}}}|multi_episodes={{{5}}}}}
Trappist the monk (talk) 21:04, 24 September 2018 (UTC)[reply]
So that's exactly how I have it set up, but for some reason it's not working. Not getting an error but just not getting any result back. --Gonnym (talk) 21:45, 24 September 2018 (UTC)[reply]
In {{Infobox television episode/sandbox}} is this:
{{Short description|{{User:Gonnym/sandbox/Test|{{{episode}}}|{{{season}}}|{{{series_no}}}|{{{series}}}|{{{multi_episodes}}}}}}}
in {{short description}} is this (note the style attribute):
<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">
in Template:short description/doc#testing is this:
.shortdescription { display:block !important; }
which should be added to your favorite personal css page. At Template:Infobox television episode/testcases after I added the css, I see:
1st and 2nd episode of the first season of Example2
That's what I should see, right?
With the css, I also see a glaring red lua error at {{Infobox television episode/sandbox}}. That should be fixed.
Trappist the monk (talk) 22:13, 24 September 2018 (UTC)[reply]
Wow, that helped a lot! So I've fixed the 2 red lua errors shown. One was for when the season param is empty, so I'm now checking "tonumber(value) and if both options are nil I'm passing 0 (as a string as the other module expects strings) to stop that. The second was similar and was for when the episode is empty, which in this case I'm returning a nil description as there really isn't what to show. Think this is good or should I do something else? Last issue I have is when the field | multi_episodes = is present in the infobox but just left empty (if someone copies it from somewhere else). In this scenario is passes my validation check but I'm not sure with what value as its not nil or {{{multi_episodes}}}. Fixed this - empty string when its listed in the infobox but empty, param name when its not listed in the infobox. --Gonnym (talk) 05:34, 25 September 2018 (UTC)[reply]
Cleaned up the code and added more options so the previous question is not relevent anymore. I did encounter something I cannot explain. When the | series = param is not in the infobox, the value is {{{series}}}, which is expected. When it is in the infobox, but left empty, the value seems to be ', which is messing up my validation. I have no idea why.--Gonnym (talk) 20:34, 25 September 2018 (UTC)[reply]
Put examples someplace where I can see what it is that you are describing.
Trappist the monk (talk) 21:04, 25 September 2018 (UTC)[reply]
User:Gonnym/sandbox/tests2 has an example of it showing only ' (when it should be an empty string), if you edit the infobox and remove the field it will show {{{series}}}. --Gonnym (talk) 21:21, 25 September 2018 (UTC)[reply]
Ok, I found out where the ' came from, the string was ''<tv series>'', but then the series should be empty so it became '''' and 3 become the bold style. But now I have no idea why

if (value == nil or value == "" or value == paramName) then return false does not catch it... --Gonnym (talk) 22:19, 25 September 2018 (UTC)[reply]

(edit conflict)Your code is hard to read. The extraneous apostrophe occurs because this code at line 28:
return "An episode of the " .. seasonOrdinalNumber .. " season of ''" .. tvSeriesName .. "''"
When tvSeriesName is an empty string the concatenation is this:
An episode of the fifth season of '''' – note the four single quote marks
In wiki markup the first three are treated as bold markup, the fourth as the first character of whatever is to be bolded. If you add some plain text to User:Gonnym/sandbox/tests2 immediately after the info you will see that it is in bold font.
At line 208 you use the variable tvSeries which is undefined. You should probably add require('Module:No globals'); at the top of your module, it will catch these global variables.
Trappist the monk (talk) 22:21, 25 September 2018 (UTC)[reply]
Line 208 was the issue! Thanks! Regarding your comment, you find my code hard to read? Could you explain what exactly so I'll know how to fix it? --Gonnym (talk) 22:28, 25 September 2018 (UTC)[reply]
Whatever I write here is, of course biased opinion that has no value except as an expression of that opinion. For me there isn't an obvious flow. It is way too easy to get lost in the series of little functions calling little functions ... only returning at the end. English is my native language so, for ease of reading, I like to see spaces between words. Were German my native language then perhaps wordsAllRunTogetherToMakeUpOneIdentifier might be more palatable and easier to read. What I do like? Commented code. I like that there are comments in your code. I'm not one of the cool kids who eschew comments because they believe that their code is self-explanatory. I hope those cool kids aren't writing the code that will be controlling the next vehicle I drive.
Trappist the monk (talk) 23:11, 25 September 2018 (UTC)[reply]
I write in CamelCase as I'm coming from java where that's how the naming convention's are done, and small precise functions as that's how I've been taught and used to. Small functions (hopefully) make it clear from both the function name and the limited amount of code it has, to what it does. So for example you have a function that's called "getValueUnder100()" you know what that does. But if that function did 5 more things in it, such as Module:ConvertNumeric's _numeral_to_english() function, which does a lot in that function, then it's later harder to debug and fix code (so in the previous example, for some reason the code calls the scientific_notation_to_decimal() function even-though its irrelevant to my needs). Larger code also makes it less likely the code can be reuseable. I guess that with no real IDE and with this strange bottom-to-top writing (why can't my main function be at the top of the page?), it makes reading harder. --Gonnym (talk) 09:14, 26 September 2018 (UTC)[reply]
You will get no argument from me about the utility, reliability, reusability, and other benefits of small functions. Perhaps I was unclear in what I meant. Perhaps I should have written that it's the chaining of small functions which, in the case of the createDescriptionValidate...() functions, are basically if ... then ... else ... end so, depending on what the function is given the chain reorders and it is that reordering that makes that kind of coding so hard for me to follow.
Identifiers must be defined before they are used. You can get round that to some extent if you put all of the little functions in a separate library module and then require() that module; same as you do for Module:ConvertNumeric; probably not worth the effort for this template/module pair.
Trappist the monk (talk) 12:03, 26 September 2018 (UTC)[reply]
Ah yes, I also didn't like the chaining, but it was either that or a 5-tier if-else function, which I'm honestly not sure would have been better. At least this way, I, as developer could make sure I'm not messing up the code by forgetting to close statements with correct else checks. --Gonnym (talk) 12:09, 26 September 2018 (UTC)[reply]

Tag module

[edit]

I've done some playing around with your code so it will let me call it from another module (Module:Sandbox/Gonnym/sometest2). Do you want to publish your code to mainspace so I can start using it? Also, thanks again for everything. I was thinking I'd never get this to work but with your help it now (seems to) work perfectly! --Gonnym (talk) 15:57, 28 September 2018 (UTC)[reply]

I suppose that the correct thing to do with it is to use it to augment {{extract short description}}. Certainly if it is to be useful, the infobox names should not be hard-coded. I'll work on making it more generally usable.
Trappist the monk (talk) 21:10, 28 September 2018 (UTC)[reply]
Yes of course, that should not be hard-coded. I was wondering though, I read somewhere (tried finding it again, but couldn't) that if I'm creating a module then the corresponding template should be just the invoke and there shouldn't be extra code there. So what would be more correct? For me to call your module from the one I wrote and create and return the complete process from the module, or call my module and return part 1, call your module and return part 2 and let the template join them together? --Gonnym (talk) 21:35, 28 September 2018 (UTC)[reply]
I've hacked tag2. The template interface is extract_short_description. There two other exported functions:
extract_from_template (frame, article_title, template_name)
extract_from_article (article_title)
You can have access to these two by doing this (not tested but should work – yeah, those famous last words):
local extract = require ('Module:Sandbox/trappist the monk/tag2');
local extract_from_template = extract.extract_from_template;
local extract_from_article = extract.extract_from_article;
the functions return the short description text or one of several error messages. Here are the template interface versions:
{{#invoke:Sandbox/trappist the monk/tag2|extract_short_description|User:Gonnym/sandbox/tests2|infobox television episode/sandbox}}Script error: No such module "Sandbox/trappist the monk/tag2".
{{#invoke:Sandbox/trappist the monk/tag2|extract_short_description|Abraham Lincoln}}Script error: No such module "Sandbox/trappist the monk/tag2".
{{#invoke:Sandbox/trappist the monk/tag2|extract_short_description|Athens}}Script error: No such module "Sandbox/trappist the monk/tag2".
To answer your question, I vote for staying in Lua once you get there so require() tag2 as I described above. Remember that the name will change when it gets published; unless there's a better name it will probably become Module:Extract short description.
Trappist the monk (talk) 00:28, 29 September 2018 (UTC)[reply]
Hey, any update on this? I'd like to add the code to the working infobox but want to do it after everything is all production ready. --Gonnym (talk) 20:34, 2 October 2018 (UTC)[reply]
You are the person who has been using the module. Were there any deficiencies I presume that you would have told me or fixed them yourself. So you tell me: is it ready to be moved out of my sandbox? Should it be used to replace the content of {{extract short description}}? Should the module be named Module:Extract short description or something else?
Trappist the monk (talk) 21:26, 2 October 2018 (UTC)[reply]
Oh! I didn't know you were waiting on me! Sorry :) I tested every scenario I could think of including those you suggested as wikilinks and it all seems to work. There is one issue with my side of my code (well with the infobox itself really), where a series that has a "()" as part of its name will not have a correct name and those will need to have a manual short description. Everything else seems to work fine. I did test though only the extract from template and only infobox one, so not sure how it works with other templates, or from article. Regarding the template, yes I think it should. The template was showing those errors with the display title and giving me the article's rating as well. I personally will be accessing it not from the template but from the module. And yes, I think the module name is good as that's what it does. --Gonnym (talk) 21:39, 2 October 2018 (UTC)[reply]
You refer to article names like Randall and Hopkirk (Deceased)? Create a parameter |display-title= that holds text and wiki markup that will be displayed in lieu of the actual article title? or create a parameter |not-dab= that when set to yes prevents trailing parenthetical text from being treated as a disambiguator?
Trappist the monk (talk) 08:01, 3 October 2018 (UTC)[reply]
Yes, that was my issue. Your solution is great, I'm just not sure I'll be able to get consensus to add a field to the infobox. It's so hard getting changes added these days. --Gonnym (talk) 09:21, 3 October 2018 (UTC)[reply]
I'm sure this is a very simple error on my part, but I have no idea what this isn't working. I'm getting a nil value from "not_dab" in my module. Added it to the sandbox infobox and to my test, but in the module it doesn't even manage to get passed. Any idea? --Gonnym (talk) 10:05, 3 October 2018 (UTC) Yep, stupid mistake (forgot about the template). --Gonnym (talk) 10:15, 3 October 2018 (UTC)[reply]

One more question, should the template Template:Television episode disambiguation description have named params to send to it, or unnamed ones? If the answer is named, how do I set that? --Gonnym (talk) 13:50, 3 October 2018 (UTC)[reply]

As I wrote elsewhere on this page, I vote for named parameters. Consider this. Right now you have in {{television episode disambiguation description}} this:
{{#invoke:Television episode disambiguation description|main|name={{{1}}}|not_disambiguated={{{2}}}|link_only={{{3}}}}}
which uses named parameters. Consider rewriting that to be:
{{#invoke:Television episode disambiguation description|main}}
then, in Module:television episode disambiguation description, consider one of these additions:
  1. at main():
    local args = frame:getParent().args -- fetch parameters from the calling template
  2. at main():
    local getArgs = require('Module:Arguments').getArgs;
    local args = getArgs(frame); -- fetches parameters from both of frame.args and frame:getParent().args; empty parameters returned as nil
I prefer choice 2; it's what I did with Module:Extract short description. If you do that then your function validateStringParam(value, paramName) changes to be validateStringParam(value) and looks perhaps something like this:
return not (nil == value)
Trappist the monk (talk) 14:32, 3 October 2018 (UTC)[reply]
And how does the system know what params were sent? I feel like I'm missing something. --Gonnym (talk) 15:19, 3 October 2018 (UTC)[reply]
All of the parameters in an {{#invoke:}} are passed to a lua module in the args table of its frame object. Parameters supplied to a template are available to a module in the args table of the template's frame object. local args = frame:getParent().args gets the template's parameters. Sometimes it is necessary to have both so sometimes editors create two args tables args for parameters in the {{#invoke:}} and pargs for parameters from the template. In this case, since the template parameters are the same as the {{#invoke:}} parameters, simplify the {{#invoke:}} and use only the template's parameters. The 'system' (whatever that is) knows which are which by where they are stored.
Trappist the monk (talk) 16:03, 3 October 2018 (UTC)[reply]
Ok, so I've played with this and it looks good. If the value is not added, or if left empty, the result is "nil". The first position accepts both a named and an unnamed param so I've copied your error. Is there anything I've missed? Test module here Module:Sandbox/Gonnym/sometest. Regarding the template though (User:Gonnym/sandbox/tests1), there is a constant error there "error: an article title is required." - any idea how to solve it? --Gonnym (talk) 19:52, 3 October 2018 (UTC)[reply]
That is a valid error message because there is no |name= (or {{{1}}}) in this:
{{#invoke:Sandbox/Gonnym/sometest|main}}
An error messages at the top of a template page is a common occurrence that happens because the template is processed without giving it any valid inputs. Those error message are ugly and rather meaningless in the no-valid-input context. To hide the error message, very often, the template wikitext will be wrapped in <includeonly>...</includeonly> tags:
<includeonly>{{#invoke:Sandbox/Gonnym/sometest|main}}</includeonly>
validateStringParam() still present in the module along with three mentions of it in the comments.
Trappist the monk (talk) 20:19, 3 October 2018 (UTC)[reply]
Yeah, I left that code until I got the go ahead from you that the rest was fine. Cleaned it now and will move it to real version. --Gonnym (talk) 21:44, 3 October 2018 (UTC)[reply]
For the second template which is used from the infobox {{Short description|{{User:Gonnym/sandbox/Test|{{{episode}}}|{{{season}}}|{{{series_no}}}|{{{series}}}|{{{multi_episodes}}}|{{{not_dab}}}}}}} - using the getArgs will take care of the empty string option but I'll still have to check for "nil" or "{{{{{{1}}}}}}" right? --Gonnym (talk) 22:05, 3 October 2018 (UTC)[reply]
You do know that you don't need my permission to do anything here, right?
That is the pain that comes with supporting both named and positional parameters. getArgs() returns nil for empty named and position parameters; the assigned value else. In the case of:
{{User:Gonnym/sandbox/Test|{{{episode}}}|{{{season}}}|{{{series_no}}}|{{{series}}}|{{{multi_episodes}}}|{{{not_dab}}}}}
if all of those positional parameters are 'empty' in the template call then they will hold the text strings '{{{episode}}}', '{{{season}}}', '{{{series_no}}}', etc. Do this instead:
{{User:Gonnym/sandbox/Test|{{{episode|}}}|{{{season|}}}|{{{series_no|}}}|{{{series|}}}|{{{multi_episodes|}}}|{{{not_dab|}}}}}
The piped parameter value passes an empty string to {{User:Gonnym/sandbox/Test}} when |episode= ... is empty or missing which then is turned into nil by getArgs().
Trappist the monk (talk) 22:39, 3 October 2018 (UTC)[reply]
I meant that as I used a code I wasn't familier with, I wanted to make sure I didn't miss something, so was waiting for your input. Regarding the second template, I want to move it to named params, so should I change it to this: {{User:Gonnym/sandbox/tests1|episode_num={{{episode}}}|season_num={{{season}}}|season_num_uk={{{series_no}}}|series_name={{{series}}}|multi_episodes={{{multi_episodes}}}|not_dab={{{not_dab}}}}} or just do {{{episode|}}}? --Gonnym (talk) 22:46, 3 October 2018 (UTC)[reply]
Oh Danny boy, the pipes, the pipes, are calling:
{{User:Gonnym/sandbox/tests1|episode_num={{{episode|}}}|season_num={{{season|}}}|season_num_uk={{{series_no|}}}|series_name={{{series|}}}|multi_episodes={{{multi_episodes|}}}|not_dab={{{not_dab|}}}}}
Yeah, I hate that earworm; and now its stuck in my head going round and round and round ...
Trappist the monk (talk) 22:57, 3 October 2018 (UTC)[reply]
Didn't know the song, so hearing it now :P I've updated the code and it seems to be working. Thanks again for all your help! --Gonnym (talk) 23:33, 3 October 2018 (UTC)[reply]
Something else that you might want to do because at least one of your modules is currently dependent on an infobox sandbox. Create live and sandbox versions of each or your templates and each of your modules. Sandbox templates {{#invoke}} sandbox modules while the live {{#invoke}} the live. In your modules where you are currently referring to the infobox sandbox do something like this:
local template_name = table.concat ({									-- make a data template name; sandbox or live
		'Infobox television episode',
		frame:getTitle():find('sandbox', 1, true) and '/sandbox' or ''	-- this module is ~/sandbox then append /sandbox
		}));
By doing this you never forget to tweak the infobox text when making new code live; sandbox infobox always calls template sandbox always calls module sandbox.
Trappist the monk (talk) 00:06, 4 October 2018 (UTC)[reply]
I'm assuming that for Module:Television episode disambiguation description you mean here: local shortDescription = extract.extract_from_template(frame, articleName, "Infobox television episode/sandbox"), but I'm not sure how exactly to add it to the other module and templates. Also, could you explain the "or ''" part? I understand that the find looks for the word "sandbox in the title" and subpage, but not sure what the OR does. --Gonnym (talk) 00:18, 4 October 2018 (UTC)[reply]
Yeah, in getShortDescription() just ahead of that line of code that you quoted.
find() returns an index number when successful; nil else. A number is 'true' so number and '/sandbox' returns '/sandbox'. When find() fails, it returns nil so nil and '/sandbox' returns nil. When the result is nil the concatenation will fail regardless of whether you do it with table.concat() or with the .. operator. The final bit then, nil or '', returns '' (an empty string which can be concatenated onto another string) so that the concatenation succeeds.
Trappist the monk (talk) 00:52, 4 October 2018 (UTC)[reply]
Ok, I've added it to my testing sandbox version and it works, but how do I actually test this? I'm not sure I understand how it works. Does it just search the article (|article=) if the infobox used is the /sandbox version? or does it do something else? --Gonnym (talk) 06:42, 4 October 2018 (UTC)[reply]
You missed the part where I wrote Create live and sandbox versions of each or your templates and each of your modules. For Module:Television episode disambiguation description create Module:Television episode disambiguation description/sandbox; do the same for the companion templates. Once the module is live you and/or other editors will make and test changes / improvements / fixes in the sandbox and then when done, copy the new sandbox version over the live version.
The code does not work in Module:Sandbox/Gonnym/sometest because find() does not find 'sandbox' in 'Sandbox/Gonnym/sometest'. frame:getTitle() returns the title of the {{#invoke}}d module. find() searches that title for the 'sandbox' text. Test it by making Module:Television episode disambiguation description = Module:Television episode disambiguation description/sandbox and {{Television episode disambiguation description}} = {{Television episode disambiguation description/sandbox}}. Because {{Infobox television episode}}{{Infobox television episode/sandbox}} when you give the same parameters to both of {{Television episode disambiguation description}} and {{Television episode disambiguation description/sandbox}}, the results should be different because {{Infobox television episode}} does not have {{short description}}.
{{Television episode disambiguation description/sandbox|name=User:Gonnym/sandbox/tests2|not_disambiguated=yes|link_only=yes}} → "User:Gonnym/sandbox/tests2"
{{Television episode disambiguation description|name=The End (Lost)|not_disambiguated=yes|link_only=yes}} → "The End (Lost)"
And then, as an aside, there is this:
{{Television episode disambiguation description|name=The End (Lost)|not_disambiguated=yes|link_only=yes}} → "The End (Lost)"
{{Television episode disambiguation description|The End (Lost)|yes|yes}}error: an article title is required.
Different result from what should ostensibly be the same inputs?
Trappist the monk (talk) 09:22, 4 October 2018 (UTC)[reply]

Created sandboxes for all 4 pages. Regarding this issue - is this a bug? To me this seem to be working as intended. "|yes|yes" is not an acceptable option as those don't accept unnamed params, while "|not_disambiguated=yes|link_only=yes" is working as intended, as the "link_only" section made sure that the code did not go to the template extraction section which produces the error. What do you think should be done here? --Gonnym (talk) 10:13, 4 October 2018 (UTC)[reply]

This is the problem with mixed named/positional parameters. I got the |yes|yes (it was |t|t) from one of your test pages. I guess that I would disallow positional parameters entirely; the documentation doesn't describe positional parameters so unless there is a compelling reason to do so, don't.
About the doc page:
  1. search for and remove |main
  2. if you are going to show what the template produces, use the template to do it:
    for the produces line write:
    * Produces: {{code|{{Television episode disambiguation description|name=Pickle Rick}}}}
    which gives this result:
    • Produces: "[[Pickle Rick]]", <span style="font-size:100%;" class="error">error: no short description text in: Infobox television episode in Pickle Rick</span>
Trappist the monk (talk) 14:45, 4 October 2018 (UTC)[reply]
I'm a bit confused. I've asked a few times how to do only named params and I've followed your instructions, so I really have no idea how else to do it... Also I don't understand why the "|main" needs to be removed from the doc? Isn't that how the module gets called? That isn't the template doc. --Gonnym (talk) 15:07, 4 October 2018 (UTC)[reply]
My confusion I guess because, at a glance, the two pages are nearly identical. I was thinking of the template page so that is what I was seeing – same reason that writers have editors, writers know what they wanted to write so that is what they see on the page whilst the editor sees what's on the page. I've tweaked my comments above. The point about having the template (or module) produce its actual output on the doc page stands. Consider adding {{Lua|Module:Television episode disambiguation description}} to the template doc page just below the {{Documentation subpage}} template.
{{Television episode disambiguation description/sandbox}} should call Module:Television episode disambiguation description/sandbox. These two should be distinguishable by their current error messages:
{{Television episode disambiguation description|name=Pickle Rick}} → "Pickle Rick", error: no short description text in: Infobox television episode in Pickle Rick
{{Television episode disambiguation description/sandbox|name=Pickle Rick}} → "Pickle Rick", error: no short description text in: Infobox television episode in Pickle Rick
Trappist the monk (talk) 15:58, 4 October 2018 (UTC)[reply]
I'm getting lost here. Lets break down the issues.
  1. Unnamed params - please explain how I should do this, if the current setup did not do it.
  2. How do I setup a sandbox doc? Template:Television episode disambiguation description/sandbox/doc?
  3. I'll add the real results as you say, but for Television episode disambiguation description I did want the show the behind the scene styling that it does - so maybe I'll just add another line.
  4. Template:Lua's doc says it is "used to show that templates have been converted to Lua.", but my template was never converted. Or does "converted" just mean "uses"?
  5. Do you know why the Pickle Rick example in sandbox didn't work?
--Gonnym (talk) 16:17, 4 October 2018 (UTC)[reply]
answers
  1. I vote for not accepting positional parameters so in Module:Television episode disambiguation description delete any reference to args[1]; same in ~/sandbox
  2. typically sandbox docs are the same as live docs; it is a sandbox after all. ~/testcases is the place to compare live versus sandbox
  3. I don't understand what you mean by behind the scene styling; that is what this is doing (or will do once the error message is resolved:
    {{code|{{Television episode disambiguation description|name=Pickle Rick}}}}
    "[[Pickle Rick]]", <span style="font-size:100%;" class="error">error: no short description text in: Infobox television episode in Pickle Rick</span>
    "Pickle Rick", error: no short description text in: Infobox television episode in Pickle Rick
  4. uses. Virtually all Lua based templates use {{Lua}}; it's a convenient way for other editors to get to the Lua source without having to open the edit window, copy the {{#invoke:}} parameter, and paste it to the browser address bar.
  5. Not sure what you mean; there is an error message for the live template because {{infobox television episode}} doesn't have {{short description}}; there is an error message for the sandbox template because the same reason (template sandbox should be calling the module sandbox which should be looking for {{infobox television episode/sandbox}}) but this will cause an error because Pickle Rick doesn't use {{infobox television episode/sandbox}}. A dedicated ~/testcases subpage that has both live and sandbox infobox templates may be required.
Trappist the monk (talk) 16:55, 4 October 2018 (UTC)[reply]
Template:Television_episode_disambiguation_description/testcases and Template:Television episode disambiguation description/testcases/test infoboxes
Trappist the monk (talk) 18:42, 4 October 2018 (UTC)[reply]
  1. Removed.
  2. Oh, I thought you wanted me to make a doc for the sandbox.
  3. I meant something like this Template:Television_episode_disambiguation_description/doc#Examples so that the style it does [[Pickle Rick|"Pickle Rick"]] is shown.
  4. Added to both templates.
  5. OK.
Anything else you can think of? --Gonnym (talk) 19:23, 4 October 2018 (UTC)[reply]
We must not be communicating. I don't think that:
[[The End (Lost)|"The End" (''Lost'')]], <short description>
is as useful to editors as:
[[The End (Lost)|"The End" (''Lost'')]], An episode of the sixth season of ''Lost'' – this is a mockup but it is what the real template will produce so that is what I think should be displayed at doc§Examples
Trappist the monk (talk) 21:49, 4 October 2018 (UTC)[reply]
Done. --Gonnym (talk) 07:04, 5 October 2018 (UTC)[reply]
Would using {{Lua}} on a module doc be correct usage? It says This module uses Lua: which is both correct and strange. I'm just looking for a way to nicely link to the module dependencies it uses. --Gonnym (talk) 09:36, 5 October 2018 (UTC)[reply]
Sigh. We are not communicating. I've tweaked Template:Television episode disambiguation description/doc. I've done dependency documentation a couple of ways see Module:Lang and Module:Citation/CS1.
Trappist the monk (talk) 10:04, 5 October 2018 (UTC)[reply]
Sometimes it's just easier to show an example. I'll update the module to follow your changes. Those 2 pages don't have any dependency documentation as far as I can tell. Lang does not say that it uses Module:No global and the other one doesn't seem to require any module to work. --Gonnym (talk) 10:11, 5 October 2018 (UTC)[reply]
Really? The data modules listed at Module:Lang are required for {{lang}} to work. So the modules listed at Module:Citation/CS1 are required so that all of the 20+ cs1|2 templates will work. I put Module:No globals in everything (everyone should) but properly written module code can get along without it.
Trappist the monk (talk) 10:31, 5 October 2018 (UTC)[reply]
Ah, I now see that Module:Language/name/data, Module:Lang/ISO 639 synonyms and Module:Lang/data are mentioned, while Module:No globals, Module:Arguments, Module:Unicode data and Module:Yesno do not and there are others mentioned in the doc which are not used by this module (they might be used by other module that pass this module their data). This wasn't what I meant though. What I meant by dependency list is literally that, a list of decencies used by the module. I guess I'll just use the Lua one for this. Thanks for the help! --Gonnym (talk) 10:44, 5 October 2018 (UTC)[reply]

New bugs / Issues

[edit]

References

[edit]

I just noticed that I'm getting a reference showing up as "Lost - Netflix". Netflix. Retrieved 24 November 2017.[permanent dead link]. Any idea why? --Gonnym (talk) 11:47, 4 October 2018 (UTC)[reply]

Seems that reference is listed in the infobox, so this might have to do with references added to the infobox. Just tested this theory and that is indeed the issue. --Gonnym (talk) 11:52, 4 October 2018 (UTC)[reply]
Fixed.
Trappist the monk (talk) 14:12, 4 October 2018 (UTC)[reply]
Nice! Thanks! --Gonnym (talk) 15:07, 4 October 2018 (UTC)[reply]
Ok, seems this is still lurking around. If the ref is in the form of <ref name="name" /> it will show up. --Gonnym (talk) 17:31, 8 October 2018 (UTC)[reply]
fixed I think.
Trappist the monk (talk) 22:15, 8 October 2018 (UTC)[reply]
One more: Using Template:sfn, so |series = [[The Huckleberry Hound Show]]{{sfn|Elk|1972|p=5}} will cause this to show up. --Gonnym (talk) 08:40, 9 October 2018 (UTC)[reply]
Would text = text:gsub ('{{sfn.*}}', '') be a good fix? It worked when I tested the string Lost{{sfn|Elk|1972|p=5}}, but not sure if I missed something that has to do with template expending or something else. --Gonnym (talk) 16:33, 10 October 2018 (UTC)[reply]
A variant of that does. I also added a test for {{#tag:ref}} parser functions and added that tag to your sandbox/tests2:
{{#invoke:Extract_short_description|extract_short_description|User:Gonnym/sandbox/tests2|Infobox television episode}}
error: no template: Infobox television episode in: User:Gonnym/sandbox/tests2
Trappist the monk (talk) 17:01, 10 October 2018 (UTC)[reply]
Hmm..why does your test produce "1st episode of the third season of The Huckleberry Hound Showtrue", while mine don't? --Gonnym (talk) 17:11, 10 October 2018 (UTC)[reply]
I'm assuming it has to do with the new code for the second return value, right? --Gonnym (talk) 17:23, 10 October 2018 (UTC)[reply]
Because extract_short_description() does not yet trap the second return value. Multiple return values from a module are converted to strings and concatenated into a single string without separators so true became 'true' and was tacked onto the end of the short description. I should probably trap that second return before someone makes a template that calls extract_short_description().
Trappist the monk (talk) 17:40, 10 October 2018 (UTC)[reply]
Ah. Yeah, but I'm sure that at least is an easy fix :) --Gonnym (talk) 07:01, 11 October 2018 (UTC)[reply]

Getting short description from Short description and Infobox template variations

[edit]

Hey, I was testing out a different function of yours to see if I can use it for something and found a bug with it.

I have in User:Gonnym/sandbox/tests2 the following code: {{Short description|{{Television episode short description|episode_num= 4|season_num=2 |series_name= [[Lost (2004 TV series)|Lost]]}}}}, which shows a short description on that page.
When I try and get that short description from another page using {{#invoke:extract short description|extract_short_description|article=User:Gonnym/sandbox/tests2 }}, I get {{Television episode short description|episode_num= 4|season_num=2 |series_name= Lost}}. It probably returns with a no wiki markup. --Gonnym (talk) 20:27, 7 October 2018 (UTC)[reply]

The extract_from_article() is doing exactly as it should do. It looks for the plain-text {{short description| and then returns whatever plain-text lies between the pipe and the closing }}. For your example, the plain-text is the unprocessed template: {{Television episode short description|episode_num= 4|season_num=2 |series_name= Lost}}. Why? Because this function is more-or-less a placeholder until someone decides what it is that it should do. I suppose that the obvious thing is to preprocess the {{short description}} templates and look for the short description <div>...</div> in the same way that extract_from_template() does.
Trappist the monk (talk) 21:06, 7 October 2018 (UTC)[reply]
... which means, of course, that this works:
{{#invoke:extract short description|extract_short_description|article=User:Gonnym/sandbox/tests2 |template=Short description}}
error: no template: Short description in: User:Gonnym/sandbox/tests2
Trappist the monk (talk) 23:01, 7 October 2018 (UTC)[reply]

Just to add more context. I was asking people from the short description project about how to deal with redirects, and it seems it's ok to add a short description to them. I could add an infobox, but I think it will be too big of a red flag for people to ignore, so adding the short description this way would be a good alternative. In my code Module:Sandbox/Gonnym/sometest I want to eventually be able to do local shortDescription = extract.extract_from_template() and if the return value is an error, do extract.extract_from_article(articleName) and get it from the short description one. So another issue is, how do you return me an error I know how to handle? --Gonnym (talk) 20:49, 7 October 2018 (UTC)[reply]

All of the error messages returned by the functions in module:extract short description are wrapped in <span>...</span> tags and given the class="error" attribute. So one way of determining that an error has occurred is to shortDescription:find ('class="error"', 1, true). Alternatively, extract_from_template() can return two values: the short description text or an error message for the first, and for the second, on success some non-nil value, nil else. These second returns would be ignored by extract_short_description() because we don't want to pass them back to the template.
Trappist the monk (talk) 23:01, 7 October 2018 (UTC)[reply]
Both options are great. So I'm thinking - sending a request with infobox name, if it returns error or nil, send the request again with short description. How does this sound? Also, what do you think is better, your "find error" option or the 2 return value option? (side question - how do I access more than 1 return value?) --Gonnym (talk) 04:57, 8 October 2018 (UTC)[reply]
Easier and quicker is the second return value. You might write:
local shortDescription
local good
shortDescription, good = extract.extract_from_template(article, template)
if good then 
	block
end
Trappist the monk (talk) 10:16, 8 October 2018 (UTC)[reply]

Another issue - Tricks and Treats (Hokey Wolf) has the infobox listed as "Infobox Television episode", the upper-case "T" causes the code not to recognize this. Is there an easy fix to this? --Gonnym (talk) 05:28, 8 October 2018 (UTC)[reply]

There are seven redirects for {{Infobox television episode}}:
{{Episode infobox}}
{{Infobox episode}}
{{Infobox Television Episode}}
{{Infobox Television episode}}
{{Infobox TV episode}}
{{Television Episode}}
{{Television episode}}
and two for {{Short description}}
{{SHD}}
{{Shortdescription}}
this ignores the case insensitive first character.
Perhaps the solution to this particular nut is to modify extract_from_template() so that instead of a string for the second argument it takes a table of templates and their redirects. You might write:
local templates = {'Infobox television episode', 'Episode infobox', 'Infobox episode', 'Infobox Television Episode', 'Infobox Television episode', 'Infobox TV episode', 'Television Episode', 'Television Episode', 'Short description', 'SHD', 'Shortdescription'} 
	
local good
shortDescription, good = extract.extract_from_template(article, templates)
if good then 
	block
end
extract_from_template() would loop through the list of template names until it found one in the article content. There is the advantage that you don't have to make one call into extract_from_template() for the infobox and then another call for the sd template. The list above is in canonical-first then alpha order; you would probably want to order the list by number of each redirect's transclusions.
Trappist the monk (talk) 10:16, 8 October 2018 (UTC)[reply]
Ok, so I went through the list of redirects and all these have no usages in any episode article (had to fix 4 episode links): Template:Episode infobox, Template:Infobox Television Episode, Template:Infobox TV episode, Template:Television Episode, Template:Television episode, Template:Infobox episode. This leaves only Infobox television episode and Infobox Television episode.

So the code is currently this:

	local templates = {
		'Infobox television episode',
		'Infobox Television episode',
		'Short description',
		'SHD',
		'Shortdescription'
	} 
	
		local good
		shortDescription, good = extract.extract_from_template(article, templates)		-- Call extract_from_template() from Module:Extract short description to get the short description.
		
		if good then 
			-- do something, return shortDescription?
		end
		-- need else?

-- what about this?
	local templateName = table.concat ({												-- Create a a variable of the correct template name - live or sandbox.
		'Infobox television episode',
		frame:getTitle():find('sandbox', 1, true) and '/sandbox' or ''					-- If this module is the ~/sandbox version, then append "/sandbox" to the template name to use its sandbox version.
		});

Questions

  1. How do I handle the sandbox code?
  2. Does "good" mean that extract found the short description? or can good also return your error?
  3. Do I need to handle an "else" case?

--Gonnym (talk) 16:41, 8 October 2018 (UTC)[reply]

answers:
  1. I'm not sure what you mean by the sandbox code
  2. From my original proposal above, I take it to mean that when good is not nil, then extract_from_template() thinks that the value returned in shortDescription is a short description. When extract_from_template() returns nil for good then shortDescription holds an error message.
  3. it is your code; you can do as you please with the returned values
You haven't said if you think that this two-returned-values scheme is a workable or desirable solution. Is it? Should I make extract_from_template() return a second value?
Trappist the monk (talk) 22:34, 8 October 2018 (UTC)[reply]
  1. The "sandbox code" is the "table.concat" part. Not sure how to handle this with the additional template names.
  2. Yes, you are correct. That was my question. I wanted to know how your proposal makes this works. So with "good not nil", the second return is a real short description, and with "good equals nil" the second return in an error message? Did I understand correctly?
    1. (replying to your last question) If the above is correct, and I'm sending you already the complete list of templates, I'm not sure this is even needed as your code does all the heavy lifting going through the templates, right?
  3. Please stop saying it's my code. I'm not asking for your permission, I'm asking, as your proposal still left me with answers of what happens if it's not good. But those have been addressed now and I've followed it with my first point here.
--Gonnym (talk) 08:02, 9 October 2018 (UTC)[reply]
answers:
  1. a redirect is unlikely to have its own sandbox so perhaps create a separate sandbox template list and choose that when appropriate:
    	local selected templates_table = templates;		-- assume that this is the live module so use the live templates list
    	if frame:getTitle():find('sandbox', 1, true) then	-- if this is a sandbox module
    		selected_templates_table = sandbox_templates;	-- use the sandbox templates list
    	end
    
  2. good is second return, not first; it reads left to right: first, second = function()
    1. if your code's next action is to always display whatever is returned from extract_from_template() then perhaps there is no need for a second return value. But, if you want to know that the text returned is a short description for I-don't-know-what-reason then perhaps the two-return-value mechanism should be implemented.
  3. You did not ask for permission and I did not give it. You did ask a question which obliges me to give you an answer. It is your code; it is not for me to tell you what what you should do with the values returned from extract_from_template(). I don't know what you should do because I am not intimately familiar with the workings of your code; you are, so the decisions are yours.
I shall modify extract_from_template() so that it takes a table of template names as its second argument and returns two values.
Trappist the monk (talk) 11:01, 9 October 2018 (UTC)[reply]
Currently I'll just return whatever I get from you, but I guess it's always good to have it handy in case a future requirement will arise where I actually do need to know if it found one or not. --Gonnym (talk) 15:00, 9 October 2018 (UTC)[reply]
Modified. extract_from_template() will take a string or a table as the second argument so it works with the current code but will also work when you give it a table of template names.
Trappist the monk (talk) 09:24, 10 October 2018 (UTC)[reply]
Nice, works good so far! --Gonnym (talk) 11:03, 10 October 2018 (UTC)[reply]

Malformed episode and season numbers

[edit]

If an episode or season number is followed any text, so url, template, or html tags (| season = 3[https://www.cnn.com]) then that number fails somewhere (probably in my code where I check if it's a number). Any thoughts on how to handle this? --Gonnym (talk) 08:46, 9 October 2018 (UTC)[reply]

if |season= is always numerical and plain-text then perhaps:
season = args['season']:match ('%d+');
I suppose that it is equally as likely that you might have |season=[[article title|6]]. For that case you will need something a bit more complex. In Module:Citation/CS1/Utilities is a rather obtuse function remove_wiki_link() (I was not the author – it works reliably so I have not felt the need to rewrite it).
Trappist the monk (talk) 11:17, 9 October 2018 (UTC)[reply]
That match pattern is actually pretty useful. I can use it to also replace string.match(doubleEpisodeNumberText, '(%d+) *[.,&/and]+ *%d+') and string.match(number, '(%d+) *.*') - thanks!

One issue still lingering around with this and this is an extream edge-case (I think), but would like to solve this. Currently, this works nice and catches valid number, as well as linked and pipped linked numbers. However, if no valid number is added, but a url (such a reference with a url) and that url has a number in it, the number will be catched. I can't test for a valid number, as multi episodes are written as a string. Maybe check if the value starts with a number? so 3[some url with numbers] will return "3", "3 and 4" will return "3", and [some url with numbers] will return "nil". I could change the pattern to ^%d+, but that would ignore the linked cases (which also start with a bracket as do URLs). Any thoughts on this? --Gonnym (talk) 07:42, 11 October 2018 (UTC)[reply]

Examples?
Trappist the monk (talk) 09:36, 11 October 2018 (UTC)[reply]
Template:Television_episode_short_description/testcases Malformed value: Episode without a number but with a url with numbers and Malformed value: Season without a number but with a url with numbers --Gonnym (talk) 10:57, 11 October 2018 (UTC)[reply]
References in <ref>...</ref> tags are extracted from the wikitext to be restored at a later time. To mark where those references belong, MediaWiki inserts stripmarkers that look more-or-less like this:
?'"`UNIQ--ref-00000000-QINU`"'? – the two question marks there are actually 0x127 the ascii delete character; the string of digits is the unique hexadecimal identifier
You might do this to those parameters that are likely to get contaminated with <ref>...</ref> tags (or anything else that produces a stripmarker):
for _, v in ipairs ({'episode_num', 'season_num', 'season_num_uk', 'series_name'}) do
	args[v] = args[v] and args[v]:gsub ('\127[^\127]*UNIQ%-%-(%a+)%-%x+%-QINU[^\127]*\127', '')	-- remove all stripmarkers
end
Trappist the monk (talk) 11:54, 11 October 2018 (UTC)[reply]
That worked, but it didn't solve the plain url issue (Malformed value: Season without a number but with a url with numbers). I tried adding args[v] = args[v] and args[v]:gsub('[^http.-]', '') to the previous code but it didn't work. I guess I'm not understanding how exactly gsub works or just missing something else. Any idea? --Gonnym (talk) 11:05, 14 October 2018 (UTC)[reply]
Figured it out. Thanks for all the help. I think we've finally finished all the issues with these modules :) --Gonnym (talk) 12:14, 14 October 2018 (UTC)[reply]

(edit conflict)

args[v]:gsub('[^http.-]', '') removes any character that is not 'h', nor 't', nor 'p', nor dot, nor hyphen.
There are two forms of external wikilink markup: [url label] and [url] so this supports both; urls are not restricted to only the http and https schemes, consider //example.com; also to avoid confusion, wikilink markup is stripped here before ext link markup is stripped. Post-ec, my alt solution:
for _, v in ipairs ({'episode_num', 'season_num', 'season_num_uk', 'series_name'}) do
	if args[v] then
		args[v] = args[v]:gsub('\127[^\127]*UNIQ%-%-(%a+)%-%x+%-QINU[^\127]*\127', '')			-- remove all stripmarkers
		args[v] = args[v]:gsub('%[%[[^|]+|([^%]]+)%]%]', '%1');									-- remove wikilink retain label
		args[v] = args[v]:gsub('%[%[([^%]]+)%]%]', '%1');										-- remove wikilink retain article
		args[v] = args[v]:gsub('%[%S+ +([^%]]-)%]', '%1');										-- remove urls retain label
		args[v] = args[v]:gsub('%[[^%]]-%]', '');												-- remove all remaining urls
		if '' == args[v] then
			args[v] = nil;																		-- unset empty strings
		end
	end
end
Trappist the monk (talk) 12:36, 14 October 2018 (UTC)[reply]
Wow, that's a pretty elegant solution to checking most of what I need. Just to double check with you, the 2nd and 3rd lines are there to replace part of the code I did in getUnformattedSeriesName()? I commented out the lines I thought it replaced and indeed the code stayed the same, but double checking with you to see if it was intended. (does the "label" in "retain label" mean the text after the pipped link?)--Gonnym (talk) 13:10, 14 October 2018 (UTC)[reply]
No, those two lines are there so that the remove-all-urls line isn't confounded by wikilink markup; without those lines, valid wikimarkup can be corrupted. Wikilinks have one or two parts: always a link and sometimes a label → [[link]] and [[link|label]]. It occurs to me to wonder if it isn't appropriate to strip all html markup here as well.
Trappist the monk (talk) 14:22, 14 October 2018 (UTC)[reply]
Do you have an idea then why when I comment out both string.match(tvSeriesName, "|(.-)]") and string.match(tvSeriesName, "%[+(.-)]"), the names still end up correctly? --Gonnym (talk) 05:20, 15 October 2018 (UTC)[reply]
Because the work that would have been done by those two string.match() lines has already been done by remove-wikilink-retain-label and remove-wikilink-retain-article. Those two lines must be there because when args[v] is set to [[article|label]] or to [[article]], the line at remove-all-reaming-urls returns ] – we want that line to remove urls not wikilinks – so the two forms of wikilink must be dispatched first.
Trappist the monk (talk) 08:54, 15 October 2018 (UTC)[reply]
Ok, got it. So with the args cleaning code, there is no need for my previous string.match code (these two lines), right? --Gonnym (talk) 09:00, 15 October 2018 (UTC)[reply]
Right.
Trappist the monk (talk) 10:06, 15 October 2018 (UTC)[reply]
I should probably move string.match(tvSeriesName, "(.-)<sup class") to the arg cleaning code as well. I've added this: args[v] = args[v]:gsub('<sup class.-</sup>', '');. It seems to work. 2 questions - Does it matter where in the cleaning code list it's listed? And what function do semi-colons have here? All other parts of the code don't have so I feel like I'm missing something. --Gonnym (talk) 10:27, 15 October 2018 (UTC)[reply]
I was thinking of something more like:
args[v] = args[v]:gsub('</? *br */?>', ' ');										-- replace <br /> (and variants) with space charater
args[v] = args[v]:gsub('%b<>[^<]+%b<>', '');										-- remove html markup
args[v] = args[v]:gsub('%b<>', '');													-- remove self-closed html tags
I don't think that it matters much where in the list of cleanup you do html removal though I would not breakup the current paired sequences so just after the stripmarker removal or just before the empty string test.
Habits die hard; too many years writing C which requires terminal semicolons. Lua doesn't care.
Trappist the monk (talk) 11:48, 15 October 2018 (UTC)[reply]
Yeah, I felt weird writing without it also as I'm from a Java background :) --Gonnym (talk) 11:55, 15 October 2018 (UTC)[reply]

Malformed series title

[edit]

If a series title is followed by {{ref|Alpha|α}} (| series = [[The Huckleberry Hound Show]]{{ref|Alpha|α}}) the series title will be "α". --Gonnym (talk) 08:46, 9 October 2018 (UTC)[reply]

I've tried running this code in the console inside my getUnformattedSeriesName() function, but it does not create "α", so I have no idea really what is causing this. --Gonnym (talk) 09:23, 9 October 2018 (UTC)[reply]
What code is this code? Link to where I can see the problem in action?
Trappist the monk (talk) 11:23, 9 October 2018 (UTC)[reply]
User:Gonnym/sandbox/tests2 is where you can see this. "this code" meaning, ([[The Huckleberry Hound Show]]{{ref|Alpha|α}}. --Gonnym (talk) 11:27, 9 October 2018 (UTC)[reply]
This bit of Module:Television episode short description getUnformattedSeriesName():
local unformattedName = string.match(tvSeriesName, "|(.-)]")
where tvSeriesName holds this:
[[The Huckleberry Hound Show]]<sup class="reference plainlinks nourlexpansion" id="ref_Alpha">[[#endnote_Alpha|α]]</sup>
templates inside another template are expanded before the enclosing template is expanded.
Trappist the monk (talk) 12:02, 9 October 2018 (UTC)[reply]
Do templates always expend with <sup class? If so, this works for that: = string.match('string', "(.-)<sup class"). Also, how are you able to do advanced debugging here? I can only figure out how to use the command in in the console but that doesn't let me see things like the expended template code. --Gonnym (talk) 12:45, 9 October 2018 (UTC)[reply]
No. Templates expand to whatever they are supposed to expand to. Your {{Television episode short description}} doesn't expand to <sup class though {{ref}} does.
There is no advanced debugging. I found this by inserting error (tvSeriesName) at line 192 of Module:Television episode short description, inserting User:Gonnym/sandbox/tests2 in the 'Preview page with this module' box, and clicking the Show preview button.
Trappist the monk (talk) 14:47, 9 October 2018 (UTC)[reply]
That might not be advanced for you, but I did not know about that error producing code. That is pretty useful - thanks! Ok, so each template will have a different code. Hopefully this is the only one causing problems so I can fix it specifically. Thanks again for solving this. --Gonnym (talk) 14:57, 9 October 2018 (UTC)[reply]

Testcases issue

[edit]

I feel like Template:Television episode disambiguation description/testcases isn't working as intended. I know that it won't work because the pages we are calling don't have a sandbox version, but then this is won't ever be helpful for testing. Any idea how we can make these tests actually work?--Gonnym (talk) 07:03, 11 October 2018 (UTC)[reply]

You can comment-out or remove the sandbox test from getShortDescription(). You can invent some sort of a parameter that Template:Television episode disambiguation description/sandbox would hand to the sandbox module to enable / disable that same code. Now that the infobox has the short description code, discriminating between its live and sandbox versions may no longer be necessary. If you delete the sandbox test from getShortDescription(), the testcase that depends on it should be deleted as should Template:Television episode disambiguation description/testcases/test infoboxes.
Trappist the monk (talk) 09:34, 11 October 2018 (UTC)[reply]

Maintenance category

[edit]

Do you know if it's possible to add a maintenance category to an article from the module? If it's possible, I'd like to add a sub-category to Category:Articles with short description for easier tracking. --Gonnym (talk) 11:57, 15 October 2018 (UTC)[reply]

Of course. Concatenate where appropriate '[[Category:<name of maint cat here>]]'. Must be part of the return from the template so must be part of the return from the module.
Trappist the monk (talk) 12:13, 15 October 2018 (UTC)[reply]
Nice, works good! Is there a function to get from the frame the namespace from where the module call was made? So the template pages listed at Category:Television episode articles with short description won't get added? --Gonnym (talk) 12:47, 15 October 2018 (UTC)[reply]
Are you sure that's what you want? How is Category:Television episode articles with short description different from Special:WhatLinksHere/Module:Television_episode_short_description? Isn't it more interesting and useful to create a maintenance category that lists page where maintenance is required? So when returning an error message the error message contains an appropriate category link.
To get namespace text: mw.title.getCurrentTitle().nsText. You might look at Module:Webarchive and Module:Webarchive/data to see how I handled error categorization with limited namespaces, subpages, and exceptions to the subpages limit.
Trappist the monk (talk) 13:06, 15 October 2018 (UTC)[reply]
The model I was thinking of is this: there is a Category:Articles with short description "maintenance" category, which is more of a tracking category. I created a child tracking category of Category:Television episode articles with short description. In it, I have 3 maintenance categories (articles in it should be fixed) and 2 tracking categories. I don't know how to set a hidden tracking category so I just copied their maintenance method. I'll take a look now and see what you did. If you have any suggestions about what I wrote I'm happy to hear. --Gonnym (talk) 13:16, 15 October 2018 (UTC)[reply]
You might want to add {{empty category}} under {{Wikipedia category|hidden=yes}} to the 'maintenance' cats because empty categories are subject to deletion. I wonder if {{Wikipedia category}} (in all of your categories) should be replaced with the less specific {{tracking category}} because these categories are for the maintenance of the template not the maintenance of Wikipedia:WikiProject Short descriptions.
Trappist the monk (talk) 13:34, 15 October 2018 (UTC)[reply]
I've taken your code and it seems to work, but I'm thinking I should probably go about this the other way and just check for the allowed namespace (as those are 2 entries vs the much more non-allowed). I need to get the regular namespace and the draft one. The draft one I know, but what namespace does the regular one use? --Gonnym (talk) 13:51, 15 October 2018 (UTC)[reply]
mw.title.getCurrentTitle().namespace should return 0 for mainspace and 118 for draft. I chose not to use the numbered version because numbers don't convey immediate understanding to someone reading the code. Similarly, you can test nsText as an empty string:
local ns = mw.title.getCurrentTitle().nsText;
if '' == ns or 'Draft' == ns then
	-- block
end
Trappist the monk (talk) 14:32, 15 October 2018 (UTC)[reply]
Yes, I agree, I also prefer named variables. Just to make sure I understood correctly, an empty string is the default namespace? --Gonnym (talk) 14:40, 15 October 2018 (UTC)[reply]
Yes.
Trappist the monk (talk) 15:12, 15 October 2018 (UTC)[reply]

Ok, so there is a serious issue with my code. A user reported seeing the category added to the description but I couldn't view it. After various tests I could find one instance of this happening. Steps to reproduce:

  1. Change your version to a mobile Wikipedia version - "https://en.m.wikipedia.org/wiki"
  2. Go to the search bar.
  3. Write "Dinner Party" in the search bar.
  4. Look for The Office episode result (for me it was the 5th).

Result: The category is added to the end of the short description.

Important to note that regular short descriptions (such as "5", the number) don't show their category. Template:Short description in their code used "includeonly" tags. Should I add those? Have any idea how we can fix it? --Gonnym (talk) 07:05, 16 October 2018 (UTC)[reply]

Adding includeonly tags didn't work. --Gonnym (talk) 07:21, 16 October 2018 (UTC)[reply]
Short description template: {{#ifeq:{{{1|}}}|none||<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>[[Category:{{{pagetype|{{pagetype|defaultns = extended|user = no}}}}}s with short description]]</includeonly>
My code: {{Short description|{{Television episode short description|episode_num={{{episode|}}}|season_num={{{season|}}}|season_num_uk={{{series_no|}}}|series_name={{{series|}}}|multi_episodes={{{multi_episodes|}}}|not_dab={{{not_dab|}}}}}}}
So the problem seems to me to be that the short description template has their category outside the short description code, while my category gets added as part of the code itself. Is there a way for me to return two values from the module and then add one to the infobox and one to the short template? That won't be my first option, as that means that only infobox usages would get categorized and not usages without it (like the ones I do when I create a redirect description (Into the Ring)), but if that's the only way then it is better than nothing I guess. --Gonnym (talk) 07:29, 16 October 2018 (UTC)[reply]
Also ignores italic markup for series name and displays article titles that should be italicized, The Dinner Party (play), without italics. I think that this suggests that use of wiki-markup in short description text may not be allowed. Surely that limitation is documented someplace?
Modules return a single string so Module:Television episode short description returns the short description onto which is concatenated the category. {{short description}} stuffs all of that into the short description <div>...</div> tags. Templates don't have local variables so it may be that you will have to modify the module to take another parameter, perhaps |return=[sd|cat], instructing it to return either the short-description text or a category; in essence {{#invoke:}} the module twice, once inside {{short description}} with |return=sd (module returns only short description text), and then again outside {{short description}} with |return=cat which returns only the category text. This would seem the quick solution. Another alternative may be to preprocess {{short description}} in the module and then return the preprocess results with your categories appended.
Trappist the monk (talk) 09:19, 16 October 2018 (UTC)[reply]
The documentation does not talk about wiki-markup in either of the 3 pages Wikipedia:Short description, Wikipedia:WikiProject Short descriptions or Template:Short description. Only thing which is mentioned in Wikipedia:Short description#Content is that links shouldn't appear there. To me not allowing italics seems like a bug rather than a feature, hopefully... Regarding your solutions - is the first one an expensive operation? Is that solution viable? Regarding the second, I don't quite understand what is happens there, can you elaborate? --Gonnym (talk) 09:37, 16 October 2018 (UTC)[reply]
Categories are links. is the first one expensive? only in that it doubles the time it takes to accomplish the task which, for this task is short, so not an issue. Is that solution viable? Yeah, I think so, else I wouldn't have suggested it.
Inside a module it is possible to 'execute' a template by giving it the necessary parameters. In this case, we want to execute {{short description}} so we might write something like:
local sd_text, sd_cat = createDescription (...);								-- returns two values instead of the concatenation that is done now
local t = {};
table.insert (t, sd_text);														-- table for short description parameter
return frame:expandTemplate ({title='short description', args=t}) .. sd_cat;	-- return expanded short description with category
the above not tested.
Trappist the monk (talk) 10:42, 16 October 2018 (UTC)[reply]
I've been playing around with User:Gonnym/sandbox/tests2 and Module:Television episode short description/sandbox, and managed to shorten the amount of code in the 2nd call quite a bit by removing all the "understanding" of the values to simple checks of "is a correct value there?" (only for the cat call). I have a few questions:
  1. From your two proposals, which method would you recommend going with?
  2. If the 2 call approach is the one, should I write a wrapper template (as can be seen at User:Gonnym/sandbox/tests2) and call that from the infobox, or put both lines in the infobox itself?
    1. Would a name such as "Television episode short description wrapper" be good or do you have a different suggestion?
  3. I have a small bug where the short description appears on a different line. No idea why. I've tried removing the includeonly tags but that didn't solve it. This can be seen at User:Gonnym/sandbox/tests#Tests. not a bug, forgot I was using the short description template there. --Gonnym (talk) 11:20, 16 October 2018 (UTC)[reply]
Were it me, I'd do it all in the module so I didn't have to create yet another template (and figure out what to call it).
Trappist the monk (talk) 11:30, 16 October 2018 (UTC)[reply]
I'm probably missing something here as this is still causing the same issue. View User:Gonnym/sandbox/tests1 in the mobile search results. --Gonnym (talk) 11:51, 16 October 2018 (UTC)[reply]
In the module you executed {{short description}}. Then in your test page you did it again which gives you this result:
<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">1st episode of the second season of ''Lost''</div>[[Category:pages with short description]][[Category:Television episode articles with short description for single episodes]]</div>[[Category:pages with short description]]
Get rid of the {{short description}} call in your test page.
Trappist the monk (talk) 12:17, 16 October 2018 (UTC)[reply]
Ah, I had a feeling I didn't fully understand what you meant! Thanks! So just to double check - frame:expandTemplate {title='short description' - means that the template titled "short description" is being used right? Also, what is "t"? I understand its an array of something but can't understand what. Or does the function table.insert (t, sd_text) take "t" and inserts "sd_text" into it, and then that "t" is passed as args to the short description template? --Gonnym (talk) 12:57, 16 October 2018 (UTC)[reply]
args= in the frame:expandTemplate() call must be a table; sd_text is a string. We can alternately write:
local sd_text, sd_cat = createDescription (...);								-- returns two values instead of the concatenation that is done now
local t = {sd_text};															-- table for short description parameter
return frame:expandTemplate ({title='short description', args=t}) .. sd_cat;	-- return expanded short description with category
which is perhaps better.
Trappist the monk (talk) 13:12, 16 October 2018 (UTC)[reply]
I did find [1] which says The description is plain text, on a single line, but otherwise arbitrary (potentially including raw HTML tags, which also should be interpreted as plain text). It must not be used in HTML unescaped!, which is a shame then as it conflicts with the Manual of Style guidelines on when to italicize names. --Gonnym (talk) 09:48, 16 October 2018 (UTC)[reply]
Too bad, that. I had been wondering if there was a solution in wrapping the category link in <span style="display:none">...</span>.
Trappist the monk (talk) 10:42, 16 October 2018 (UTC)[reply]

Short description appearing on Infobox television episode

[edit]

How can I stop the short description appearing on Template:Infobox television episode? --Gonnym (talk) 07:19, 16 October 2018 (UTC)[reply]

Did you try wrapping {{short description}} in <includeonly>...</includeonly> tags?
Trappist the monk (talk) 09:21, 16 October 2018 (UTC)[reply]
I was leaning on going in that direction, but after messing up with the categories I wanted to make sure that was the correct way. --Gonnym (talk) 09:38, 16 October 2018 (UTC)[reply]

Testcases

[edit]

The the sandbox version at Module talk:Television episode short description/testcases are messing up the results. There probably is nothing to do here other than copy the div tag and expected category, but double checking with you if you might know of a different approach. --Gonnym (talk) 06:34, 18 October 2018 (UTC)[reply]

Well, yeah... An alternate is to compare sandbox to live; one test instead of two:
function p:test_sandbox_v_live()
	self:preprocess_equals_preprocess_many('{{#invoke:Television episode short description/sandbox|getShortDescription', '}}', '{{#invoke:Television episode short description|getShortDescription', '}}', {
		{''},
		{'|series_name=Lost'},
		{'|series_name=Lost |season_num=1'},
		{'|series_name=Lost |season_num=5 |episode_num=4'},
		{'|series_name=[[Firefly (TV series) |Firefly]] |season_num=1 |episode_num=1'},
		{'|series_name=Lost |season_num=3 |episode_num=22 and 23 |multi_episodes=yes'},
		{'|series_name=Randall and Hopkirk (Deceased) |season_num=1 |episode_num=1 |not_dab=yes'},
	}, {nowiki=1})
end
Trappist the monk (talk) 08:23, 18 October 2018 (UTC)[reply]
Thanks! I did that but I also added a test param as I still wanted to be able to see the module only output (and also to stop the testcase page from being added to a short description category). --Gonnym (talk) 10:54, 18 October 2018 (UTC)[reply]

noreplace

[edit]

Hopefully this is the last issue. I'm trying to add the "noreplace" param to the short description template. It should look like this: {{short description|<text>|noreplace}}, so in the module I wrote it as local tableData = {shortDescription, 'noreplace'} (I tried also "|noreplace"), but it didn't work. I had to test it on a live article as the short description (from preferences -> Gadgets -> Show page description beneath the page title (not compatible with Page assessments gadget)) doesn't show up on other namespaces, so I tested it on Dinner Party (The Office) (undid my test code so it won't show up here anymore). What am I doing wrong here? --Gonnym (talk) 10:54, 18 October 2018 (UTC)[reply]

Strange..I tested it on another article Macbeth (Hallmark Hall of Fame 1954) and it works. --Gonnym (talk) 10:59, 18 October 2018 (UTC)[reply]
Very. I have undeleted test page and placed in it the {{short description}} and {{infobox television episode/sandbox}} templates from Dinner Party (The Office) where it appears that the gadget and the templates are doing the right thing.
I added test print of the parameter values passed into {{short description}} each time it is called and then previewed test page and got this:
p1: 13th episode of The Office p2:
p1: 13th episode of the fourth season of The Office p2: noreplace
so now we know that your tweak to the module appears to be correct.
Then I re-hijacked dinner party, did the same test and got:
p1: 13th episode of The Office p2:
p1: 13th episode of the fourth season of The Office p2: noreplace
and, argh!, got this for the gadget's short description display:
13th episode of The Office, From Wikipedia, the free encyclopedia
I hate stuff like this; I could see that it was broken in your hijacked version before I re-hijacked but now it's not broken.
If it ain't broke, I can't fix it.
Let me know when you have read this so that I can delete and re-protect test page (feel free to muck around in it while its use might be of benefit); you can revert my re-hijack when you're ready.
Trappist the monk (talk) 12:39, 18 October 2018 (UTC)[reply]
I thought I might have remembered incorrectly that it was broken, but if you saw it also. Strange. Maybe it took a while to purge the cache or something. Hopefully it wasn't a true bug and it will now work. Thanks for taking the time to checking this with me! --Gonnym (talk) 13:04, 18 October 2018 (UTC)[reply]
Still broken? See these:
first hijack
first revert
second hijack
second revert
All same. Is it possible that MediaWiki retrieves the current version of the short description from its database and applies that to all older versions regardless of their use or non-use of {{short description}}? The current version of the short description would then be the text that was created when the page was last saved. Perhaps the 'last saved' version that caused the confusion was the version where you tried '|noreplace' which would have been ignored: {{SHORTDESC:foo||noreplace}}.
Trappist the monk (talk) 13:32, 18 October 2018 (UTC)[reply]
That actually sounds like it might be the case. A comment here says If you want to be pedantic, the magic word doesn't actually do anything. There is code that reads the magic word's value and stores it in the database, just as there is code that reads the database and renders it. It's just as important to be able to see the complete flow of information from wikitext to database to rendered page as it is to see the compartmentalised view. That flow happens for the magic words, just as it does for any other piece of wikitext. As far as users are concerned, they won't worry about how the backend works. --Gonnym (talk) 13:41, 18 October 2018 (UTC)[reply]

Unwanted new-line

[edit]

If you look at the examples here you can see that the results are shown on a new line. When I test the code with my test param (adding "|test=yes" to the invoke) which bypasses the frame:expandTemplate code the results are on the same line (User:Gonnym/sandbox/tests#Tests). I can't seem to figure out how to fix this. Do you know if this is even possible to fix? --Gonnym (talk) 10:36, 22 October 2018 (UTC)[reply]

At Module:Television_episode_short_description#Examples the 'Produces:' lines are all blank
{{#invoke:Television episode short description|getShortDescription}} → ++ – there is an {{#invoke:...}} between the '+' characters
Is this not a more worrisome problem?
Trappist the monk (talk) 10:47, 22 October 2018 (UTC)[reply]

The invisible was me; I'd turned off the necessary css that shows the short description text. The 'newlines' aren't really newlines; they are an artifact of <div>...</div> tags when not on a line by themselves:

top line of text followed by div on its own line: 
<div>div on its own line</div>
and <div>div on the same line</div>

top line of text followed by div on its own line:

div on its own line

and

div on the same line

Trappist the monk (talk) 11:14, 22 October 2018 (UTC)[reply]

Ok, so not something to worry about and just set the doc text so it will be on its own line? --Gonnym (talk) 12:05, 22 October 2018 (UTC)[reply]
Ah but it also ignores the <code> tags. --Gonnym (talk) 12:06, 22 October 2018 (UTC)[reply]
In html, <code>...</code> tags are not permitted contain <div>...</div> tags. But for the documentation, do you really want to be using the expanded-template output? Doing that requires readers to disable the display:none style attribute with their own private css else all they see is a blank after the 'Produces' text.
Trappist the monk (talk) 12:50, 22 October 2018 (UTC)[reply]
Oh, I didn't even think about that. Are you suggesting that I use the |test param then? Not sure if that was what you meant. --Gonnym (talk) 12:52, 22 October 2018 (UTC)[reply]
Because all that |test= does (right now) is skip frame:expandTemplate(), which is what you want for documentation, perhaps create a parallel parameter, |doc=, for use on doc pages. I think that:
{{#invoke:Television episode short description|getShortDescription|test=yes}}
might cause more confusion than:
{{#invoke:Television episode short description|getShortDescription|doc=yes}}
This will also allow you to expand the functionality of |test= without adversely impacting the documentation.
Trappist the monk (talk) 13:10, 22 October 2018 (UTC)[reply]
Good idea, using that. Thanks! --Gonnym (talk) 13:31, 22 October 2018 (UTC)[reply]

Coding standards

[edit]

BTW, I just came across this module code and I remembered our conversation about coding standards. Module:Episode list has a main function that is 261 lines long (the whole module is basically 1 function); has a mix of CamalCase (getArgs), snake_case (contrast_ratio), joined words (yesno), unintelligible (mm) and other (HTMLcolor) param names; Uses bad control flow ("local EpisodeNumber,EpisodeNumber2,Title,Aux1,DirectedBy,WrittenBy" etc all in one line); Inconsistent (and bad) use of white spaces; Declaring variables in a seemingly arbitrary fashion and not near when they are actually used, and some (return_table) not even used at all. Now that is a nightmare code to maintain. --Gonnym (talk) 08:15, 6 October 2018 (UTC)[reply]

template:user x and template:user x/doc

[edit]

What's the problem that needs to be solved? Hyacinth (talk) 20:11, 22 October 2018 (UTC)[reply]

Thank you for saying thanks. Hyacinth (talk) 20:47, 22 October 2018 (UTC)[reply]

Lang tags in citation templates without noitalic

[edit]

I just reviewed one of your AWB edits, and, adding the {{lang|zh-hans| }} tag does not introduce a CS1 error category: [2]. CaradhrasAiguo (leave language) 17:01, 23 October 2018 (UTC)[reply]

You are correct it doesn't. However, in this:
{{citation
  | author = Shen Zhongwei ({{lang|zh-hans|沈钟伟}})
  | title = The origin of Mandarin
  | journal = Journal of Chinese Linguistics | volume = 39 | number = 2 | year = 2011 | pages = 1–31
  | jstor = 23754434
  | ref = none
  | postscript = .
  }}
the author metadata that results from |author=Shen Zhongwei ({{lang|zh-hans|沈钟伟}}) looks like this:
&rft.au=Shen+Zhongwei+%28%3Cspan+lang%3D%22zh-Hans%22+title%3D%22Chinese+language+text%22%3E%E6%B2%88%E9%92%9F%E4%BC%9F%3C%2Fspan%3E%29
That key/value pair contains all of the percent encoded html produced by {{lang}}; the html is not the name of the author and does not belong in the metadata. {{Lang}}, right at the top of its documentation clearly states that that template is not to be used in cs1|2 templates. Similarly, the cs1|2 template documentation also discourages template use within parameters that are made part of the metadata; see Template:Citation#COinS.
Trappist the monk (talk) 17:23, 23 October 2018 (UTC)[reply]
So, a better solution could be to incorporate script-FIELD variants for all appropriate CS1 fields, beyond title and chapter to author, publisher, etc. CaradhrasAiguo (leave language) 17:29, 23 October 2018 (UTC)[reply]
Aye, perhaps. A quick search through the Help talk:Citation Style 1 archives show that the topic hasn't been much discussed. Here are the discussions my quick-search found:
Trappist the monk (talk) 20:02, 23 October 2018 (UTC)[reply]

Webarchive international

[edit]

Hi, was wondering if there were plans for exporting the new template to other languages or what the procedure or process is. Does it just happen organically with users from other projects copying it and adjusting the language tables? -- GreenC 15:23, 30 October 2018 (UTC)[reply]

None that I know of. Isn't it usually the other way round? Editors at one language wiki import from another language wiki. The importing process (not copy/pasta) preserves article histories which, as I understand it, has something to do with copyright and / or attribution – I don't know the details of that (nor do I particularly want to). Without either of us doing anything, {{webarchive}} and its modules are being used on a bunch of different language wikis (see the list of languages in the left side-bar.
Trappist the monk (talk) 10:21, 31 October 2018 (UTC)[reply]
Yeah I did see that and was surprised to see it being used in other wikis which is why my original design didn't take static language strings into account just embedded in the main code, which in hindsight is a mistake probably for any template. So maybe the least we can do is post a notification on the other language talk pages that a new version with i18n support and bug fixes is available. Assuming you think it's ready. -- GreenC 14:09, 31 October 2018 (UTC)[reply]
Alas, not ready. See User_talk:Trappist the monk/Archive 7#Module:Webarchive 2 for which I haven't yet found a good solution.
Trappist the monk (talk) 15:38, 31 October 2018 (UTC)[reply]
I'm not sure how many lines of text like that you have, but in mobile when there needs to be translation of strings, we do something similar to what that user suggested. Each language has its own translation and order of pieces of text and the variable values are placed into pre-determined spots. So in English you'd have Archived $date, at the Wayback Machine and in Bengali you'd have At the Wayback $date archived. You can create a function that retrieves the correct message by the language passed to it and knows how to format the text and date. Either that or make sure all the text strings are in standalone functions (and not in the middle of other functions) and write in the documentation that when importing the module those need to be overridden with local syntax. --Gonnym (talk) 16:03, 31 October 2018 (UTC)[reply]
(edit conflict with Gonnym). Yeah, that's a difficult twist. Depending how many many possible combinations there are, instead of the function building a literal string, it builds a string containing a macro(s) and date variable(s), which is expanded by another function which is informed by a site-specific data table. Sort of like a mini DSL. -- GreenC 16:05, 31 October 2018 (UTC)[reply]

Code clarification

[edit]

Hey, in your code in Module:Extract short description you have:

template_name_pattern = template_name:gsub ('^%a', string.lower):gsub ('^%a', '%[%1%1%]'):gsub ('%[%a', string.upper); -- make lua pattern for initial letter upper or lower case: A -> [Aa]

I'm using that snippet for something similar but I'd like to fully understand it. Would you mind explaining what it does in each gsub? (In my code I'd like to split them into 3 lines) Thank you. --Gonnym (talk) 12:15, 8 November 2018 (UTC)[reply]

gsub ('^%a', string.lower) → if the first character of template_name is an alpha character, make it lowercase: Bb
gsub ('^%a', '%[%1%1%]') → if the first character of template_name is an alpha character, make it a pair: bbb and wrap the pair in set markup: bb[bb]
gsub ('%[%a', string.upper) → if the first two characters of template_name are [ followed by an alpha character, make the alpha character uppercase: [bb][Bb]
Trappist the monk (talk) 13:14, 8 November 2018 (UTC)[reply]
Ok, lets see if I understood. So the first gsub makes the first character a lowercase, then you create the same character again for the character in the second position, and for the 3rd gsub you can then make sure you have one lowercase and one uppercase for the first character of the template, thus checking both versions (Intobox/infobox)? --Gonnym (talk) 13:38, 8 November 2018 (UTC)[reply]
yes
Trappist the monk (talk) 13:42, 8 November 2018 (UTC)[reply]
Awesome. Thanks again Trappist! --Gonnym (talk) 13:55, 8 November 2018 (UTC)[reply]

Variable substitution

[edit]

Quick question, hopefully you might know. I have a list of tracking categories which I access with "listName[number]" and get the category I need. I noticed an issue that some pages have a default-sort which is unhelpful here. I'd like to pipe the categories as in "category name|article title". The problem is, I don't know how in Lua to put a variable in the category list to be able to make this substitute. Something like [[Category:Test category|<variable>]]. Any ideas? --Gonnym (talk) 21:05, 9 November 2018 (UTC)[reply]

You are talking about Module:Television episode short description? If so then perhaps one way is to:
return (trackingCategoryList[categoryNumber]):gsub ('(%]%])$', '|' .. articleTitle .. '%1');
Trappist the monk (talk) 21:47, 9 November 2018 (UTC)[reply]
Yes, that one. Thanks! --Gonnym (talk) 21:57, 9 November 2018 (UTC)[reply]

ArbCom 2018 election voter message

[edit]

Hello, Trappist the monk. Voting in the 2018 Arbitration Committee elections is now open until 23.59 on Sunday, 3 December. All users who registered an account before Sunday, 28 October 2018, made at least 150 mainspace edits before Thursday, 1 November 2018 and are not currently blocked are eligible to vote. Users with alternate accounts may only vote once.

The Arbitration Committee is the panel of editors responsible for conducting the Wikipedia arbitration process. It has the authority to impose binding solutions to disputes between editors, primarily for serious conduct disputes the community has been unable to resolve. This includes the authority to impose site bans, topic bans, editing restrictions, and other measures needed to maintain our editing environment. The arbitration policy describes the Committee's roles and responsibilities in greater detail.

If you wish to participate in the 2018 election, please review the candidates and submit your choices on the voting page. MediaWiki message delivery (talk) 18:42, 19 November 2018 (UTC)[reply]

Ownership (psychology)

[edit]

Hi Trappist, can you have a look at Ownership (psychology) article as appears to have lots of CS1 template stuff in it like <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> which looks like it should not be there. Keith D (talk) 20:19, 13 November 2018 (UTC)[reply]

You're right, all of that raw htmp markup should not be there. That it is there can be laid at the feet of Editor Ipekdemi whom I have pinged into this conversation because I would like to know how it is that those citation templates ended up in the Ownership (psychology) article as html. Ipekdemi?
Trappist the monk (talk) 20:35, 13 November 2018 (UTC)[reply]
I have found evidence elsewhere during my linting travels to indicate that the cite templates are occasionally substed, for who-knows-what-reason, and this may be such a case. They should not be, especially now after TemplateStyles. I wonder if there is a good solution for that. Another potential reason is that VE made those substitutions, but I find that highly unlikely. --Izno (talk) 20:57, 13 November 2018 (UTC)[reply]
I think Module:Unsubst could prevent substing of citation templates. Galobtter (pingó mió) 08:12, 14 November 2018 (UTC)[reply]
I had been thinking that yesterday but hadn't the opportunity to test it. I have now added it to {{cite book/new}}. When I write:
{{subst:cite book/new |first=Charles |last=Darwin |title=The Origin of Species |title-link=s:Page:Origin_of_Species_1859_facsimile.djvu/500 |year=1859 |page=488}}
I get:
{{Cite book/new|first=Charles|last=Darwin|page=488|title=The Origin of Species|title-link=s:Page:Origin_of_Species_1859_facsimile.djvu/500|year=1859}}
Trappist the monk (talk) 10:11, 14 November 2018 (UTC)[reply]
Funny that the page parameter gets moved around. --Izno (talk) 15:08, 14 November 2018 (UTC)[reply]
all of the parameters in the template get dumped into a Lua table. Except when the Lua table is a sequence, order of the elements in the table is whatever Lua wants it to be so the authors of Module:Template invocation (require()'d by Module:Unsubst) elected to alpha sort the parameters.
Trappist the monk (talk) 16:00, 14 November 2018 (UTC)[reply]
Not sure that substing of the cs1|2 templates is the cause. if I subst this:
{{subst:cite book |first=Charles |last=Darwin |title=The Origin of Species |title-link=s:Page:Origin_of_Species_1859_facsimile.djvu/500 |year=1859 |page=488}}
I get this:
{{#invoke:citation/CS1|citation
|CitationClass=book
}}
so that result suggests some other mechanism.
Trappist the monk (talk) 10:11, 14 November 2018 (UTC)[reply]
Yeah, I think I've seen it with older articles mostly. The edit made was a Visual Edit, so that might be the other reason--if so, that's a bug to raise at Phab. --Izno (talk) 15:08, 14 November 2018 (UTC)[reply]
Back to this re, the editor was working in his sandbox and made that edit first. This is a new editor, so I would guess we're not going to get much help troubleshooting. --Izno (talk) 15:09, 14 November 2018 (UTC)[reply]
It also caused a problem here. This might be a high prio problem. --Izno (talk) 15:12, 14 November 2018 (UTC)[reply]
@SshibumXZ: When you made the above edit, were you just using VE normally? Did you switch editors in some way? Do you know anything about what could have caused that? --Izno (talk) 15:16, 14 November 2018 (UTC)[reply]
I filed a phab about it too. phab:T209493. --Izno (talk) 15:48, 14 November 2018 (UTC)[reply]
I did a simple insource search looking for the string "Module:Citation/CS1/styles.css". At the time, I found seven articles. I've repaired all but two. There were amongst the seven, three 'styles':
  1. these did not include the COinS metadata:
    Getty Images – 8 November 2018 (ve)
    Indifference curve – 13 November 2018 (ve)
    List of first women lawyers and judges in the United States – 9 November 2018 (ve)
    List of first women lawyers and judges in Rhode Island – 8 November 2018 (ve)
  2. this one appears to have been the result of translation process from ru.wiki
    The_Cleaners (serial killers) – 3 November 2018
  3. these include COinS metadata (also the two not yet fixed):
    Edward A. Lee – 3 November 2018 (ve)
    Ownership (psychology) – 10 November 2018 (ve)
A simple insource search for the string "cite class=" finds 164 articles. The first one of those has the COinS metadata:
Slavs – 15 August 2018 (ve)
I haven't looked at the rest but so far, with the exception of the translated article, all of these edits were made with ve.
Trappist the monk (talk) 15:49, 14 November 2018 (UTC)[reply]
Here are ten from the first page of the "cite class=" insource search in date order:
Nicolaus Copernicus – 12 January 2008; not apparently part of this problem
National Lottery (United_Kingdom) – 9 January 2016 (ve)
University of Connecticut – 12 April 2016 (ve)
WrestleMania 29 – 12 April 2016 (ve)
Johnny Yong Bosch – 17 February 2018 (ve)
Ryan Coogler – 17 February 2018 (ve)
Dictatorship – 1 May 2018 (ve)
Resident_Evil – 15 May 2018 (ve)
Brandon Lee – 3 September 2018 (ve)
Tampon – 28 September 2018 (ve); Mvolz, not a newby editor
Trappist the monk (talk) 16:52, 14 November 2018 (UTC)[reply]
How odd - If I remember correctly, I copy/pasted parts of this back and forth from Tampon tax. Mvolz (talk) 17:11, 14 November 2018 (UTC)[reply]
I could believe that. These three, all of which exhibit the problem, are in named <ref>...</ref> tags:
Mortimer
White
Larimer
this one, was in unnamed <ref>...</ref> tags:
Crisp
so perhaps there is a clue there.
Trappist the monk (talk) 17:36, 14 November 2018 (UTC)[reply]

I cannot seem to fix the errors in the references. I replaced some of the citations with a better format. However, it does not seem like it fixed anything. If anyone can let me know how to fix it, that would be highly appreciated.—Ipekdemi (talk) 23:06, 21 November 2018 (UTC)[reply]

@Ipekdemi: Sorry, but those 'fixes' didn't really fix anything. Here is the first citation (named PKD2001) from your 10 November 2018‎ edit:
<cite class="citation journal">Pierce, J. L.; Kostova, T.; Dirks, K. (2001). "Toward a theory of psychological ownership in organizations". ''Academy of Management Review''. '''26''': 298–310. [[Digital object identifier|doi]]:[[doi:10.5465/amr.2001.4378028|10.5465/amr.2001.4378028]].</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Academy+of+Management+Review&rft.atitle=Toward+a+theory+of+psychological+ownership+in+organizations&rft.volume=26&rft.pages=298-310&rft.date=2001&rft_id=info%3Adoi%2F10.5465%2Famr.2001.4378028&rft.aulast=Pierce&rft.aufirst=J.+L.&rft.au=Kostova%2C+T.&rft.au=Dirks%2C+K.&rfr_id=info%3Asid%2Fwiki.riteme.site%3AOwnership+%28psychology%29" class="Z3988"></span><templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
Citations in wikitext should not look like this and I'm pretty sure that you did not consciously set out to create this mess. It looks to me like the tool you were using (visual editor) failed catastrophically. If you look in the left column of the diff you will find this: <ref name=PKD2001/>. That tag was inappropriately replaced with the gibberish above.
The original citation template definition looked like this and was located in §References:
<ref name=PKD2001>
{{cite journal
  |last1=Pierce|first1=J. L.
  |last2=Kostova|first2=T.
  |last3=Dirks|first3=K.
  |year=2001
  |title=Toward a theory of psychological ownership in organizations
  |journal=Academy of Management Review
  |volume=26
  |pages=298–310
  |doi=10.5465/amr.2001.4378028
}}
</ref>
That was a correct representation of a journal citation template (but the tool failure also replaced the definition with the above gibberish).
I'll pick away at repairing the tool's damage.
Trappist the monk (talk) 00:07, 22 November 2018 (UTC)[reply]

Yes, you are right. The tool has malfunctioned. Thank you for looking into this! Ipekdemi (talk) 03:20, 22 November 2018 (UTC)[reply]

Fixed, I think,
Trappist the monk (talk) 12:50, 22 November 2018 (UTC)[reply]

Google book format

[edit]

On my user page you asked how I got some odd Google book format. I've done some investigation and asked a few people and discovered where the problem lies..... Its the Google book tool.... as you have different format options and one of them is the weird one you have a concern about.... see https://reftag.appspot.com .--Moxy (talk) 18:27, 5 December 2018 (UTC)[reply]

Yep, that's it. Thank you. It would seem that there is a bug in that code; author intformation is excluded when the plain wikicode format is selected. I've pinged the author about that.
Trappist the monk (talk) 20:00, 5 December 2018 (UTC)[reply]

Wikilinking 'lang' value

[edit]

Hello, is it unnecessary to wikilink 'lang' value in CS templates? - Fylindfotberserk (talk) 15:24, 6 December 2018 (UTC)[reply]

The purpose of references is to identify the source that an editor used when adding information to an en.wiki article so that readers may locate a copy of that same source. Linking to an article about the language(s) used in a source does not assist the reader in locating that source. For this reason, the documentation for |language= at {{cite book}} and other templates states, in part: 'do not use templates or wikilinks.'
Trappist the monk (talk) 15:41, 6 December 2018 (UTC)[reply]
Thanks for the information. I'll keep that in mind. - Fylindfotberserk (talk) 15:47, 6 December 2018 (UTC)[reply]

Question

[edit]

Hi Ttm, I have a question, (if you don't mind); I was cleaning up at HMNB Portsmouth, fixing refs and whatnot, when I noticed a red-linked module in preview mode;

  • Module:WikidataIB/i18n

I have no idea what that is, but you always seem to know this stuff. Is that something that should be dealt with, or can it just be ignored? Thanks - wolf 18:23, 6 December 2018 (UTC)[reply]

Even though it does not exist, Module:WikidataIB/i18n is transcluded in 656,540 pages. I think that this is because it is require()'d by Module:WikidataIB. Pinging Editor RexxS who is the expert on that particular module.
Trappist the monk (talk) 18:46, 6 December 2018 (UTC)[reply]
@Thewolfchild and Trappist the monk: Because Module:WikidataIB is in use on many different language projects, we have a link to a sub-module that another language can use to internationalise things like error messages, etc as the sub-module would override the default values written into WikidataIB. The module WikidataIB was originally developed on the English Wikipedia, so the default values are all in English, and that means we don't need a sub-module here. As you can imagine, it's simply more convenient for everybody to keep the contents of WikidataIB the same for every project and to allow each project (except En-wiki) to keep its internationalisation separate. Hope that makes sense. --RexxS (talk) 23:24, 6 December 2018 (UTC)[reply]
@RexxS: Thanks for the reply. One quick question; does it need to remain as a redlink? Even if we don't need it on the en~wiki, we get it anyway, so can it be created as... anything, to make it blue? (so it doesn't stick out like a sore thumb, begging for attention). Thank again - wolf 23:33, 6 December 2018 (UTC)[reply]
Of course. Unfortunately, if I remember correctly, the module actually once existed on English Wikipedia, but it was deleted because it was empty (by another gnome whose job it was to tidy up empty modules). I could have misremembered that, though. It won't affect WikidataIB if Module:WikidataIB/i18n is created, as long as it gets the same level of page protection, for obvious reasons. Cheers --RexxS (talk) 23:49, 6 December 2018 (UTC)[reply]
Presumably, all of the stuff that other wikis put into their copies of Module:WikidataIB/i18n could be put into our copy. Doing that, I think, makes Module:WikidataIB the same for all wikis always. Another way round the red-link issue might be something like this:
-- This allows a internationisation module to override the above table
if 'en' ~= mw.getContentLanguage():getCode() then
	require("Module:i18n").loadI18n("Module:WikidataIB/i18n", i18n)
end
Trappist the monk (talk) 00:13, 7 December 2018 (UTC)[reply]
Sadly, I can't keep track of all the other languages (nor can I understand most of then) where WikidataIB is used, so I wouldn't want the job of putting all the stuff from other wikis into the module. Not all of it is language-dependent, though – for example, tracking categories may differ between enwiki, Commons, and en-wikisource, so one might "cheat" by using /i18n to hold those sort of differences as well. Nevertheless, your fix would probably satisfy all the gnomes - and you could check against mw.site.siteName to be specific about enwiki. Thanks again. --RexxS (talk) 00:36, 7 December 2018 (UTC)[reply]
I think that we are not communicating.
In no way do I mean to suggest that all other languages should reside in a some ginormous single master module – to even contemplate that is, I think, ludicrous. What I do mean is that the ~/i18n module at en.wiki should hold the English language version of everything that needs translation and nothing else. That en.wiki-localized information would then be require()'d into Module:WikidataIB just as ar:Module:WikidataIB/i18n would be required into ar:Module:WikidataIB at ar.wiki – this is what I meant by the same for all wikis always; regardless of host language / site, Module:WikidataIB is always the same. The responsibility of translating the en.wiki ~/i18n for use at another wiki is the responsibility of that wiki's editors and the only thing that they should ever have to translate is the ~/i18n module, ever.
It is safer and easier for 'translators', who may or may not be very fluent in Lua, to edit a module specifically intended for translation because they can translate in situ and don't have to create a new module out of whole cloth as they must do now. A quick sampling of the wikis that are linked in the left panel at Module:WikidataIB would seem to indicate that few if any of them use the ~/i18n module (I didn't find any in the six or eight that I checked). Because there isn't a scaffold for them to work from, this dearth of ~/i18n modules does not surprise me.
Have I made myself more clear?
Trappist the monk (talk) 01:16, 7 December 2018 (UTC)[reply]
Yes, that's certainly much clearer. I was originally misled by "all of the stuff that other wikis put into their copies of Module:WikidataIB/i18n could be put into our copy", which seems to be capable of being read in more than one way. It's certainly true that you could take out lines 30 to 81 from Module:WikidataIB and put them into Module:WikidataIB/i18n. However, I feel that would not be an improvement, as those variables would no longer have a default in the main module that would be used if the sub-module was deficient or missing. I think I'd prefer an editor on the Welsh Wikipedia, for example, to at least see an English word if there's no translation yet, rather than having a red system error showing up. I accept that not everybody will agree with my preference in that respect. --RexxS (talk) 01:41, 7 December 2018 (UTC)[reply]
What happens with convert is that people who seriously translate messages copy the enwiki module (which would be Module:WikidataIB/i18n in the case discussed here) then gradually translate messages. That means there will be a mixture of English and local messages, possibly for an extended period. If they break something or remove a message without translating it, there will be an error. Convert can display "Missing message" in that case and the bug would have to be chased down. I've never seen that. Johnuniq (talk) 02:45, 7 December 2018 (UTC)[reply]

Mistake regarding your edits

[edit]

Hi. I mistakenly saw your edit at Abortion and mental health here and misattributed your edit as part of, or agreement with an edit by IntoThinAir regarding a peer reviewed study by Coleman. There is hardly any "accusation." There is a conflict in the article as many editors seek to block any citations to literature reviews in peer reviewed medical journals which challenge the conclusions of two favored reviews, even though the later reviews are to be given priority, or at least due weight per WP:MEDRS. I apologize if you found offense in my mistaken interpretation of your past contributions to the article. — Preceding unsigned comment added by Saranoon (talkcontribs) 19:45, 12 December 2018 (UTC)[reply]

Nomination for deletion of Template:Pope list item

[edit]

Template:Pope list item has been nominated for deletion. You are invited to comment on the discussion at the template's entry on the Templates for discussion page. ―Justin (koavf)TCM 02:10, 13 December 2018 (UTC)[reply]

Thanks for your help

[edit]

Dear Trappist - the quotation-mess is caused by a bot - it's done automatically. Now, with new articles, i do use "no bots" - but then i did not know it exists. Thank you for your help! Kind regards, --Gyanda (talk) 22:04, 17 December 2018 (UTC)[reply]


Can't create this module

[edit]

Getting this error message (Error: error in Lua code line 1: unexpected symbol near '/') when I try to create this module Module:Citation/CS1/styles.css on the Macedonian Wikipedia. Is there some solution to this, so that it can be put in use in our Wikipedia. Thank you! Инокентиј (talk) 11:40, 18 December 2018 (UTC)[reply]

You must get a local admin to change the content model to "Sanitized CSS".
Trappist the monk (talk) 11:53, 18 December 2018 (UTC)[reply]
mw:Help:ChangeContentModel
Trappist the monk (talk) 12:02, 18 December 2018 (UTC)[reply]

Xmas

[edit]
FWiW Bzuk (talk) 00:40, 25 December 2018 (UTC)[reply]

Nomination for merging of Template:Infobox Korean name

[edit]

Template:Infobox Korean name has been nominated for merging with Template:Infobox Chinese. You are invited to comment on the discussion at the template's entry on the Templates for discussion page. Thank you.

Hi, you seem like someone who works to maintain {{Infobox Chinese}}. Due to this I invite your participation in this discussion. Thanks, DanielleTH (Say hi!) 15:44, 26 December 2018 (UTC)[reply]

Belated Seasonal Greetings

[edit]
Merry Christmas and a Prosperous 2019!

Hello Trappist the monk, may you be surrounded by peace, success and happiness on this seasonal occasion. Spread the WikiLove by wishing another user a Merry Christmas and a Happy New Year, whether it be someone you have had disagreements with in the past, a good friend, or just some random person. Sending you heartfelt and warm greetings for Christmas and New Year 2019.
Happy editing,

7&6=thirteen () 20:36, 26 December 2018 (UTC)[reply]

Spread the love by adding {{subst:Seasonal Greetings}} to other user talk pages.

Best wishes for a happy 2019

[edit]
The Hill Country (1913) by Walter Elmer Schofield, Woodmere Art Museum.
Thank you for your contributions toward making Wikipedia a better and more accurate place.

== BoringHistoryGuy (talk) 00:04, 3 January 2019 (UTC)[reply]