Sublime Forum

ST3: ExportHtml

#66

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.

[pre=#2D2D2D]def get_package_asset(package_name, file_name, get_path=False, recursive_search=False):
packages_path = sublime.packages_path()
sublime_package = package_name + “.sublime-package”
path = None

if os.path.exists(os.path.join(packages_path, package_name)):
    if recursive_search:
        path = _find_file(os.path.join(packages_path, package_name), file_name)
    elif os.path.exists(os.path.join(packages_path, package_name, file_name)):
        path = os.path.join(packages_path, package_name, file_name)[/pre]
0 Likes

#67

bike-shedding, that was a new one for me; had to consult google :smile:. Yeah, I try not to get too invested in my stylistic opinions. Usually, I throw it out there and if people ignore it, I shrug it off. I realize my opinion doesn’t govern the world :smile:.

0 Likes

#68

github.com/sublimator/PackageRe … sources.py

My shed got purple :smile:

0 Likes

#69

[quote=“castles_made_of_sand”]https://github.com/sublimator/PackageResources/blob/master/package_resources.py

My shed got purple :smile:[/quote]

Cool. I will give it a try.

0 Likes

#70

Send us a pull request when you find bugs or add features eh …

The globber aint finished btw …

0 Likes

#71

[quote=“facelessuser”]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.[/quote]

That’s a clever use of memoization :smiley:

0 Likes

#72

[quote=“facelessuser”]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.
[/quote]

Woops, that was bad. :blush:

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

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

0 Likes

#73

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).

0 Likes

#74

[quote=“skuroda”]
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"))[/quote]

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()

0 Likes

#75

**“De”**coded

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 :smile:

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

0 Likes

#76

Okay fine UTF-8 decoded by default. :smile: 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.

0 Likes

#77

I stole some of your ideas :smile:

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.

0 Likes

#78

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 :smile:. I will probably roll out a new ExportHtml rev tomorrow. Got too much stuff tonight going on.

0 Likes

#79

[quote=“castles_made_of_sand”]
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.[/quote]

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.

Haha. Don’t tell me you want to try to do something like this person did (link)

0 Likes

#80

[quote=“skuroda”]
Haha. Don’t tell me you want to try to do something like this person did (link)[/quote]

That sounds awesome…if only I could get away with it… :smile:.

0 Likes

#81

New version published with the ability to find color schemes in zip files. Thanks everyone for your contributions.

0 Likes

#82

Looks like a couple of my plugins don’t work when they are archived as .sublime-package. This should be fixed for ExportHtml now.

0 Likes

#83

I’m currently using build 3020 and can not seem to override nor access the default settings. Is this an ExportHTML issue or a ST3 package issue? Is the master branch compatible with ST3 now?

0 Likes

#84

Overriding the settings file on 3020 should not be a problem. I know that at work on my Windows machine it is working fine. What platform are you on: windows, mac, linux?

As for accessing the default, I have just pushed a commit that allows for access to default settings via the menu at Preferences->Packages->ExportHtml.

As for branches, none of the main branches support ST3 at this time. I am waiting to see how Package Control sorts all of this out. It is way too much work to make these plugins (especially the complicated ones) support both ST2 and ST3. While possible, it may become pretty fragile, ugly, and troublesome in the future with new features etc. With that said, supporting multiple branches is also going to become tiresome as well, and I have full intentions to kill off support for the ST2 branches no later than the official ST3 release (if not sooner). While I won’t delete ST2 branches, I plan on providing no future work on them either as long as they are stable. They may get moved somewhere else, and the main branch might just become the ST3 branch.

0 Likes

#85

I’m using Windows 7 64bit. I have upgraded to the latest package using Package Control by setting the following in my Packages\User\Package Control.sublime-settings

[code] “repositories”:

	"https://github.com/facelessuser/ExportHtml/tree/ST3"
][/code]

I was able to pull in your latest change (from today), but I still don’t see my menu or any of my settings overriding the defaults.

0 Likes