2016-04-02 06:01:27 +13:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# --!-- coding: utf8 --!--
|
2016-04-08 00:27:51 +12:00
|
|
|
from PyQt5.QtWidgets import qApp
|
2016-04-02 06:01:27 +13:00
|
|
|
|
|
|
|
from manuskript.exporter.basic import basicExporter, basicFormat
|
|
|
|
|
|
|
|
class HTMLFormat(basicFormat):
|
|
|
|
name = "HTML"
|
2016-04-08 00:47:29 +12:00
|
|
|
description = qApp.translate("Export", "A little known format modestly used. You know, web sites for example.")
|
2016-04-02 06:01:27 +13:00
|
|
|
implemented = False
|
|
|
|
requires = {
|
|
|
|
"Settings": True,
|
2016-04-06 03:21:07 +12:00
|
|
|
"Preview": True,
|
2016-04-02 06:01:27 +13:00
|
|
|
}
|
2016-04-08 22:48:19 +12:00
|
|
|
icon="text-html"
|
2016-04-02 06:01:27 +13:00
|
|
|
|
|
|
|
|
|
|
|
class pandocExporter(basicExporter):
|
|
|
|
|
|
|
|
name = "Pandoc"
|
2016-04-08 00:47:29 +12:00
|
|
|
description = qApp.translate("Export", """<p>A universal document convertor. Can be used to convert markdown to a wide range of other
|
2016-04-02 06:01:27 +13:00
|
|
|
formats.</p>
|
|
|
|
<p>Website: <a href="http://www.pandoc.org">http://pandoc.org/</a></p>
|
2016-04-08 00:27:51 +12:00
|
|
|
""")
|
2016-04-02 06:01:27 +13:00
|
|
|
exportTo = [
|
|
|
|
HTMLFormat,
|
2016-04-08 22:48:19 +12:00
|
|
|
basicFormat("ePub", "Books that don't kill trees.", icon="application-epub+zip"),
|
|
|
|
basicFormat("OpenDocument", "OpenDocument format. Used by LibreOffice for example.", icon="application-vnd.oasis.opendocument.text"),
|
|
|
|
basicFormat("PDF", "Needs latex to be installed.", icon="application-pdf"),
|
|
|
|
basicFormat("DocX", "Microsoft Office (.docx) document.", icon="application-vnd.openxmlformats-officedocument.wordprocessingml.document"),
|
|
|
|
basicFormat("reST", icon="text-plain"),
|
2016-04-06 03:21:07 +12:00
|
|
|
|
2016-04-02 06:01:27 +13:00
|
|
|
]
|
|
|
|
cmd = "pandoc"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def version(cls):
|
|
|
|
if cls.isValid():
|
|
|
|
r = cls.run(["-v"])
|
|
|
|
return r.split("\n")[0]
|
|
|
|
else:
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|