views:

32

answers:

1

I want to make a Wikipedia Reader for the iPhone. What's the best approach?

I've already made a few thought about that. Loading the content of the Wikipedia site is quite easy using the Wikipedia API.But the difficulty is how to display the content in a nice way. The content is marked up with wikipedia tags, not html. My idea is to parse the whole content and exchange these elements with real html tags, then I load the text (now in html) into a UIWebView and apply my own styles using a custom CSS file.

But I'm not sure if this a very good solution. Are there any other and better solution for my problem or am I on a right way? It would be nice if you could give a tutorial or and example on that.

Thanks

A: 

The content is marked up with wikipedia tags, not html.

This is to your benefit, since you probably don't want to use the regular Wikipedia layout on a screen as small as the iPhone's.

My idea is to parse the whole content and exchange these elements with real html tags, then I load the text (now in html) into a UIWebView and apply my own styles using a custom CSS file.

But I'm not sure if this a very good solution.

This is pretty much how MediaWiki (Wikipedia's own software) does it as well; the render() function calls lots of internal stuff to parse the markup.

Sören Kuklau
Is there a library for parsing wiki content? Or do I need to create all methods from the ground up? RegexKitLite seems to be a really good way to do that parsing.
burki
There's [a number of parsers](http://www.mediawiki.org/wiki/Alternative_parsers), but apparently none in Objective-C. It's not that hard to parse, really.
Sören Kuklau