After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 323588 - Export highlihgted code
Export highlihgted code
Status: RESOLVED WONTFIX
Product: gedit
Classification: Applications
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
: 345427 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-12-08 20:47 UTC by Ludovic Danigo
Modified: 2009-03-24 02:07 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
HTML export plugin for GEdit (4.48 KB, application/x-compressed-tar)
2006-01-11 23:39 UTC, Markus Johnsson
Details
New version of plugin. (729.25 KB, application/gzip)
2006-01-12 13:13 UTC, Markus Johnsson
Details
New version of plugin. (348.98 KB, application/gzip)
2006-01-12 15:31 UTC, Markus Johnsson
Details

Description Ludovic Danigo 2005-12-08 20:47:24 UTC
It would be nice to be able to save highlighted code from the gtksourceview
buffer to html.
To What would it be useful ?
    * to publish code on a blog or regular website that doesn't have highlither
    * to add code sample to an Open Office presentation
    * I don't see more but the previous two would be damn useful ! ;-)
Comment 1 Paolo Maggi 2006-01-02 17:08:56 UTC
I agree it would be cool to have such plugin.

It should be not too difficult to find already existing code for this.
I remember one of the fist version of gtksourceview had this feature.

Look at the gtk_source_buffer_convert_to_html in http://cvs.gnome.org/viewcvs/gtksourceview/gtksourceview/gtksourcebuffer.c?rev=1.19&view=markup

I think we could export to XML and then convert to HTML using XSLT.


Comment 2 Markus Johnsson 2006-01-11 23:39:39 UTC
Created attachment 57185 [details]
HTML export plugin for GEdit

I've written a plugin that does this. It maybe need some testing, and I know the strings may need some help.. Unpack in "plugins" dir in the gedit source tree and add "htmlexport" to plugins/Makefile.am and "plugins/htmlexport/Makefile" to configure.ac
Comment 3 Markus Johnsson 2006-01-12 13:13:39 UTC
Created attachment 57224 [details]
New version of plugin. 

The plugin is now standalone, no need to build gedit from source. Fixed a HTML special character escaping bug. Code cleanup.
Comment 4 Markus Johnsson 2006-01-12 15:31:39 UTC
Created attachment 57229 [details]
New version of plugin. 

 * More html special characters escaping and escaping of non-ascii characters. 
 * File replace confirmation dialog.
Comment 5 Ludovic Danigo 2006-01-13 20:55:45 UTC
(In reply to comment #4)
> Created an attachment (id=57229) [edit]
> New version of plugin. 

Great !
I'll test it tomorrow or Sunday if I hopefully find time.
Just a few comment looking rapidly at the code (I am proficient in C, so
take it with a grain of salt ;) ) :
  * maybe the html could use an embeded style sheet, it might simplify the code as well (dunno).
  * define a doctype

I'll try to have a look and come with something more constructive ;)

That said, I think it's a plugin that would logically (at least to me) fit
in the list of gedit shipped plugins.

Another solution would be not shipping any plugin at all and have them released
in a separate tarball, that would increase visibility and awareness of plugins existence, maybe.
Comment 6 Markus Johnsson 2006-01-14 09:21:19 UTC
 * About the embedded stylesheet: I tried that, but this way was much easier to implement, and I wanted a fast solution first. Maybe I'll give it another shot. 
 * Found a bug yesterday, but I don't have time to fix it until later today.
Comment 7 Paolo Maggi 2006-03-04 18:30:19 UTC
We are moving all the request for plugins that we don't plan to add to gedit
itself on live.gnome.org/Gedit.

Closing as WONTFIX.
Comment 8 Paolo Borelli 2006-03-04 18:49:54 UTC
since in this case there is a working plugin, Markuss can you make sure to open a page on the wiki? It would really be appreciated
Comment 9 Paolo Maggi 2006-06-20 15:17:23 UTC
*** Bug 345427 has been marked as a duplicate of this bug. ***
Comment 10 cruiseoveride 2009-03-24 02:07:20 UTC
This plugin really needs to be in File->Export as HTML

Actually come to think of it, a lot of gedit plugins should be in gedit as standard.

Anyways, Thanks Markus for the plugin.