我正在嘗試使用維基百科的MediaWiki解析器來將Wikipedia標記文本解析爲HTML。 我通過手動去這裏 - https://www.mediawiki.org/wiki/Manual:Parser.php 然而,因爲我完全新的PHP,我不能寫一個測試腳本,如何使用MediaWiki解析器從wikitext獲取HTML
這裏是我想解析和轉換爲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.
我使用這個項目來解析 https://code.google.com/p/gwtwiki/ 這個項目給了我HTML輸出,但保留超鏈接和一些標籤,我想刪除,所以我將不得不寫一個scrubber 但是mediawiki解析器的文檔聲明它定義了函數來獲取我需要的,所以我希望使用它..而且它的官方解析器爲Wikipedia –