mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-06 14:02:25 +12:00
ff2cbca028
Some snippets have yet to be converted due to the more complex nature of those snippets, and to keep things neat a separate commit makes more sense for those.
42 lines
855 B
Python
42 lines
855 B
Python
#!/usr/bin/env python
|
|
# --!-- coding: utf8 --!--
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
|
|
from PyQt5.QtCore import Qt
|
|
from PyQt5.QtWidgets import qApp, QMessageBox
|
|
from PyQt5.QtGui import QCursor
|
|
|
|
from manuskript.converters import abstractConverter
|
|
from manuskript.functions import mainWindow
|
|
|
|
import logging
|
|
LOGGER = logging.getLogger(__name__)
|
|
|
|
try:
|
|
import markdown as MD
|
|
except ImportError:
|
|
MD = None
|
|
|
|
|
|
class markdownConverter(abstractConverter):
|
|
"""
|
|
Converter using python module markdown.
|
|
"""
|
|
|
|
name = "python module markdown"
|
|
|
|
@classmethod
|
|
def isValid(self):
|
|
return MD != None
|
|
|
|
@classmethod
|
|
def convert(self, markdown):
|
|
if not self.isValid:
|
|
LOGGER.error("markdownConverter is called but not valid.")
|
|
return ""
|
|
|
|
html = MD.markdown(markdown)
|
|
return html
|