Template talk:Bold list

Latest comment: 1 year ago by Ahecht in topic trim and ignore empties?

Substituted or transcluded?

edit

Is there a way to modify this template so that it can be transcluded? I tried just now and {{subst:Bold list|conj=and|hardy hibiscus|rose of sharon|tropical hibiscus}} produced {{#invoke:Bold list|main|conj=and}}, which really isn't the behaviour I'd like.

I think this template would be more useful if it could be substituted. Wikicode itself is enough of a barrier for new users (and some who aren't so new), and template editing even more so. Editing this with the visual editor is both a challenge in itself, and adds a lot of extra work.

I think an italic list template would be even more useful, since there are cases where you have to list several species with un-italicised commas (or full stops). And would it be possible for bulleted lists (e.g., as a starting point for a list of species).

Pinging PerfectSoundWhatever and Ahecht. Guettarda (talk) 20:56, 9 May 2022 (UTC)Reply

@Guettarda   Done. --Ahecht (TALK
PAGE
) 14:00, 10 May 2022 (UTC)Reply
@Ahecht Thanks so much! Guettarda (talk) 15:41, 10 May 2022 (UTC)Reply

trim and ignore empties?

edit

For meta templating, I found it useful to trim and ignore empty values (much like {{cslist}}). Shall I update the code? Dpleibovitz (talk) 19:00, 7 September 2022 (UTC)Reply

-- Written by User:Ahecht in response to a thread at [[WP:VPI]]
return { main = function(frame)
	args = {}
	for i, v in ipairs(frame:getParent().args) do
		v = mw.text.trim(v)
		if v ~= "" then table.insert(args, v) end
	end
	conj = "'''" .. (#args > 2 and ", " or " ") .. (frame.args.conj or "or") .. " '''"
	return "'''"..mw.text.listToText(args, "''', '''", conj).."'''"
end }
Pinging @Ahecht: since they wrote the original Lua code. — PerfectSoundWhatever (t; c) 21:15, 7 September 2022 (UTC)Reply
@PerfectSoundWhatever Sounds good to me. The real question for meta-templating is how you want to handle missing values. Currently 1=a|2=b|4=c will display as a or b since we use ipairs. If we want it to continue after a skipped value, you'd have to use the sandbox version. --Ahecht (TALK
PAGE
) 16:20, 8 September 2022 (UTC)Reply