Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 4, 2014 21:07:38 GMT 1
Highlight is a tool that create documents (HTML, RTF...) from source codes. It supports impressive number of 180 programming languages. I've created configuration files for Highlight to work with BaCon. Most likely you will find Highlight in your distro repository. If not, you can build it from source. To use Highlight with BaCon, unpack attached zip and place filetypes.conf in /etc/highlight/ and bacon.lang in /share/highlight/langDefs/ (this is how it looks on my Lubuntu - may looks different on other distros). Now, you are ready to use Highlight with BaCon. To convert a BaCon source code to HTML format type highlight -i your_program.bac -o output_file.html in the terminal. Highlight offers many themes to choose from. To list them type highlight --list-themes. To use specific theme type highlight -i your_program.bac -s theme_name -o output_file.html. Regards! Attachments:bacon-highlight.zip (3.17 KB)
|
|
|
Post by Pjot on Nov 5, 2014 7:28:48 GMT 1
Thanks Tomaaz! Some comments: - I had to put 'bacon.lang' into /usr/share/highlight/langDefs/
- On my Linux Mint there is a conflict with the 'highlight' script of MintSystem in /usr/local/bin. So I have to use '/usr/bin/hightlight' explicitly.
- The resulting output unfortunately has a problem with commented lines (see attachment)?
BR Peter Attachments:ga.html (14.21 KB)
|
|
|
Post by Pjot on Nov 5, 2014 7:46:49 GMT 1
Hi Tomaaz, There are some small errors in the bacon.lang file which I corrected. Please find the new version attached. BR Peter Attachments:bacon.lang (3.88 KB)
|
|
|
Post by Pjot on Nov 5, 2014 8:23:48 GMT 1
Made some more refinements in the language definition. This is my current usage: Greetings, Peter Attachments:bacon.lang (3.7 KB)
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 5, 2014 11:37:41 GMT 1
Yesterday, I tested it only with very simple BaCon examples. It worked fine, but I understood it wasn't a final version. I was planning to improve it today, but... there is no need to do it anymore, because you just did a brilliant job with it! Yes, it should be /usr/share/highlight/langDefs/. That was my mistake. Today I did an ultimate test - converting BaCon version of BaCon to HTML. With your file it works properly. For those who haven't tried Highlight - check the attachment to see how it looks (converted with 'pablo' theme). Attachments:bacon.html.zip (80.8 KB)
|
|
|
Post by Pjot on Nov 11, 2014 0:09:29 GMT 1
Hey Tomaaz, Currently, I am redesigning the PRINT dialog in BaConGUI. I need a conversion from BaCon plain text files to Post Script. Usually, one can use the good old enscript utility to do this: The enscript utility can be installed from any DEB repository (Synaptic). Reading through its manpage, I saw enscript also supports syntax highlighting. I created a syntax file which must be put into the '/usr/share/enscript/hl/ directory'. Then simply run: The resulting PostScript file can be sent to the printer, so now we can have syntax highlighted printed programs also Of course, the PostScript file can be converted to PDF by using 'ps2pdf'. As a side note, enscript supports ANSI, HTML and RTF as well (just like Highlight). However, the styles to choose from are somewhat limited. In these examples I have chosen for 'emacs'. BR Peter Attachments:bacon.st (6.2 KB)
|
|