NO

Author Topic: Export C source as HTML or PDF file  (Read 31282 times)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Export C source as HTML or PDF file
« on: March 16, 2005, 07:34:45 PM »
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

Offline Vortex

  • Member
  • *
  • Posts: 865
    • http://www.vortex.masmcode.com
Export C source as HTML or PDF file
« Reply #1 on: March 16, 2005, 08:28:30 PM »
Very nice work
Code it... That's all...

Gerome

  • Guest
Export C source as HTML or PDF file
« Reply #2 on: March 17, 2005, 10:02:59 AM »
Hello Pelles,

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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Export C source as HTML or PDF file
« Reply #3 on: March 17, 2005, 10:21:57 AM »
Quote from: "Vortex"
Very nice work


Thanks, Vortex!

Pelle
/Pelle

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Export C source as HTML or PDF file
« Reply #4 on: March 17, 2005, 10:27:29 AM »
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

  • Guest
Export C source as HTML or PDF file
« Reply #5 on: March 17, 2005, 12:24:32 PM »
Hi,

XML ?
Yes i have ideas :)

Code: [Select]

<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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Export C source as HTML or PDF file
« Reply #6 on: March 17, 2005, 04:30:44 PM »
OK, but this requires a different parser that better understands various C elements, like functions. Maybe some day...

Pelle
/Pelle

Justin Thyme

  • Guest
Export C source as HTML or PDF file
« Reply #7 on: March 18, 2005, 06:02:23 AM »
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!

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Export C source as HTML or PDF file
« Reply #8 on: March 18, 2005, 10:41:51 AM »
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

Offline Robert

  • Member
  • *
  • Posts: 247
C to HTML Converter
« Reply #9 on: December 23, 2005, 09:59:30 AM »
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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Export C source as HTML or PDF file
« Reply #10 on: December 23, 2005, 10:52:00 AM »
Hello Robert,

Cool - thanks!

...and Merry Christmas...!

Pelle
/Pelle

kobold

  • Guest
Export C source as HTML or PDF file
« Reply #11 on: December 23, 2005, 02:10:23 PM »
Great thing, could be very usefull - thx
Merry christmas!

Offline Robert

  • Member
  • *
  • Posts: 247
Re: C to HTML Converter
« Reply #12 on: January 03, 2006, 01:15:56 AM »
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

  • Guest
Export C source as HTML or PDF file
« Reply #13 on: January 06, 2006, 11:18:42 AM »
Is it ok to include exportToHTML2.zip on my web site ?

John

Offline Robert

  • Member
  • *
  • Posts: 247
Is it ok to include exportToHTML2.zip on my web site ?
« Reply #14 on: January 06, 2006, 08:47:31 PM »
Hi John:

Yes, go ahead, I have no objections.

Robert Wishlaw