Home Download Buy Blog Forum Support

ST3: ExportHtml

Re: ST3: ExportHtml

Postby agibsonsw on Sat Feb 16, 2013 5:17 pm

facelessuser wrote:I do do a number of score selectors, but not as many as you would think.

I grab the scope name from the selection and then compare all of the theme scopes with score_selector. Once I determine the best matches, I add the scope name with the best theme scope matches for foreground, background, etc. to the dictionary and never have to run score_selector on the same scope again.

I don't notice much of a difference with the ST2 version and the ST3 version for this plugin.

That's a clever use of memoization :D
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: ST3: ExportHtml

Postby skuroda on Sat Feb 16, 2013 6:07 pm

facelessuser wrote:There seems to be a bug with path return. If path was not recursive, you would return the path as a boolean. I have fixed it below.


Woops, that was bad. :oops:

Is it possible to have assets outside of one of the sublime text paths (as specified in the following test)

Code: Select all
r2 = (tc("/Abs/Packages/ZipPseudo.sublime-package/nested/sort.py"))


Made a couple updates. Used walk's recursion rather than my own. get_package_and_asset_name should now
skuroda
 
Posts: 676
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby skuroda on Sat Feb 16, 2013 7:49 pm

Think I've taken everything that has been mentioned. get_package_asset now defaults to returning files UTF-8 encoded. In addition, there are two new parameters, a boolean to return the data in it's binary form (default false) and a string for encoding type (default utf-8).
skuroda
 
Posts: 676
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby sublimator on Sun Feb 17, 2013 1:18 am

skuroda wrote:Is it possible to have assets outside of one of the sublime text paths (as specified in the following test)

CODE: SELECT ALL
r2 = (tc("/Abs/Packages/ZipPseudo.sublime-package/nested/sort.py"))


I don't think so, not meaningfully anyway. If your routine relies on removing the install path prefixes just kill the test case.

In contrast to a path like `Packages/Yes/no.yes`

`Abs` there was just symbolic of an absolute path to the executable folder or installed_packages_path()
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby sublimator on Sun Feb 17, 2013 1:25 am

skuroda wrote:now defaults to returning files UTF-8 encoded


"De"coded

https://gist.github.com/skuroda/4965913 ... set-py-L62
Not sure if you wanted this to work on ST2 as well as ST3, but afaik, the open builtin on python2 doesn't take an encoding kwarg.

I think codecs.open, on the other hand, works :)

Code: Select all
   encoding            String representing the encoding to use when reading.
                        Only takes affect when return_binary is True
                        (default utf-8).

I think that was meant to be `when return binary is False`
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby skuroda on Sun Feb 17, 2013 1:48 am

Okay fine UTF-8 decoded by default. :) Yup definitely should be False. Hmm I should fix that, no reason this shouldn't work for ST2 and 3. I guess if I was thinking beforehand I would have written something like this earlier. I should take a closer look at your PackageResources stuff. It's probably a lot better than mine. Though if I only wrote code where it was better than everyone else's, well I wouldn't be writing very much. And that's no fun. Thanks for all the feedback.
skuroda
 
Posts: 676
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby sublimator on Sun Feb 17, 2013 1:55 am

skuroda wrote: I should take a closer look at your PackageResources stuff.


I stole some of your ideas :)

There's some other functionality in there (that I eventually want to finish ... one of these days ) re: globbing

Was doing flat globbing until you made me realize that settings / keymaps could be nested.

re: package assets:

Turn on sublime.log_commands(True) and run the menu item `Preferences -> Default keybindings`

Take note of the command and args.

You can use that `${packages}/Path/to.file` form to open package assets, be they zipped or not. If they zipped they are open in read only mode.

Dunno if that's interesting to you for anything but I think it's kinda neat.
It is better to remain silent and be thought a fool, than to speak out and remove all doubt
sublimator
 
Posts: 649
Joined: Thu Mar 20, 2008 5:41 am

Re: ST3: ExportHtml

Postby facelessuser on Sun Feb 17, 2013 2:08 am

Everybody's stuff seems to work great for what I am doing. I didn't really have to do anything...I could get used to this :). I will probably roll out a new ExportHtml rev tomorrow. Got too much stuff tonight going on.
facelessuser
 
Posts: 1542
Joined: Tue Apr 05, 2011 7:38 pm

Re: ST3: ExportHtml

Postby skuroda on Sun Feb 17, 2013 2:20 am

castles_made_of_sand wrote:Turn on sublime.log_commands(True) and run the menu item `Preferences -> Default keybindings`

Take note of the command and args.

You can use that `${packages}/Path/to.file` form to open package assets, be they zipped or not. If they zipped they are open in read only mode.

Dunno if that's interesting to you for anything but I think it's kinda neat.


That is interesting. I have to say, I'm glad ST3 was updated to make those files read only if they were read from sublime-packages.

facelessuser wrote:Everybody's stuff seems to work great for what I am doing. I didn't really have to do anything...I could get used to this :). I will probably roll out a new ExportHtml rev tomorrow. Got too much stuff tonight going on.


Haha. Don't tell me you want to try to do something like this person did (link)
skuroda
 
Posts: 676
Joined: Fri Oct 05, 2012 8:11 am

Re: ST3: ExportHtml

Postby facelessuser on Sun Feb 17, 2013 2:30 am

skuroda wrote:Haha. Don't tell me you want to try to do something like this person did (link)


That sounds awesome...if only I could get away with it... :).
facelessuser
 
Posts: 1542
Joined: Tue Apr 05, 2011 7:38 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 7 guests