iPhone 上的维基百科阅读器

发布于 2024-09-28 21:02:57 字数 304 浏览 0 评论 0原文

我想为 iPhone 制作一个维基百科阅读器。最好的方法是什么?

我已经对此进行了一些思考。使用维基百科 API 加载维基百科站点的内容非常容易。但困难在于如何以良好的方式显示内容。内容是用 wikipedia 标签标记的,而不是 html。我的想法是解析整个内容并用真正的 html 标签交换这些元素,然后将文本(现在为 html)加载到 UIWebView 中并使用自定义 CSS 文件应用我自己的样式。

但我不确定这是否是一个很好的解决方案。对于我的问题还有其他更好的解决方案还是我的方法正确?如果您能提供相关教程或示例,那就太好了。

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虫児飞 2024-10-05 21:02:57

内容是用维基百科标签标记的,而不是 html。

这对您有利,因为您可能不想在像 iPhone 这样小的屏幕上使用常规的维基百科布局。

我的想法是解析整个内容并用真正的 html 标签交换这些元素,然后将文本(现在为 html)加载到 UIWebView 中并使用自定义 CSS 文件应用我自己的样式。

但我不确定这是否是一个非常好的解决方案。

MediaWiki(维基百科自己的软件)也差不多就是这样做的; render() 函数调用大量内部内容来解析标记。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文