使用命令行将 MediaWiki 维基文本格式转换为 HTML
我倾向于编写大量文档,因此 MediaWiki 格式对我来说很容易理解,而且比编写传统 HTML 节省了我很多时间。然而,我也写了一篇博客,发现一直从键盘切换到鼠标来输入正确的 HTML 标签会增加很多时间。我希望能够使用 Mediawiki 语法编写文章,然后将其转换为 HTML 以在我的博客上使用。
我已经尝试过谷歌搜索,但必须需要更好的命名法,因为令人惊讶的是我还没有找到任何东西。
我使用 Linux,并且更喜欢从命令行执行此操作。
有人有什么想法或想法吗?
I tend to write a good amount of documentation so the MediaWiki format to me is easy for me to understand plus it saves me a lot of time than having to write traditional HTML. I, however, also write a blog and find that switching from keyboard to mouse all the time to input the correct tags for HTML adds a lot of time. I'd like to be able to write my articles in Mediawiki syntax and then convert it to HTML for use on my blog.
I've tried Google-ing but must need better nomenclature as surprisingly I haven't been able to find anything.
I use Linux and would prefer to do this from the command line.
Any one have any thoughts or ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最好的办法是使用 MediaWiki 解析器。好消息是 MediaWiki 1.19 将为此提供一个命令行工具!
免责声明:我编写了该工具。
该脚本是
maintenance/parse.php
一些直接来自源代码的使用示例:自己输入文本,以 Control + D 结束:
通常的文件输入方法:
当然还有管道到标准输入:
从今天开始,您可以从 http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/maintenance/parse.php 并将其放在维护目录中。它应该与 MediaWiki 1.18 一起使用
该脚本将在 MediaWiki 1.19.0 中提供。
The best would be to use MediaWiki parser. The good news is that MediaWiki 1.19 will provide a command line tool just for that!
Disclaimer: I wrote that tool.
The script is
maintenance/parse.php
some usage examples straight from the source code:Entering text yourself, ending it with Control + D:
The usual file input method:
And of course piping to stdin:
as of today you can get the script from http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/maintenance/parse.php and place it in your maintenance directory. It should work with MediaWiki 1.18
The script will be made available with MediaWiki 1.19.0.
对此进行了一番研究,认为这里采取的一个好方法是学习通用标记语言,例如重构文本或 Markdown,然后能够从那里进行转换。发现了一个名为 pandoc< /a> 可以将其中任何一个转换为 HTML 和 Mediawiki。感谢您的帮助。
例子:
Looked into this a bit and think that a good route to take here would be to learn to a general markup language like restucturedtext or markdown and then be able to convert from there. Discovered a program called pandoc that can convert either of these to HTML and Mediawiki. Appreciate the help.
Example:
此页面列出了大量您可以尝试的 MediaWiki 解析器。
This page lists tons of MediaWiki parsers that you could try.