与mediawiki兼容的python解析器。
smc.mw的Python项目详细描述
使用
运行测试:
$ make -C tests
测试结果可以在tests/out/report.html中找到。
还提供了一个命令行工具(安装为“mw”):
$ echo "''Hello World''" | python smc/mw/tool.py <html><body><p><i>Hello World</i> </p></body></html>
差异
有关具体差异,请参见test results。
- _ toc_uu和其他神奇的单词必须单独出现在一行,而mediawiki允许他们每个人都有一些奇怪的结果。
- 现在不支持:NoEditSection、NewSectionLink、NoNewSectionLink。
待办事项
- 测试843:节提取,<;pre>;围绕伪标题(错误10309) 这应该是固定的,因为它会影响解析器扩展(math元素, 等等)。为此,预处理器语法需要包括 解析的特定(但不是所有)XML元素(反例:div 元素对于标题是透明的,而前置元素则不是)。
谢谢
解析器使用resqsoft公司和juancarlo añez为peg语法提供的grako解析器生成器。
版权所有
smc.mw
版权所有(c)2013语义有限公司。保留所有权利。
有关许可,请参见文件license.txt。
semantics Kommunikationsmanagement GmbH Viktoriaallee 45 D-52066 Aachen Germany email: info(at)semantics.de url: http://www.semantics.de/
jquery
smc.mw在测试套件中的tests/static/jquery-1.10.1.min.js:
下包含jqueryCopyright 2013 jQuery Foundation and other contributors http://jquery.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
测试数据
tests/data/parserTests.txt下的测试数据 tests/extra-data/*.txt是从mediawiki项目中逐字复制的:
MediaWiki Parser test cases Some taken from http://meta.wikimedia.org/wiki/Parser_testing All (C) their respective authors and released under the GPL
潮位
tests/mytidylib中的tidylib实现派生自 pytidylib,0.2.1版:
Copyright 2009 Jason Stitt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.