Template talk:5e
From D&D Wiki
It is possible to tweak this template in a way that will allow it to not be case sensitive? For example, spare the dying vs spare the dying vs spare the dying, etc. —ConcealedLight (talk) 09:35, 20 August 2018 (MDT)
- There is a magic word to make the first character of a string uppercase. E.g., {{ucfirst:spare the dying}} becomes "Spare the dying." That would work of course with single-word pages like fireball, but not phrases like "spare the dying."
- With normal wiki syntax and Extension:StringFunctions, I don't believe it is possible to use magic words to make every word in a string uppercase, especially if certain words like "the" should be excluded but only if they appear in the middle.
- If there is another workaround someone could find, I too would be interested in it.- Guy 12:06, 20 August 2018 (MDT)
- Because of the complex capitalisation rules surrounding the wiki page titles, I foresee decent room for this to be pretty buggy. However, with a mess of #explode, #replace and the ucfirst magic word, I think it would be possible to construct a script that will uppercase all words except 'the' and 'of', for example. The issue is going to be if 5e has inconsistent capitalisation for certain words (which is quite possible), or if there's like 100 different words that aren't upper-cased, which will make the script complex and laggy. I'll quickly investigate a list of "don't uppercase" words and see how plausible this is. --SgtLion (talk) 01:52, 21 August 2018 (MDT)
- Well, that was easier to pull than I thought. Words that aren't uppercased in 5e SRD titles are ['and', 'of', 'with', 'to', 'a', 'an', 'or', 'the', 'into', 'without', 'from', 'via', 'against', 'ounce', 'bottle', 'piece', 'feet', 'day', 'sheet', 'two', 'in']. 'the', 'into', 'bottle' are also used in their uppercase form in about 10 5e SRD articles total. Could make redirects to compensate for those outliers, and otherwise apply the rules in that form. Having 20-odd terms to replace is really too copious, but if we make redirects for all the words that are used less than a few times, that might be reduced to a reasonable amount. I guess it would be worth giving it a go. --SgtLion (talk) 02:08, 21 August 2018 (MDT)
- Your a godsend Sarg. Let us know if there is anything we can do help. —ConcealedLight (talk) 02:53, 21 August 2018 (MDT)
- Kinda related but there is also weird things like leather (armor) vs leather armor. —ConcealedLight (talk) 03:32, 21 August 2018 (MDT)
- I can do MW code, but I ain't a miracle worker! I can't see any efficient way to addressing articles with or without parentheses - That'll probably be easier to simply address with redirects, than anything else. But I'm open to any other ideas.
- As for the capitalisation, the solution I cobbled together seems to work well. I've tested every 5e link and they all work! (Save for 5e_SRD:Dropping to 0 Hit Points, because numbers in the title). Thanks to Guy with that magic word, we also have Template:ucall, which will upper-case first letter of all the words in the parameter, and may end up handy elsewhere too. Also found a bug in our extension, fixed it and submitted a report, yay~ So there we go - 5e no longer requires correct capitalisation of the first letters, whoo! Let me know how soon things go terribly wrong. --SgtLion (talk) 05:04, 21 August 2018 (MDT)
- I think everything is working, however the template seems to be now capitalizing numerous references that shouldn't be capitalized like spells, race names, weapons, and most other references. Was this intentional? By and large, I thought having capitalized references is what the Template:5E is for?--Blobby383b (talk) 09:10, 21 August 2018 (MDT)
- I profess a great ignorance as to how such things should be capitalised. I've part-reverted it such that the default text appearance is the lowercase version of the text {{{1}}}, rather than reflecting the processed article link. Basically it works 'ow it used to work; I've also changed Template:5E to use this case-insensitive linking, too. --SgtLion (talk) 14:21, 21 August 2018 (MDT)
- Thanks for fixing that and for your work on making the template more user friendly!--Blobby383b (talk) 22:11, 21 August 2018 (MDT)
- I profess a great ignorance as to how such things should be capitalised. I've part-reverted it such that the default text appearance is the lowercase version of the text {{{1}}}, rather than reflecting the processed article link. Basically it works 'ow it used to work; I've also changed Template:5E to use this case-insensitive linking, too. --SgtLion (talk) 14:21, 21 August 2018 (MDT)
- I think everything is working, however the template seems to be now capitalizing numerous references that shouldn't be capitalized like spells, race names, weapons, and most other references. Was this intentional? By and large, I thought having capitalized references is what the Template:5E is for?--Blobby383b (talk) 09:10, 21 August 2018 (MDT)
So, uh. It's nice that capitalization is not a bother, but there seems to be a bigger problem. See Treasure (Hyrule_Supplement)#Snowquill Tunic.This is just a guess, but it seems like now if you use this template too many times on a page, it starts going absolutely crazy...- Guy 07:00, 1 September 2018 (MDT)