I followed the directions here:
countergram.com/open-source/pyti … index.html
But instead of “installing” pytidylib, I downloaded the source and put the “tidylib” directory under Sublime’s Packages/User directory.
Then I had to change line 33 in init.py like so - putting ‘tidy’ first got it running on Windows.
LIB_NAMES = 'tidy', 'libtidy', 'libtidy.so', 'libtidy-0.99.so.0', 'cygtidy-0-99-0',
'tidylib', 'libtidy.dylib']
Then I created a Sublime command:
[code]import sublime, sublime_plugin
from tidylib import tidy_document
class XmlTidyCommand(sublime_plugin.TextCommand):
def run(self, edit):
allRegion = sublime.Region(0, self.view.size())
allText = self.view.substr(allRegion)
document, errors = tidy_document(allText, options={‘input-xml’:1, ‘indent’:1, ‘newline’:‘LF’})
self.view.replace(edit, allRegion, document)
if errors != “”:
sublime.error_message(errors)
else:
sublime.status_message(“Xml Tidy: No errors”)[/code]