Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug fixed

Threadache corrected.
  • Loading branch information...
commit 4f149080753e23f9533fa3fc1bfe408cb4b65649 1 parent e035ead
Daniel Shannon authored

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. +6 5 Markboard.py
11 Markboard.py
@@ -46,6 +46,7 @@ def run(self, edit):
46 46 pandoc = sublime.load_settings("Markboard.sublime-settings").get("use_pandoc", False)
47 47 env = os.environ.copy()
48 48 env['PATH'] = env['PATH'] + ":" + sublime.load_settings("Markboard.sublime-settings").get("pandoc_path", "/usr/local/bin")
  49 + template = sublime.load_settings("Markboard.sublime-settings").get("pandoc_template", None)
49 50
50 51 f = tempfile.NamedTemporaryFile(mode="w+", suffix=".mdown", delete=False)
51 52 writer = f.name
@@ -73,7 +74,7 @@ def run(self, edit):
73 74 f.write(normalString + "\n\n")
74 75 f.close()
75 76
76   - newThread = MarkboardMarkdownProcessor(writer) if not pandoc else MarkboardPandocMarkdownProcessor(writer, self.view.window(), env)
  77 + newThread = MarkboardMarkdownProcessor(writer) if not pandoc else MarkboardPandocMarkdownProcessor(writer, self.view.window(), env, template)
77 78 threads.append(newThread)
78 79 newThread.start()
79 80
@@ -141,21 +142,21 @@ def run(self):
141 142
142 143
143 144 class MarkboardPandocMarkdownProcessor(threading.Thread):
144   - def __init__(self, theFilename, theWindow, env):
  145 + def __init__(self, theFilename, theWindow, env, template=None):
145 146 self.myFilename = theFilename
146 147 self.result = None
147 148 self.window = theWindow
148 149 self.env = env
149 150 threading.Thread.__init__(self)
  151 + self.template = template
150 152
151 153 def run(self):
152 154 f = tempfile.NamedTemporaryFile(mode="w+", suffix=".html", delete=False)
153 155 outFile = f.name
154 156 f.close()
155 157 cmd = ['pandoc', self.myFilename, '--output=%s' % outFile, '--from=markdown', '--to=html', '--smart', '--normalize']
156   - template = sublime.load_settings("Markboard.sublime-settings").get("pandoc_template", None)
157   - if template != None and template != "":
158   - cmd.append("--template=%s", template)
  158 + if self.template != None and self.template != "":
  159 + cmd.append("--template=%s" % self.template)
159 160 try:
160 161 subprocess.call(cmd, env=self.env)
161 162 except Exception as e:

0 comments on commit 4f14908

Please sign in to comment.
Something went wrong with that request. Please try again.