News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Export as HTML, RTF, ...

Started by Ceniza, October 13, 2005, 02:04:43 AM

Previous topic - Next topic

Ceniza

I've been considering to write a plugin to export the current opened file in Code::Blocks with highlighted syntax to HTML, RTF and maybe some other formats, just like Dev-C++ and SciTE do.

I've spent a lot of time trying to get all I need to extract the information from the wxScintilla component and Code::Blocks itself so I can get the colors and style.

ATM I've only needed to add a GetColorSet() method to get m_pTheme from cbEditor and it seems to be the only decent way to get what I need, and the only thing I'd really need to be added in the SDK (I hope).

Any complaints, ideas, support, ...?

mandrav

No problem for me, after RC2 of course.
Be patient!
This bug will be fixed soon...

Ceniza

#2
It seems like that will be really the only needed change in the SDK to get the plugin working.

I've made a few tests, played a bit with some stuff and everything else I'll need is in there.

mandrav: Would you really mind to add that function before RC2 is released? It won't change any behavior of it.

EditorColorSet* cbEditor::GetColorSet()
{
  return m_pTheme;
}


EDIT: Yeah, forgot why: the idea is to get it done maybe, just maybe, before RC2 is released or at least have RC2 ready for it.

mandrav

Be patient!
This bug will be fixed soon...

Ceniza

Quote from: mandrav on October 16, 2005, 10:23:58 AM
Done :)

Oh, great!

I just finished the first version of it.

It currently exports HTML and seems to be working fine. I still need to add some more things to get it more "real" (WYSIWYG).

A sample file is here

mandrav: would you mind to add this to contrib?

mandrav

Quotemandrav: would you mind to add this to contrib?

Done.
I hope you don't mind, I converted it to cbPlugin and now creates a "File->Export to HTML" menu item. ;)
Btw, very nice work  8)
Be patient!
This bug will be fixed soon...

Ceniza

Quote from: mandrav on October 17, 2005, 11:46:09 AM
Quotemandrav: would you mind to add this to contrib?

Done.
I hope you don't mind, I converted it to cbPlugin and now creates a "File->Export to HTML" menu item. ;)
Btw, very nice work 8)

Heh, in the first tests I was doing something similar (adding it in the File menu) but then decided to make it more... er... plugin-like.

Having it in the File menu will make it consistent 'cause there's where ppl can find it in both SciTE and Dev-C++, so I don't really mind the change.

Last night I was checking some other minor things so it'll also export the font (name and size). This should be ready today.

I just hope you didn't forget to give me access to the plugin in CVS, oh, and still have access to the other two :P

mandrav

Quote
I just hope you didn't forget to give me access to the plugin in CVS, oh, and still have access to the other two

I hope I haven't ;)
Be patient!
This bug will be fixed soon...

Ceniza

I just committed the latest changes and CVS didn't complain :)

Changes include:

* Current font type and size exported to the HTML file.
* Background colors also exported.
* Applied my coding style to mandrav's changes :)
* Removed the unnecessary checking mandrav pointed out (because of the new way to execute).
* Probably a few bugs introduced in the code :P

squizzz

Quote from: CenizaHTML, RTF and maybe some other formats
Others, like Open Document Format for example? :)
this space is for rent

Ceniza

Quote from: squizzzOthers, like Open Document Format for example? :)

I'mn't any familiar with that format, but yeah, it could be part of other formats.

I'll consider it :)

rickg22

OpenDocument format is the format used by OpenOffice, KOffice and other OpenSource word processors. There was quite a political stir when the state of Massachusetts rejected the Microsoft format in govt. offices for an open document format to avoid vendor lock-in. The OpenDocument format is XML based, and currently is proposed to be an ISO standard.

Ceniza

I just tried converting a RTF file (generated with Dev-C++) to ODT and it's too bloated.

I think the ODT format will have to wait some time until I get enough information to generate it in a simple, non-bloated, way.

I hope to get the RTF format soon though.

Urxae

Quote from: Ceniza on October 18, 2005, 04:21:52 AM
I think the ODT format will have to wait some time until I get enough information to generate it in a simple, non-bloated, way.

I haven't looked at the details myself, but the information is probably available somewhere on this site.

squizzz

Quote from: Ceniza on October 18, 2005, 04:21:52 AMI think the ODT format will have to wait some time until I get enough information to generate it in a simple, non-bloated, way.
I'm afraid that everything XML-based is bloated by default. The good thing is that it usually compresses very well (*.odt uses zip compression I think).

Quote from: rickg22 on October 17, 2005, 10:42:46 PMThere was quite a political stir when the state of Massachusetts rejected the Microsoft format in govt. offices for an open document format to avoid vendor lock-in.
Yeah, that's when I've heard of this and decided to switch. (btw. OOo 2.0 itself is good enough reason to switch :P )

Anyway, great thanks for the plugin. :D
this space is for rent