wtf_wikipedia
wtf_wikipedia copied to clipboard
Sentence-data in template values
For my specific usecase, a custom wiki has templates that act as infoboxes, yet aren’t named or recognized by wtf_wikipedia as such. This means the only way I have to accessing them is through the templates function. Sadly, for some reason, the templates values are parsed, and all links are trashed and replaced with their aliases instead.
For example, {{some_template|link=[https://google.com google]}}
results in the object { “link”: “google” }
.
Is there any way to access the original link through the parser? Should template values even be parsed like this if they’re represented by such a basic key/value object?
yes, hi Gilbert, this is a good question.
Infoboxes are sometimes called 'pseudo-templates' with extra functionality, but there's no way to cleanly decide which is which. It's been annoying. wtf_wikipedia
should try harder to soften this distinction.
We should probably refactor our template parsing to return objects, with methods, like .links()
, like elsewhere in the codebase. That would make a lot of sense actually.
I think, for the immediate-future, the only solution is to add your desired templates to this list, which will make them returned as infoboxes. sorry bout this! cheers
We should probably refactor our template parsing to return objects, with methods, like
.links()
, like elsewhere in the codebase. That would make a lot of sense actually.
Sounds perfect 👍
thought about doing this for v8 but then got scared-off, it was too big of a change.
We still need a proper solution. Haven't figured-out what it is yet. 😕 cheers