Ilmari Karonen wrote:
Jani Patokallio wrote:
I've got a simple Extension that expands an {{#include}} parser function into random text. It works well for most things, but if I try to stick in a new heading, includes/Preprocessor_DOM.php::expand() fails on this...
$titleText = $this->title->getPrefixedDBkey();
because "$this" (a PPFrame_DOM) does not have a title object. As a temporary band-aid, I inserted this into Preprocessor_DOM.php:
There's always $wgTitle. I'm not sure (without actually looking into it) if that's the cleanest solution, but enough things in MediaWiki rely on that global that you can pretty much assume that it'll always be set to something reasonably meaningful.
...eh, sorry, I didn't read your message carefully enough and just assumed that it was your own code that couldn't find the title rather than the parser preprocessor. Should've finished that cup of coffee first. :)
Anyway, I still haven't looked at the code and thus can't offer any concrete advice, but, presumably, if the code expects the PPFrame_DOM object to have a "title" property then you should try to figure out why it doesn't and how to provide it with one. Maybe look at how the parser itself handles it for things like template transclusion.
(Oh, just realized that that's probably where the problem is. The code that generates section edit links must be using that "title" property to decide which page to point the links to, and thus expects whomever is providing the content to parse to set it to something meaningful. If you're outputting headings that don't come from editable wikitext at all, and therefore have no meaningful title to provide, then you need to find out how to disable the section edit links for those headings entirely. Or just kluge it with HTML headings instead.)