Template talk:Catalog lookup link

From WikiProjectMed
Jump to navigation Jump to search

lua support for template:catalog lookup link

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:

  1. {{Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|article-name=WP|link-prefix=//en.wikipedia.org/wiki/}}
    • WP 1, 2, 3, 4, 5, 6, 7, 8, 9
    • WP 1, 2, 3, 4, 5, 6, 7, 8, 9
  2. {{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|link-prefix=//en.wikipedia.org/wiki/}}
  3. {{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-name=WP|link-prefix=//en.wikipedia.org/wiki/}}
  4. {{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|link-prefix=//en.wikipedia.org/wiki/}}
  5. {{tlx|Catalog lookup link|1|2|3|4|5|6|7|8|9|article-link=Wikipedia|article-name=WP|article-postfix=:|link-prefix=//en.wikipedia.org/wiki/|link-postfix=#hash|item-prefix=<|item-postfix=>}}
  6. {{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=>}}
    • WP: <1>, <2>, <3>, <4>, <5>, <6>, <7>, <8>, <9>
    • WP: <1>, <2>, <3>, <4>, <5>, <6>, <7>, <8>, <9>
  7. {{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.wikipedia.org/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]]&nbsp;[//en.wikipedia.org/wiki/1 1]&#32;/&#32;[//en.wikipedia.org/wiki/2 2]&#32;/&#32;[//en.wikipedia.org/wiki/3 3]&#32;/&#32;[//en.wikipedia.org/wiki/4 4]&#32;/&#32;[//en.wikipedia.org/wiki/5 5]&#32;/&#32;[//en.wikipedia.org/wiki/6 6]&#32;/&#32;[//en.wikipedia.org/wiki/7 7]&#32;/&#32;[//en.wikipedia.org/wiki/8 8] and [//en.wikipedia.org/wiki/9 9]
  • '"`UNIQ--templatestyles-00000018-QINU`"'[[Wikipedia|WP]]&nbsp;[//en.wikipedia.org/wiki/1 1]&#32;/&#32;[//en.wikipedia.org/wiki/2 2]&#32;/&#32;[//en.wikipedia.org/wiki/3 3]&#32;/&#32;[//en.wikipedia.org/wiki/4 4]&#32;/&#32;[//en.wikipedia.org/wiki/5 5]&#32;/&#32;[//en.wikipedia.org/wiki/6 6]&#32;/&#32;[//en.wikipedia.org/wiki/7 7]&#32;/&#32;[//en.wikipedia.org/wiki/8 8] and [//en.wikipedia.org/wiki/9 9]

Trappist the monk (talk) 15:02, 17 July 2018 (UTC)[reply]

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)[reply]
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:
Title. ERIC ED046562.
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)[reply]
Redone. The Module:Citation/CS1 suite was recently updated and now ignores TemplateStyles stripmarkers.
Trappist the monk (talk) 13:54, 3 October 2018 (UTC)[reply]
@Trappist the monk: Would it not be better to have the module emit the templatestyles tag (instead of the template) with code like:
		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
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):
	return table.concat ({citation0( config, args), frame:extensionTag ('templatestyles', '', {src=styles})});
Notice the module emits nothing when 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)[reply]
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)[reply]
@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)[reply]
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)[reply]
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)[reply]

Template broke for ark numbers

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. –MJLTalk 21:37, 26 March 2021 (UTC)[reply]

Sigh ... An example? Always good to show an example when something is broken.
Trappist the monk (talk) 22:03, 26 March 2021 (UTC)[reply]

Requirements for CS id field

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)[reply]

Add URL Access indicators to {{Catalog lookup link}}

Could we add WP:URLACCESS indicators to {{Catalog lookup link}}? A number of the are freely accessible (such as ISBN), while others are behind a subscription paywall ({{Gale}}, {{EBSCOhost}}, etc.). GobsPint (talk) 10:42, 20 April 2024 (UTC)[reply]

Already exists:
{{Catalog lookup link|1|2|3|4|article-link=Wikipedia|article-name=WP|link-prefix=https://en.wikipedia.org/wiki/|url-access1=subscription |url-access2=registration |url-access3=limited |url-access4=free}}
WP 1, 2, 3, 4
Trappist the monk (talk) 11:48, 20 April 2024 (UTC)[reply]