Here's a wiki syntax challenge!
Since asking Mediawiki: Same section with multiple names (section aliases/synonyms), I've developed a more specific query as I feel like I'm closer to a solution that works the way I want it to:
I want to, in a link, pass a parameter to a template WITHOUT transcluding the full article.
[[ Template:Interrupts Code Examples|pagename={{PAGENAME}} ]]
Except this creates a link to an article named pagename=Name_of_page_you're_on
instead of passing a parameter.
Transcluding the article, the parameter is passed successfully, but I just want a link to pass the parameter to the template.
For more context,
Using #ifexists
I can generate a "code examples compilation" page that defaults to sections with headings "Example One" and "Example Two" when the names aren't given, but I also want them to be section linkable and show up with the appropriate headings depending on where the comes in from:
"EIMSK" and "Example Two"
"EICRA" and "Example Two"
"Example One" and "PCMSK0"
"Example One" and "PCMSK1"
"Example One" and "PCMSK2"
"Example One" and "PCICR"
Is this too terribly convoluted and I should just manually compile these pages? Is this possible?
My current solution is to have
"PCMSK0"
{{example one code}}
"PCMSK2"
{{example one code}}
"EICRA"
{{example two code}}
etc.
which is far from ideal since then the compilation of code examples page is just one giant long mess.
I am open to writing a MediaWiki extension in PHP if someone can give me some psuedocode to work off of.