Sublime Forum

ExportHtml Plugin (rename from PrintHtml)

#21

Thanks for the info.

I am (slowly) putting together a light (i.e., black-on-white) theme that looks good when working on my usual stuff (HTML, CSS, Text/Markdown), so I’ve been peeking into all the light tmThemes I come across. I’m currently using Espresso Soda as a base with some bits of Monokai and my own eccentricities thrown in, but I think you may be onto something with this one :smile:

0 Likes

#22

[quote=“quodlibet”]Thanks for the info.

I am (slowly) putting together a light (i.e., black-on-white) theme that looks good when working on my usual stuff (HTML, CSS, Text/Markdown), so I’ve been peeking into all the light tmThemes I come across. I’m currently using Espresso Soda as a base with some bits of Monokai and my own eccentricities thrown in, but I think you may be onto something with this one :smile:[/quote]

Thanks. I was pretty pleased with it, but I know tastes can vary greatly when it comes to people’s code themes. I am glad it to hear you like it. I will keep an eye out for what you are cooking up.

0 Likes

#23

I suppose it would be possible :laughing: to have settings for the colours of things like ‘keyword’, ‘comment’, ‘string’, etc., and push them into the colour dictionary. That is, overwriting the values extracted from the user’s theme. But I feel a little guilty mentioning this :smile:

0 Likes

#24

It would be, but I figure if someone wants different colors than XXXXXX.tmTheme, they can just copy the tmTheme file and modify it how they want and use that. Keeping a separate file format to style the text when we already have tmTheme files just doesn’t seem like something that would be useful.

0 Likes

#25

@facelessuser: Quite right :wink:

0 Likes

#26

This is awesome. Great work!

0 Likes

#27

Annotations and Forum Post Format is in…

Let the syntax highlighted posts commence :smile:.

I will update documentation today or tomorrow, and then I will update the revision.

If the context menu items are too much (there are 3 items), I can shove them under one common fly out menu.

0 Likes

#28

I will probably rename the forum command to Print BBCode which is more accurate.

0 Likes

#29

Awesome, now we can all feel as cool as @castles_made_of_sand when we post code on the forum :stuck_out_tongue:

0 Likes

#30

:smile:

0 Likes

#31

Great job with the updates - loving the context menu stuff. :smile:

0 Likes

#32

Glad you like it. I have to say, the context menu makes it easier to use.

0 Likes

#33

Hi,
great Plugin! Unfortunately there seems to be a problem with PHP files (for me) - JSON or Plain Text is working. I have installed the plugin and didn’t change any settings. When I want to print a PHP file (from the menu), the console says:

Traceback (most recent call last):
  File ".\sublime_plugin.py", line 356, in run_
  File ".\PrintToHTML.py", line 44, in run
  File ".\PrintToHTML.py", line 170, in convert_to_html
  File ".\PrintToHTML.py", line 124, in get_lexer
  File ".\pygments\lexers\__init__.py", line 74, in get_lexer_by_name
  File ".\pygments\lexer.py", line 470, in __call__
  File ".\pygments\lexers\web.py", line 870, in __init__
ImportError: No module named _phpbuiltins

Is it a bug or do I have do configure something for PHP files?

Setup: ST2 2194 Nightly, WIN7.

Best regards, Thorsten.

0 Likes

#34

Your error message refers to an alternative plugin **PrintToHtml **rather than PrintHtml. You may want to disable or un-install it so you can test this one without conflict.

0 Likes

#35

[quote=“planet”]Hi,
great Plugin! Unfortunately there seems to be a problem with PHP files (for me) - JSON or Plain Text is working. I have installed the plugin and didn’t change any settings. When I want to print a PHP file (from the menu), the console says:

Traceback (most recent call last): File ".\sublime_plugin.py", line 356, in run_ File ".\PrintToHTML.py", line 44, in run File ".\PrintToHTML.py", line 170, in convert_to_html File ".\PrintToHTML.py", line 124, in get_lexer File ".\pygments\lexers\__init__.py", line 74, in get_lexer_by_name File ".\pygments\lexer.py", line 470, in __call__ File ".\pygments\lexers\web.py", line 870, in __init__ ImportError: No module named _phpbuiltins [/quote]

The bug is not with my plugin “PrintHtml” but with another called “PrintToHtml”; I don’t use pygments to convert files.

This brings up an interesting point though. I think I need a more unique name. These two Plugin names seem too similar. I should really address this before moving this to Package Control.

Any suggestions?

0 Likes

#36

What about OutputHtml (or HtmlOutput)? or CreateHtml. Or

**AndyAndFaceLessUsersFantasticToolForGeneratingHtmlOutput ** :smile:

0 Likes

#37

HtmlExport ?

0 Likes

#38

An attempt to catch BBCode references in code and escape them (by underlining the key word)
[pre=#000000]NUMBERED_BBCODE_LINE = ‘%(color)s]%(line)s /color]%(code)s\n’

BBCODE_LINE = ‘%(code)s\n’

BBCODE_CODE = ‘%(color)s]%(content)s/color]’

BBCODE_ESCAPE = ‘/color]%(color_open)s]%(content)s/color]%(color_close)s]’

BBCODE_BOLD = ‘b]%(content)s/b]’

BBCODE_ITALIC = ‘i]%(content)s/i]’

POST_START = ‘[pre=[/color]%(bg_color)s]’

