Module talk:String2
New function "label" added
I added new function "label" which capitalize only first letter for fetched wikidata labels (diff). Because Wikidata English labels generally begin with a lowercase letter (d:Help:Label#Capitalization). New function is almost same as "sentence" function except that "label" doesn't lowering the rest of text. If there are any questions or problems, feel free to report here. Thanks! --Was a bee (talk) 03:03, 17 September 2017 (UTC)
- Some objection. A "label" has multiple options. Especially: it is "free" (as in: irrelevant, not defining). If this option wants to imply "page title as a wikilink label", then change the option (parameter) name. -DePiep (talk)
- I've removed the label function as obselete in favour of ucfirst. --RexxS (talk) 15:16, 13 November 2018 (UTC)
Testing posnq
{{#invoke:String2 |posnq |This is a piece of text to be searched |ext}}
→ Script error: The function "posnq" does not exist.{{#invoke:String2 |posnq |This is a piece of text to be searched |ent}}
→ Script error: The function "posnq" does not exist.{{#invoke:String2 |posnq |This is a piece of text to be searched |"ext"}}
→ Script error: The function "posnq" does not exist.{{#invoke:String2 |posnq |This is a piece of text to be searched |"ent"}}
→ Script error: The function "posnq" does not exist.{{Posnq |This is a piece of text to be searched |piece of }}
→ Template:Posnq{{Posnq |This is a piece oftext to be searched |piece of }}
→ Template:Posnq{{Posnq |This is a piece of text to be searched |"piece of "}}
→ Template:Posnq{{Posnq |This is a piece oftext to be searched |"piece of "}}
→ Template:Posnq{{Posnq | {{start date|2018|November|30}} | bday dtstart published updated }}
→ Template:Posnq{{Posnq | 30 November 2018 | bday dtstart published updated }}
→ Template:Posnq
ucfirst bug
There is an script error on articles like 999 (album) and Casual Viewin' USA, whith an error on line 35, which originates on line 34. "%a" on line 34 did not match numbers after the pipe in my test, although it does find an letter after the pipe. As both of these articles have an number after the pipe, they both give an script error. The script needs to deal with the possibility of an number after an pipe.--Snaevar (talk) 23:13, 9 October 2019 (UTC)
- @Snaevar: I noticed many articles with that problem and I believe I have just fixed the module. Johnuniq (talk) 09:11, 10 October 2019 (UTC)
ucfirst bug, part 2
E.g. {{#invoke:String2 | ucfirst |Đorđe Balašević chronology }}
returns ĐOrđe Balašević chronology, as if the function does not realize Đ is a letter and is capitalizing O instead. Note {{ucfirst:Đorđe Balašević chronology}}
returns Đorđe Balašević chronology, as it should. Oddly, {{#invoke:String2 | ucfirst |đorđe Balašević chronology }}
works correctly (i.e. Đorđe Balašević chronology is returned). {{Infobox album}} chronology is affected, although these kinds of errors seem to be very rare. GregorB (talk) 18:24, 24 July 2020 (UTC)