微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 如何使用MediaWiki解析器从wikitext获取HTML

我正在尝试使用Wikipedia的Mediawiki解析器来解析维基百科标记文本到HTML.
在这里阅读了手册 – https://www.mediawiki.org/wiki/Manual:Parser.php
但是,因为我是PHP的新手,所以我无法编写测试脚本,

这是我想要解析并转换为HTML的示例输入:

Shakespeare's sonnets
==Characters==
When analysed as characters, the subjects of the sonnets are usually referred
to as the Fair Youth, the Rival Poet, and the Dark Lady. The speaker expresses
admiration for the Fair Youth's beauty, and later has an affair with the Dark
Lady. It is not kNown whether the poems and their characters are fiction or
autobiographical; scholars who find the sonnets to be autobiographical, notably
[[A. L. Rowse]], have attempted to identify the characters with historical
individuals.

解决方法:

你甚至不必使用PHP.您可以使用Wikipedia的API(或您自己的Mediawiki安装上的API).有关更多信息,请参见Parsing wikitext.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