-
-
Save dozed/a5573c87a953711d12e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin, subprocess | |
class HtmlToJadeCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
self.view.set_status('html2jade', "html2jade") | |
command = 'html2jade -s' | |
p = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) | |
result, err = p.communicate(self.view.substr(self.view.sel()[0]).encode('utf-8')) | |
if result != "": | |
self.view.replace(edit, self.view.sel()[0], result.decode('utf-8')) | |
sublime.set_timeout(self.clear,0) | |
else: | |
self.view.set_status('html2jade', "html2jade: "+err) | |
sublime.set_timeout(self.clear,10000) | |
def clear(self): | |
self.view.erase_status('html2jade') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment