Sublime Forum

ExportHtml Plugin (rename from PrintHtml)

#41

[quote=“agibsonsw”]What about OutputHtml (or HtmlOutput)? or CreateHtml. Or

**AndyAndFaceLessUsersFantasticToolForGeneratingHtmlOutput ** :smile:[/quote]

:smile:

HTMLExport was already taken, so I decided on ExportHtml. Same difference. I will be adding this to package control some time soon. Also, I will update annotation documentation when I get around to it :wink:.

Sorry if settings files changed on you or settings parameter values changed, but it was for the better.

0 Likes

#42

HTMLExport was already taken

The gall!

0 Likes

#43

[quote=“castles_made_of_sand”]
The gall![/quote]

:smile:

All the latest fixes etc., are on the main branch now.

The Package Control request has also been made…now we wait.

0 Likes

#44

I really like this plugin and find it extremely useful for printing and sending syntax highlighted code to others. I use it on OS X, and Windows and have odd behavior on Windows XP (haven’t tested on Win 7 x64 yet). When I define a keymap with only numbers set to true it works fine in OS X but the same fails in Windows unless I define color_scheme. I am running sublime version 2195 in all environments.

Thanks,
Bruce

0 Likes

#45

Do you get some kind of error in the console?

I imagine it can’t resolve the path to your default color scheme file. If you don’t define a color scheme, it tries to use the current color scheme of your view. It looks in your settings file. It assumes that all color schemes are relative to your packages directory, so if your default color scheme path in Preferences.sublime-settings is not relative to the Packages directory, it will fail. What is the path defined in your Preferences.sublime-settings file? I might be able to tweak the logic to better handle paths.

0 Likes

#46

I didn’t get any errors in the console even turning on logging but in user settings I have this “color_scheme”: “C:\Documents and Settings\robert.gidney\Application Data\Sublime Text 2\Packages\Color Scheme - Default\Colorized-200878385388021-Kuroir Theme.tmTheme”,

0 Likes

#47

change this:

 "color_scheme": "C:\\Documents and Settings\\robert.gidney\\Application Data\\Sublime Text 2\\Packages\\Color Scheme - Default\\Colorized-200878385388021-Kuroir Theme.tmTheme"

to this:

 "color_scheme": "Packages\\Color Scheme - Default\\Colorized-200878385388021-Kuroir Theme.tmTheme"

You don’t need absolute path for Sublime. It’s default directory is “Sublime Text 2”.

I will also look into handling absolute paths, but this is not needed for your where yours is located.

0 Likes

#48

OK, I’ll change the path. The interesting thing is in OS X it is relative but not in Windows. This setting was put in automatically when choosing the color scheme from sublime preferences so it will be an issue on Windows when people set their themes that way. I’ll check what it does on Windows 7 x64 in a little bit.

Thanks!

0 Likes

#49

[quote=“rgidney”]OK, I’ll change the path. The interesting thing is in OS X it is relative but not in Windows. This setting was put in automatically when choosing the color scheme from sublime preferences so it will be an issue on Windows when people set their themes that way. I’ll check what it does on Windows 7 x64 in a little bit.

Thanks![/quote]

Hmm…well I will try to add absolute path detection to avoid this issue in the future.

0 Likes

#50

OK, I checked Win 7 64 and did not have the absolute path there so went back to XP machine and changed to another theme and had relative path then. Edited the naming for the theme in the directory and the problem went away so it looks like absolute path handling is not needed after all. I think this occurred because I must have added the color scheme directly off of the github download without editing the name and that triggered an absolute path mapping in sublime somehow.

0 Likes

#51

You can click the link and go straight to the annotation in the HTML.

Version 0.3.0

  • Add annotation jump table for the HTML. Show table with “alt+double_click”

Let me know if you find any bugs.

0 Likes

#52

Very cool!

Any plans on making this available in package manager? I think you mentioned once that you would if folks wanted that… +1 from me, if you’re taking requests. :wink:

0 Likes

#53

[quote=“SeanWcom”]Very cool!

Any plans on making this available in package manager? I think you mentioned once that you would if folks wanted that… +1 from me, if you’re taking requests. :wink:[/quote]

I have put in a request. As soon as wbond gets around to it, it should be there.

0 Likes

#54

I modified ExportHtml.py a little bit because I prefer own font face and font size for the Html view:

It tries at first to find font_size and font_face from ExportHtml.subleme-settings before using the defaults.
Just replace lines 469-470 containing

        self.font_size = settings.get('font_size', 10)
        self.font_face = settings.get('font_face', 'Consolas')

with


        self.font_size = sublime.load_settings(PACKAGE_SETTINGS).get("font_size", settings.get('font_size', 10))
        self.font_face = sublime.load_settings(PACKAGE_SETTINGS).get("font_face", settings.get('font_face', 'Consolas'))
0 Likes

#55

You can now specify an alternate font_size and font_face via the settings file.

[pre=#000000] // By default, ExportHtml uses your current font_face and font_size.
// You can change this setting to always use this value. By default,
// the setting is a literal false, but you can change it to an actual
// font_face to enable this setting.
“alternate_font_face”: false,

// By default, ExportHtml uses your current font_face and font_size.
// You can change this setting to always use this value.  By default,
// the setting is a literal false, but you can change it to an actual
// font_size to enable this setting.
"alternate_font_size": false,[/pre]
0 Likes

#56

Plugin is now on package control.

Also, a couple of fixes have been made.

Version 0.4.0

  • Fix regression with option numbers = false
  • Fix issue where if transparency was included in hex color, color would not render
  • Fix regression where annotation table would not show
0 Likes

#57

For a moment I thought that the active color schemes were being applied, but now that I’ve changed color schemes, it doesn’t seem to be taking effect. Was it ever observing the active color scheme or does it play by its own rules?

For example, I have tried exporting the ExportHtml.sublime-settings file using this Tango theme and what I see in the browser is not what is displayed in Sublime Text 2.

BTW, I do have “alternate_scheme” set to false, as in the default settings.



0 Likes

#58

[quote=“Grant”]For a moment I thought that the active color schemes were being applied, but now that I’ve changed color schemes, it doesn’t seem to be taking effect. Was it ever observing the active color scheme or does it play by its own rules?

For example, I have tried exporting the ExportHtml.sublime-settings file using this Tango theme and what I see in the browser is not what is displayed in Sublime Text 2.

BTW, I do have “alternate_scheme” set to false, as in the default settings.[/quote]

Just remove the “color_scheme” setting form the particular setting you wish to adopt the current theme. If the “color_scheme” is specified, it will use it, if it isn’t, it grabs whatever is the current theme.

For instance, I have this in my settings file to give show the current theme in the browser:

[pre=#000000] // Browser view color (selections and multi-selections allowed)
{
“Browser View - Current Color”: {
“numbers”: true,
“multi_select”: true
}
},[/pre]

0 Likes

#59

That’s it. Thanks!

0 Likes

#60

Any chance in getting formatted into the clipboard?

Here’s a couple links that I found that may be of some use:
CoffeeGhost - Pyperclip – A cross-platform clipboard module for Python
HTML Clipboard Format (MSDN)

0 Likes