I could use a hand here.
On a wiki I manage, we have a page for every creature in the game. These creatures all follow a general pattern, and so for ease of access, I've made a template that can be used to automatically create the image galleries for these creatures.
There's two attributes on these creatures: gender, and glimmer. Gender may not exist for creatures that do not exhibit dimorphism, and some creatures do not have a glimmer variant.
The current issue is that the template as it is right now builds html, and requires using the #subst command, which means the template implementation gets scrapped once the page is saved. The Lua implementation exists here: https://creatures-of-sonaria-official.fandom.com/wiki/Module:CreatureImageGenerator
The (now correct, if you are reading this) implementation of the NEW template, the one replacing Lua, can be viewed here: https://creatures-of-sonaria-official.fandom.com/wiki/Template:AutoCreatureImage
My ideal goal is for the actual creature page to keep the template, and so I've been tearing my hair out trying to populate a <gallery> tag conditionally.
To cut to the chase, my current issue is the fact that gallery seems to require a newline in editor to work (so <br/> isn't a valid substitute, for instance).
I've tried these things:
Is there any way that I can return a gallery that conditionally selects images without using #subst?