Hi, I am trying to strip out the categories of an article to display them in a separate inputbox below the edit page inputbox (see http://www.mediawiki.org/wiki/Extension:CategorySuggest). I use parser->parse() and then parseroutput->getCategories() to get the categories. I would then like to have wikitext without the category links in the edit window. I got nice html without the category links from the parser and of course I still have the original wikitext with the category links. But I don't have wikitext without category links. How can I a) strip out the categories (while observing nowiki tags) from the wikitext or b) convert the html to wiki text or c) any other ideas?
Thanks, Andi
On Thu, Mar 6, 2008 at 8:54 AM, Andreas Rindler mediawiki@jenandi.com wrote:
I would then like to have wikitext without the category links in the edit window. I got nice html without the category links from the parser and of course I still have the original wikitext with the category links.
How do you want to handle categories that are added by templates?
On 06/03/2008, Simetrical Simetrical+wikilist@gmail.com wrote:
On Thu, Mar 6, 2008 at 8:54 AM, Andreas Rindler mediawiki@jenandi.com wrote:
I would then like to have wikitext without the category links in the edit window. I got nice html without the category links from the parser and of course I still have the original wikitext with the category links.
How do you want to handle categories that are added by templates?
I currently don't deal with categories added through templates. On the edit page, it simply shows the existing (manually typed) categories in a separate inputbox.
On Thu, Mar 6, 2008 at 10:40 AM, Andreas Rindler arindler@jenandi.com wrote:
I currently don't deal with categories added through templates. On the edit page, it simply shows the existing (manually typed) categories in a separate inputbox.
There are no methods provided to do this (that I know of). You'll presumably have to write your own. Since you aren't doing template expansion, this might not be *too* hard: you have to skip <nowiki>, <noinclude>/<includeonly>/<onlyinclude>, template parameters, and parameters to at least some extension tags, plus of course HTML attributes and comments. (<onlyinclude> is actually kind of a confusing case, because it changes the semantics of the rest of the page, but you can probably ignore that to begin with, at least.)
Haven't you heard of HotCat [1]? Sounds to me like you are reinventing the wheel...
[1] http://commons.wikimedia.org/wiki/MediaWiki_talk:Gadget-HotCat.js
wikitech-l@lists.wikimedia.org