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
|
2016-04-15 00:30:31 +12:00
|
|
|
from manuskript.exporter.pandoc.markdown import markdown
|
|
|
|
|
2016-04-02 06:01:27 +13:00
|
|
|
|
|
|
|
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-15 00:30:31 +12:00
|
|
|
markdown,
|
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"
|
|
|
|
|
2016-04-12 19:15:01 +12:00
|
|
|
def __init__(self):
|
|
|
|
basicExporter.__init__(self)
|
|
|
|
|
|
|
|
def version(self):
|
|
|
|
if self.isValid():
|
|
|
|
r = self.run(["-v"])
|
2016-04-02 06:01:27 +13:00
|
|
|
return r.split("\n")[0]
|
|
|
|
else:
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|