Export C source as HTML or PDF file

Started by Pelle, March 16, 2005, 07:34:45 PM

Previous topic - Next topic

Pelle

The attached Add-In can be used to export C source code as a HTML or PDF file - with syntax color highlighting. Maybe useful to someone...

Tested with 3.00 Beta, but will probably work with 2.90 too...

New Mar 18: Added export to PDF files...
New Mar 22: Added compression to PDF files... - thanks Timppa!

- Use Export.ppj for no compression.
- Use ExportZ.ppj for compression - in this case you also need ZLIB 1.2.2 (http://www.zlib.net) in the subdirectory zlib-1.2.2.

Pelle
/Pelle

Vortex

Code it... That's all...

Gerome

Hello Pelles,

Very useful program :)
BTW, in the same taste, a C to XML would be nice :)

Pelle

Quote from: "Vortex"Very nice work

Thanks, Vortex!

Pelle
/Pelle

Pelle

Hello,

Quote from: "Gerome"Very useful program :)
BTW, in the same taste, a C to XML would be nice :)
Thanks!

I'm not sure about the best representation/format for XML. Do you have an example, or know where I can find it...?

Export to PDF files would be nice to, but I'm not sure how to do that either.

Pelle
/Pelle

Gerome

Hi,

XML ?
Yes i have ideas :)


<PROJECT>
 <FILENAME>MySample.c</FILENAME>
 <BEFOREFOOS>#include + declares + ...</BEFOREFOOS>
   <FOOS>
     <NAME>specialfoo</NAME>
     <BODY>void specialfoo(void)...</BODY>
     ...
   </FOOS>
   <FOOS>
     <NAME>otherfoo</NAME>
     <BODY>int *otherfoo(void)...</BODY>
     ...
   </FOOS>
</PROJECT>


would be a good start ? :)
After that, one can imagine making easy documentation and/or snippet database combined with an XSD layer it can be terribly useful :)

Quote from: "Pelle"Hello,

Quote from: "Gerome"Very useful program :)
BTW, in the same taste, a C to XML would be nice :)
Thanks!

I'm not sure about the best representation/format for XML. Do you have an example, or know where I can find it...?

Export to PDF files would be nice to, but I'm not sure how to do that either.

Pelle

Pelle

OK, but this requires a different parser that better understands various C elements, like functions. Maybe some day...

Pelle
/Pelle

Justin Thyme

Quote from: "Pelle"

Export to PDF files would be nice to, but I'm not sure how to do that either.


If you check out SciTE, it has an export to PDF function (in SciTE itself, not Scintilla), although I'm not sure if the export maintains highlighting.  But it might be a start to get you going.

http://scintilla.sourceforge.net/

Good luck!

Pelle

Quote from: "Justin Thyme"If you check out SciTE, it has an export to PDF function (in SciTE itself, not Scintilla), although I'm not sure if the export maintains highlighting.  But it might be a start to get you going.
Thanks - I will look at it. I found a reference manual at Adobe. I got it working in 'hack-ish' way - need to make it more reusable...

Pelle
/Pelle

Robert

Hi Pelle:

I have modified your C to HTML converter addin so that the size of the exported HTML is significantly decreased. I enclosed the exported <body> .. </body> with <pre> ... </pre>, allowing <br> to be discarded, and replaced "class" with "id", and replaced "span" with "code" allowing "&nbsp;" to be replaced with a space.

I have only used the output with I.E. 6.0 so programmers using other browsers may have issues with the HTML export.

Merry Christmas to all !

Robert Wishlaw

Pelle

Hello Robert,

Cool - thanks!

...and Merry Christmas...!

Pelle
/Pelle

kobold

Great thing, could be very usefull - thx
Merry christmas!

Robert

Quote from: "Robert"Hi Pelle:

I have modified your C to HTML converter addin so that the size of the exported HTML is significantly decreased. I enclosed the exported <body> .. </body> with <pre> ... </pre>, allowing <br> to be discarded, and replaced "class" with "id", and replaced "span" with "code" allowing "&nbsp;" to be replaced with a space.

I have only used the output with I.E. 6.0 so programmers using other browsers may have issues with the HTML export.

Merry Christmas to all !

Robert Wishlaw

Attached is a revised version of Pelle's C to HTML converter in which the "id" selector has been reverted to "class".

Although "id" seems to work, according to the CSS 2.0 standard, it is not meant to be used in more than one element instance and so multiple instances are tagged as non-compliant in strict type checking editors.

This non-compliance will probably cause problems in the future as the browsers become more compliant to the CSS 2.0 standard.

Robert Wishlaw

JohnF


Robert

Hi John:

Yes, go ahead, I have no objections.

Robert Wishlaw