Template talk:R:Collins English Dictionary
Template:R:Collins English Dictionary
edit- Discussion moved from User talk:Sgconlaw.
Hello.
Your changes to {{R:Collins English Dictionary}}
seem to have slightly broken that template: for words with spaces in them, such as nowhere near, {{R:Collins English Dictionary}}
used to be a valid syntax (i.e. it could fetch the page title and look for that).
Now we have to write {{R:Collins English Dictionary|nowhere-near}}
with hyphens instead of spaces for it to work. Otherwise it tries to look at "nowherenear" (which doesn't work, obviously: “nowherenear”, in Collins English Dictionary.).
Could you check what's going on? Thanks! --Per utramque cavernam (talk) 16:38, 4 January 2018 (UTC)
- Btw, this is not your doing, but
{{R:Macmillan}}
,{{R:Longman}}
and{{R:Cambridge}}
have the same problem (compulsory hyphens).{{R:Cambridge}}
doesn't even look for the word when there's a space in it. Any help on how to fix that would be appreciated! (I've detailed the problem at{{lemming test}}
). --Per utramque cavernam (talk) 17:11, 4 January 2018 (UTC)- The old version of
{{R:Collins English Dictionary}}
didn't work properly either when it came to multiple-word entries. As indicated in the documentation, please use the|url=
parameter to explicitly state the URL if the template does not automatically link properly to the correct webpage. An alternative would be to see if @Erutuon is able to develop a Lua module to replace all spaces with hyphens which can then be integrated into templates like{{R:Collins English Dictionary}}
and the others that you mentioned. — SGconlaw (talk) 17:49, 4 January 2018 (UTC)- @Per utramque cavernam, Sgconlaw: There are already modules for that: Module:string and Module:ugly hacks. So you can do
{{#invoke:string|gsub|{{{1}}}| |-}}
or{{#invoke:ugly hacks|replace|{{{1}}}| |-}}
. 20:30, 4 January 2018 (UTC)- @Erutuon: Thanks, the ugly hacks module seems to have done the trick! I tried with the string module (cleaner?) first, but it didn't work. --Per utramque cavernam (talk) 23:29, 4 January 2018 (UTC)
- @Per utramque cavernam: Hmm, yes, Module:string adds a hyphen near every character. Ohh, I think that's because Module:string uses Module:parameters, which strips whitespace (
mw.text.trim
) from the parameters, converting a space to an empty string, and an empty string matches every position in the string. Heh. — Eru·tuon 23:44, 4 January 2018 (UTC)- There should be an additional
allow_whitespace
tag that causes it to not strip whitespace. But we only have limited control over this; the wiki software itself strips whitespace for you if you specify the parameter with a name. Only unnamed parameters keep their whitespace. That's why the stripping behaviour was added to Module:parameters, to avoid unwanted surprises. —Rua (mew) 23:57, 4 January 2018 (UTC)- @Erutuon: Sorry for bothering you again, but where/how should I add this
allow_whitespace
tag? In Module:string or in the templates? --Per utramque cavernam (talk) 14:51, 5 January 2018 (UTC)- @Per utramque cavernam: I think @Rua is proposing a new feature in Module:parameters. But maybe it would be easier to instead create a custom parameter-handling function for Module:string that doesn't strip whitespace. — Eru·tuon 20:38, 5 January 2018 (UTC)
- Why would that be easier? It's literally just an if-statement to add
allow_whitespace
. I've done so now. —Rua (mew) 22:36, 5 January 2018 (UTC)- @Rua: Never mind, you're right. I dunno how much it'll be used though. — Eru·tuon 22:52, 5 January 2018 (UTC)
- Apparently it was easy and I still managed to mess it up. Thanks! —Rua (mew) 00:19, 6 January 2018 (UTC)
- I've made the the same type of mistake a lot of times, getting something the opposite way around... — Eru·tuon 07:58, 7 January 2018 (UTC)
- Years later, but I've changed this to
no_trim
, as it's a more intuitive name for the flag. Theknightwho (talk) 11:51, 30 August 2024 (UTC)
- Years later, but I've changed this to
- I've made the the same type of mistake a lot of times, getting something the opposite way around... — Eru·tuon 07:58, 7 January 2018 (UTC)
- Apparently it was easy and I still managed to mess it up. Thanks! —Rua (mew) 00:19, 6 January 2018 (UTC)
- @Rua: Never mind, you're right. I dunno how much it'll be used though. — Eru·tuon 22:52, 5 January 2018 (UTC)
- Why would that be easier? It's literally just an if-statement to add
- @Per utramque cavernam: I think @Rua is proposing a new feature in Module:parameters. But maybe it would be easier to instead create a custom parameter-handling function for Module:string that doesn't strip whitespace. — Eru·tuon 20:38, 5 January 2018 (UTC)
- @Erutuon: Sorry for bothering you again, but where/how should I add this
- There should be an additional
- @Per utramque cavernam: Hmm, yes, Module:string adds a hyphen near every character. Ohh, I think that's because Module:string uses Module:parameters, which strips whitespace (
- @Erutuon: Thanks, the ugly hacks module seems to have done the trick! I tried with the string module (cleaner?) first, but it didn't work. --Per utramque cavernam (talk) 23:29, 4 January 2018 (UTC)
- @Per utramque cavernam, Sgconlaw: There are already modules for that: Module:string and Module:ugly hacks. So you can do
- The old version of
Original version
editI restored a version near the original one. It works just fine and looks fine:
- “word” in Collins English Dictionary
Let us recall that this is a further reading and a link to an online resource, and that a user does not need to run into a library and pick the right edition of the right work; the linking online takes care that our user lands on the right page in the reference work intended.
I tested the template in just so in preview mode and it links just fine; it produces just+so in the URL, but that seems to be automatically redirected by the web site to just-so, which you can try yourself: https://www.collinsdictionary.com/dictionary/english/just+so. --Dan Polansky (talk) 06:27, 2 June 2019 (UTC)
- It doesn't work well with entries that have characters that are not letters of the alphabet, for example:
- “I bet/I'll bet/you can bet” in Collins English Dictionary
- The additional parameters do not need to be used if an editor does not wish to. — SGconlaw (talk) 13:08, 2 June 2019 (UTC)
Source parameter
editCan "Collins English Dictionary. Copyright © HarperCollins Publishers" and "Most material © 2005, 1997, 1991 by Penguin Random House LLC. Modified entries © 2019 by Penguin Random House LLC and HarperCollins Publishers Ltd" be assigned values for the |source=
parameter? They can be seen, for example, at the entry for guinea pig. Can the template also be modified so that multiple sources can provided when referencing multiple parts of the webpage? Thanks and take care. —The Editor's Apprentice (talk) 17:08, 2 November 2021 (UTC)
- @The Editor's Apprentice: I can add some additional imprint information and sources, but I'm not sure it is a good idea to allow the specification of multiple sources as it would make the reference overly long. It would be better for editors to pinpoint the exact source they are relying on for a specific purpose, and put the reference template within <ref> tags. If the reference template is just being used in a "Further reading" section, in most cases it shouldn't be necessary to specify any source. — SGconlaw (talk) 10:52, 3 November 2021 (UTC)
- @Sgconlaw: Cool. The reason I am hoping to have the template accept multiple sources can be related back to the guinea pig entry. The section referencing the Collins English Dictionary gives an etymology related to the idea of an unknown land and the Webster’s New World College Dictionary section gives an etymology related to travel between England and the West Africa (Guinea). If I want to reference both of these theories in an etymology section, I would personally think it would be most efficient to use only one reference. I can see an argument for having separate references that are specific to the two circumstances and if that's your position I'll let it stand. Take care.—The Editor's Apprentice (talk) 23:17, 3 November 2021 (UTC)
- @The Editor's Apprentice: my suggestion in that entry would actually be to use the template twice, once with each source. I’m not sure needing to refer to different sources in the same website happens often enough to make that a feature in the template. (And, as mentioned above, it would make the reference really long.) — SGconlaw (talk) 05:52, 4 November 2021 (UTC)
- @Sgconlaw: Cool. The reason I am hoping to have the template accept multiple sources can be related back to the guinea pig entry. The section referencing the Collins English Dictionary gives an etymology related to the idea of an unknown land and the Webster’s New World College Dictionary section gives an etymology related to travel between England and the West Africa (Guinea). If I want to reference both of these theories in an etymology section, I would personally think it would be most efficient to use only one reference. I can see an argument for having separate references that are specific to the two circumstances and if that's your position I'll let it stand. Take care.—The Editor's Apprentice (talk) 23:17, 3 November 2021 (UTC)