Since such a thing couldn't output wikitext, it would be better as an extension tag than as a parser function.
API: Add page properties to action=expandtemplates output
After discussing with Anomie on IRC, change the messages so that they can contain wikitext, just not HTML.
Same patch with full metadata.
The attached patch ensures that all text used in the backtrace is properly sanitized.
Add more comments and type hints
Re-emit unknown tags from #tag
Handle PTD_FOR_INCLUSION properly
Use a metatable when os.date("*t") is called
I don't see a reason that users shouldn't be able to freely change a page's content model.
@Anomie: Rather than modify both the PST and Scribunto (and probably other places in the future), why not just change Preprocessor_Hash to have the same behavior as Preprocessor_DOM?
I agree we can probably make the second example cheap, but not the first one. Remember that a file description page can exist without a file existing.
Record a link to pages looked up by ID
Avoid unnecessary database queries
Improve error messages in mw.html
Return registerInterface() per Ibdc1f4ef
Display a warning when editing a blacklisted page
Add mw.ext.TitleBlacklist.test
Fix mismatched parentheses
Make the diff the primary link in thanks
Remove misleading Thank button from some diffs
Use current revision callback instead of template callback
Hook TitleExists when previewing
Output hidden fields on pages other than templates
Use Html::hidden instead of Html::input
Allow changing name of template being previewed
Categorize pages containing blacklisted links
Add an API action to test blacklisted URLs
Improve mw.getCurrentFrame handling
Improve mw.getCurrentFrame handling
Use correct variable in require()
Expose file page count, width, and height to Lua
Remove unnecessary redefinition
Allow numbers in tag names
Improve compatibility with TemplateSandbox
Display the full error message in wikitext
Throw an exception if LuaSandboxFunction::call returns false
Don't escape the delete character
Set vary-revision appropriately with getContent()
Improve performance of PHP ustring
Only set indexOffset when the function name is indexed
Don't output a semicolon at the end of CSS
Fix __pairs not working in LuaStandalone serialization
Output instead of &#nbsp;
Fix deceptively-simple pattern in pure-Lua ustring
Expose cascading protection directly to Lua
Add 2 tests to unitTestsList
Make the cssEncode pattern simpler
Make logs work in preview on OSs other than Linux
Create mw.dumpObject split from mw.logObject
Show blanknamespace in content language
Don't cache volatile wikitext
Fix strange mw.html errors with numeric arguments
Keep modules' export tables inside Lua
Allow passing nils to mw.html
Set TTLs on outputs containing times
Show ScribuntoExceptions in content language
Add comments and remove trailing whitespace
Avoid running all of mw.lua twice
Use correct variable in require()
Use do...end to restrict scope
Add name to nosuchfunction and nosuchmodule errors
Remove leftover code for titles in messages
Remove limits on mw.language:formatDate()
Improve invalid title error message
Remove message formats other than plain
Add protectionLevels variable to mw.title output
Simplify if statement logic
Return registerInterface() per Ibdc1f4ef
Call Title::exists() instead of checking the ID
Add a TTL to #time and #timel output
Allow calling #expr from Lua without the parser
Allow InputBoxes to be used to move pages
Allow PENDINGCHANGELEVEL to work on other pages
Don't use deprecated link call
Autoaccept reverts to the last stable revision
Support protocol-relative URLs in the whitelist
Kill code that's been unnecessary since 2006
Kill code that's been unnecessary since 2006
Remove unused variable $newRights
Don't inline hard coded CSS
Only skip apparent null-edits when the page exists
Don't pass empty strings to strpos
Prevent fatal error in Special:AbuseFilter/test
Also, this doesn't just affect files:
Okay, here's what's going on in the broken case: In Parser::parse, doTableStuff is running before replaceInternalLinks, which turns "[[File:Information icon.svg|20px|link=||alt=]]" into "[[File:Information icon.svg|20px|link=</td>
<td>alt=]]". Unsurprisingly, when replaceInternalLinks then gets called on that mess, it doesn't do you what you wanted.