I’m switching some of my WordPress blog content over to other web sites and reorganizing them into logical book type formats. One nice thing about the WordPress blog is the plugin that helps to format my C source code for Arduino programs and Processing.
I’ve tried copying and pasting the Arduino code into an OpenOffice document but the source code’s color formatting gets lost. I haven’t found a way of using the Arduino and Processing environments to save the source code with the formatting intact.
I started looking into ways of capturing the displays and saving them in Rich Text Format (RTF) documents then possibly writing a program to create the proper HTML formatting. Luckily I didn’t have to go that far. I have three different Integrated Development Environments (IDE) loaded on my computer in addition to the Arduino and Processing language IDEs. Since switching to Ubuntu from Windows a couple of months ago I’m experimenting with several new programming tools at the same time.
I loaded up some sample source code into the Code::Blocks IDE. Formatting based on the source code language shows up in the display. I tried the Save As feature but didn’t see alternate document formats listed. Then I noticed the Export feature. Under the menu item File->Export setting there are four options including HTML, RDF, ODT, and PDF. My goal was to produce the souce code in an HTML document anyway so I chose that option and it worked nicely.
After that I tried Eclipse. I didn’t find an export option and the Save As just used the standard dialog function to save the file with a different name. Eclipse is a great editor to work with and I hope to find a way to make this work.
The third IDE I’m getting to know is NetBeans. NetBeans didn’t offer an Export function but it does provide a File->Print to HTML feature that works nicely too. I found a plugin for NetBeans on the Processing web site. I am going to try the NetBeans Processing Template plugin to see how it works.
There seems to be some good articles about using Processing with Eclipse. I hope I can find an already developed function to create HTML from the formatted display. Also, I’m hoping the NetBeans plugin helps by including more formatting and keyword recognition to more closely match the Processing IDE display.
Anyway, I seem to have found an off the shelf way of adding line numbers to the source code display. The color coded formatting is being preserved and white space is not being smashed when converting into the HTML format.
– About SomeoneKnows –
(c) 2010 Vince Thompson