Home Download Buy Blog Forum Support

ExportHtml Plugin (rename from PrintHtml)

Re: PrintHtml Plugin

Postby seth007 on Wed Apr 18, 2012 1:55 pm

Fixed as promised! Thanks for this plugin, I will use it a lot. :lol:
seth007
 
Posts: 8
Joined: Tue Mar 20, 2012 9:54 pm

Re: PrintHtml Plugin

Postby SeanWcom on Wed Apr 18, 2012 2:11 pm

I just tested out your annotation branch - I like!! The commands are simple enough, and I love the HTML output it creates.

How possible is it to add the annotate commands to the context menu? If the only item on there was "Toggle Annotation Mode" that would be pretty clean. Then when it's toggled, you could show a flyout menu for the misc annotation commands... something along those lines.

I'm typically a hotkey fanatic, but there's no way I'd remember all the keys for annotation. I could always ctrl-shift-p and use the commands that way of course...

Either way, I love it and will definitely use it. :)
Multiple selections... one of my favorite ST2 features. View some noob-friendly screen casts here.
SeanWcom
 
Posts: 101
Joined: Wed Aug 03, 2011 1:31 am
Location: Georgia

Re: PrintHtml Plugin

Postby facelessuser on Wed Apr 18, 2012 2:15 pm

I will look into context menus. I think the idea of having all the commands appear is a good idea. If context doesn't pan out, I will have one command that will show a quick panel of all the annotation commands.
facelessuser
 
Posts: 1547
Joined: Tue Apr 05, 2011 7:38 pm

Re: PrintHtml Plugin

Postby facelessuser on Wed Apr 18, 2012 4:25 pm

Context menu will be no problem. I will also have it so that the commands will only be enabled if they can be used. So if you want to annotate a selection, you must have a selection for it to not be grayed out etc. All commands will still be available via the command palette as well. Maybe down the road I will consolidate them into a quick panel menu.

I will also add a little status message in the status bar letting you know you are in Annotation Mode.

I will try to get it into tonight. Documentation might happen later if I am lazy.
facelessuser
 
Posts: 1547
Joined: Tue Apr 05, 2011 7:38 pm

Re: PrintHtml Plugin

Postby facelessuser on Wed Apr 18, 2012 5:37 pm

Convert code to forum post. I have seen @castles_made_sand_post posting with highlighted text, and figured now that we have the framework to print HTML color coded, why not forum posts as well.

Here is an example. I still have work to do, but stay tuned.

 396     def convert_view_to_post(self, the_post):
397 for line in self.view.split_by_newlines(sublime.Region(self.end, self.size)):
398 self.size = line.end()
399 line = self.convert_line_to_post()
400 the_post.write(self.print_line(line, self.curr_row))
401 self.curr_row += 1
402
403 def format_text(self, line, text, the_colour, the_style, highlight=False):
404 code = (FORUM_CODE % {"color": the_colour, "content": text}).replace('\n', '')
405 line.append(code)
406
407 def convert_line_to_post(self):
408 line = []
409 hl_found = False
410
411 # Continue highlight form last line
412 if self.hl_continue != None:
413 self.curr_hl = self.hl_continue
414 self.hl_continue = None
facelessuser
 
Posts: 1547
Joined: Tue Apr 05, 2011 7:38 pm

Re: PrintHtml Plugin

Postby agibsonsw on Wed Apr 18, 2012 6:41 pm

Be nice if someone added similar annotations- with simple sample code - to the ST API page :) . This small improvement could make a big difference.
"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: PrintHtml Plugin

Postby facelessuser on Wed Apr 18, 2012 7:07 pm

That is going to be it. It should support bold and italic as well.

No Gutter
    def convert_view_to_post(self, the_post):
for line in self.view.split_by_newlines(sublime.Region(self.end, self.size)):
self.empty_space = None
self.size = line.end()
line = self.convert_line_to_post()
the_post.write(self.print_line(line, self.curr_row))
self.curr_row += 1


Gutter
 149     def convert_view_to_post(self, the_post):
150 for line in self.view.split_by_newlines(sublime.Region(self.end, self.size)):
151 self.empty_space = None
152 self.size = line.end()
153 line = self.convert_line_to_post()
154 the_post.write(self.print_line(line, self.curr_row))
155 self.curr_row += 1



Forum posts will only work in forums that allow "[pre']", "[color]", "[b]", and "[i]" blocks. If you use any forum syntax blocks in your code, it will mess things up since there is really no way to escape forum blocks. Gutter numbers are allowed, but fancy styling of the gutter will not be allowed though due to the limitations of the forum post syntax; the default foreground and background color will be used. Highlighting selections will also specific words will also not be allowed due to limitations of the forum post syntax. It will copy the the code to your clipboard and/or open the code in a sublime view.
facelessuser
 
Posts: 1547
Joined: Tue Apr 05, 2011 7:38 pm

Re: PrintHtml Plugin

Postby SeanWcom on Wed Apr 18, 2012 7:30 pm

Ok, that's too cool.
Multiple selections... one of my favorite ST2 features. View some noob-friendly screen casts here.
SeanWcom
 
Posts: 101
Joined: Wed Aug 03, 2011 1:31 am
Location: Georgia

Re: PrintHtml Plugin

Postby quodlibet on Wed Apr 18, 2012 7:32 pm

It's rather beside the point (sorry!), but I was wondering about the provenance of the Print-Color theme. It looks like a black-on-white Monokai. Did you make it for this plugin or did you derive it from somewhere else?
quodlibet
 
Posts: 499
Joined: Sat Jun 18, 2011 5:53 pm

Re: PrintHtml Plugin

Postby facelessuser on Wed Apr 18, 2012 7:42 pm

I took the base Monokai Bright and darkened all of the colors or changed them to look decent on a white background. Changed the background to white, styled the gutter, choose a suitable color for selections etc., adjusted line coloring, blah, blah, blah. You get the idea. Colors were tweaked and adjusted where they made sense. Colors like yellow needed far more aggressive tweaking to work on white.

The Grayscale was also derived from Monokai Bright. Gutted out all colors and left only what changed the font style. Changed all text to black except comments which were light gray color...you get the idea.

I just needed something that looked okay printed, and I needed a template, so I grabbed Monokai Bright and forced it to meet my needs. So in short, I heavily modded it for this plugin.

Probably should mention that in the readme.
facelessuser
 
Posts: 1547
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