POST_END = ‘/pre]\n’

BBCODE_MATCH =* r*"""(/?)((?:code|pre|table|tr|td|th|b|i|u|sup|color|url|img|list|trac|center|quote|size|li|ul|ol|youtube|gvideo)(?:=^]]+)?)(])"""[/pre]

Seems to work :smile:
[size=85][pre=#000000][/size]pre=#000000]color=#F8F8F2]NUMBERED_BBCODE_LINE /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]color=]color=#AE81FF]%(color)s/color]color=#E6DB74]]/color]color=#AE81FF]%(line)s/color]color=#E6DB74] //color]color=#E6DB74]color/color]color=#E6DB74]]/color]color=#AE81FF]%(code)s/color]color=#AE81FF]\n/color]color=#E6DB74]’/color]

color=#F8F8F2]BBCODE_LINE /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#AE81FF]%(code)s/color]color=#AE81FF]\n/color]color=#E6DB74]’/color]

color=#F8F8F2]BBCODE_CODE /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]color=]color=#AE81FF]%(color)s/color]color=#E6DB74]]/color]color=#AE81FF]%(content)s/color]color=#E6DB74]//color]color=#E6DB74]color/color]color=#E6DB74]]/color]color=#E6DB74]’/color]

color=#F8F8F2]BBCODE_ESCAPE /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]//color]color=#E6DB74]color/color]color=#E6DB74]]color=]color=#AE81FF]%(color_open)s/color]color=#E6DB74]]/color]color=#AE81FF]%(content)s/color]color=#E6DB74]//color]color=#E6DB74]color/color]color=#E6DB74]]color=]color=#AE81FF]%(color_close)s/color]color=#E6DB74]]/color]color=#E6DB74]’/color]

color=#F8F8F2]BBCODE_BOLD /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]/color]color=#E6DB74]b/color]color=#E6DB74]]/color]color=#AE81FF]%(content)s/color]color=#E6DB74]//color]color=#E6DB74]b/color]color=#E6DB74]]/color]color=#E6DB74]’/color]

color=#F8F8F2]BBCODE_ITALIC /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]/color]color=#E6DB74]i/color]color=#E6DB74]]/color]color=#AE81FF]%(content)s/color]color=#E6DB74]//color]color=#E6DB74]i/color]color=#E6DB74]]/color]color=#E6DB74]’/color]

color=#F8F8F2]POST_START /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]pre=]color=#AE81FF]%(bg_color)s/color]color=#E6DB74]]/color]color=#E6DB74]’/color]

color=#F8F8F2]POST_END /color]color=#F92672]=/color]color=#E6DB74] ‘/color]color=#E6DB74]//color]color=#E6DB74]pre/color]color=#E6DB74]]/color]color=#AE81FF]\n/color]color=#E6DB74]’/color]

color=#F8F8F2]BBCODE_MATCH /color]color=#F92672]=/color]i]color=#66D9EF] r/color]/i]color=#E6DB74]"""/color]color=#E6DB74](/color]color=#AE81FF]/color]color=#E6DB74]//color]color=#F92672]?/color]color=#E6DB74])(/color]color=#E6DB74](/color]color=#E6DB74]?:/color]color=#E6DB74]code/color]color=#F92672]|/color]color=#E6DB74]pre/color]color=#F92672]|/color]color=#E6DB74]table/color]color=#F92672]|/color]color=#E6DB74]tr/color]color=#F92672]|/color]color=#E6DB74]td/color]color=#F92672]|/color]color=#E6DB74]th/color]color=#F92672]|/color]color=#E6DB74]b/color]color=#F92672]|/color]color=#E6DB74]i/color]color=#F92672]|/color]color=#E6DB74]u/color]color=#F92672]|/color]color=#E6DB74]sup/color]color=#F92672]|/color]color=#E6DB74]color/color]color=#F92672]|/color]color=#E6DB74]url/color]color=#F92672]|/color]color=#E6DB74]img/color]color=#F92672]|/color]color=#E6DB74]list/color]color=#F92672]|/color]color=#E6DB74]trac/color]color=#F92672]|/color]color=#E6DB74]center/color]color=#F92672]|/color]color=#E6DB74]quote/color]color=#F92672]|/color]color=#E6DB74]size/color]color=#F92672]|/color]color=#E6DB74]li/color]color=#F92672]|/color]color=#E6DB74]ul/color]color=#F92672]|/color]color=#E6DB74]ol/color]color=#F92672]|/color]color=#E6DB74]youtube/color]color=#F92672]|/color]color=#E6DB74]gvideo/color]color=#E6DB74])(/color]color=#E6DB74]?:/color]color=#E6DB74]=/color]color=#AE81FF]/color]color=#F92672]^/color]color=#AE81FF]]/color]color=#AE81FF]]/color]color=#F92672]+/color]color=#E6DB74])/color]color=#F92672]?/color]color=#E6DB74])(/color]color=#AE81FF]]/color]color=#E6DB74])/color]color=#E6DB74]"""/color]
/pre][/pre]

Edit:
Even better escaping. No underlines needed, and more reliable.

0 Likes

#39

Nice one. I like it. It is actually more true than PrintHtml. I will make the changes later today (which will probably break current installations, but it has to be done). I will also add the BBCode escape as well.

0 Likes

#40

Thanks guys!

I was indeed using PrintToHTML

0 Likes