code colorizer formatter Code Colorizer Formatter

Tags: Extension Macro Writer

Rating: ★ ★ ★ ★ ★

Colorize BASH, Basic, C++, Java, Perl, PHP, Python, R, SQL, XML, C#, Lisp, Object C, JavaScript, Ruby, 8085 Assembler, and x86 Assembler.

Description

Colorize Basic, Bash, Bat, C++, C#, Java, Perl, Python, R, XML, PHP, SQL, Go, Ruby, and Assembler (8085 and x86). A simple parser is used to identify elements in the supported languages; for example, keywords, literals, comments, and operators.

 

Each element type is set to use a specific character style. The style sets the color used for that portion. Each supported language has its own set of character styles, so you can easily customize the colors for each language.

 

Menu options exist to "colorize" selected text in the specified language. I format my code snippets using paragraph styles. I place the cursor in the code snippet and then use Tools > Addons > MacroFormatterADP > {language} > {current | selected | all}.

I use specific paragraph styles for my code examples. The currently supported paragraph styles are "_OOoComputerCode", "_OOoComputerCodeInTable", "_OOoComputerCodeLastLine", "_code", "_code_first_line", "_code_last_line", and "_code_one_line". It is up to the user to make sure code is formatted using a paragraph style with one of the supported names. Note that my macro documents contain these styles, and, they can be created in the current document using Tools > Addons > MacroFormatterADP > Configuration > Create Paragraph Styles.

 

When a paragraph style is created, it must have a next paragraph style. Some of the styles assume that the next paragraph style is a code type; for example, _OOoComputerCode style assumes that the next paragraph style is _OOoComputerCode. OOoComputerCodeLastLine, however, assumes that the next paragraph style is OOoTextBody. This is used when the paragraph styles are created.

 

Use Tools > Addons > MacroFormatterADP > Configuration to set the Font name, the next paragraph style, text size, and where tab stops should be set. I attempted to configure appropriate localizations for English, French, German, Spanish, Russian, and Japanese. I have no abilities in some of these languages, so, feel free to provide corrections.

 

For my typical use, I use paragraph styles for my "code". Next, I place the text cursor in the paragraph, then I tell it to format the entire set of code. The macros find the first and last line, then format everything in those paragraphs. Sometimes, however, I simply select the fragment of interest and then "format" the selected text. 

 

If you see something you feel is missing, drop me an email. Note, however, that I receive literally hundreds of emails every day, so I sometimes miss one. I will respond if I notice the email. So, try to use a meaningful subject line. 

 

This extension is implemented in Basic. So, you can see the code, and even change it. If I forget to include the source document used to create the extension, let me know and I will send you a copy. 

Homepage: http://www.pitonyak.org

Release List

  • Release Description Compatibility Operating Systems License Release notes  
  • 4.1.1 I added support for JSON. 5.0 Linux, Windows, macOS MIT

    Colorize Basic, Bash, Bat, C++, C#, Java, JavaScript, JSON, LISP, Perl, Python, R, XML, PHP, SQL, Squirrel, Go, Ruby, and Assembler (8085 and x86). A simple parser is used to identify elements in the supported languages; for example, keywords, literals, comments, and operators. Each element type is set to use a specific character style. The style sets the color used for that portion. In BASIC, the colors resemble those used by the Basic IDE. This allows for "pretty" code fragments in a Writer document. Menu options exist to "colorize" selected text in the specified language. 

    Download
  • 4.0.3 x2 This should now contain the configuration menus that I accidentally removed in 4.0.2
    Second try to add 4.0.3 since I do not see how to release 4.0.3 so I will add this a second time.
    5.0 Linux, Windows, macOS

    This should now contain the configuration menus that I accidentally removed in 4.0.2
    Second try to add 4.0.3 since I do not see how to release 4.0.3 so I will add this a second time.

    Download
  • 4.0.3 In 4.0.2 I removed the configuration menu (oops) so I put it back in. Also, I will try to add the full source to build the extension in a zip file (if it lets me). 5.0 Linux, Windows, macOS

    In 4.0.2 I removed the configuration menu (oops) so I put it back in.

    Download
  • 4.0.2 I modified the menu structure so that it is nested; it works better for me. Also, more languages are implemented. I added initial support for Squirrel by request (that means you Kelvin) and changes will be made based on his feedback. 5.0 Has some level of support for Basic, Bash, Bat, C++, C#, Go, Java, JavaScript, Lisp, Perl, PHP, Python, R, Ruby, SQL, 8085, x86, and XML. I only tested this release with LO 5.x, but it should work on LO and AOO for most versions. Download
  • 3.1.4 Fixed a bug in XML processing and added initial support for GO. 3.3 Download
  • 3.1.3 Use a more specific common base for character styles. Add new languages Ruby, Bat, JavaScript, Lisp, and Objective C. 3.3 Currently support the following languages: Windows BAT files are now supported, as is the full set of commands known to Take Command (from JP Soft). This includes numerous external commands as well. I rarely use the rest of these languages, and, some of them are not very carefully tested. I added mildly tested support for Ruby, javaScript, Lisp, and Object C. Download
  • 3.1.1 This release adds support for BASH. 3.3 Adds support for BASH. I have provided only limited testing of BASH at this point, so suggestions and testing are welcome. In theory, there are different colors for primary key words (such as "if") and alternate colors for external keywords such as 'ls'. I am open for color changes. Download
  • 3.04 Added PHP and SQL support. Added a few new C++ keywords. 4.2 The SQL portion recognizes TRANSACT SQL for MS SQL Server. I removed single letter keywords for some other SQL systems such as "A", "C", "G", and "M". PHP support existed for a while, and I finally added menu support for PHP. Finally, I added a few keywords for C++ that I somehow missed. I have only tested against LO 4.2.4, but, there is no reason that this should not work with any version of LO. Download
  • 3.04 Added PHP and SQL support. Added a few new C++ keywords. 4.2 The SQL portion recognizes TRANSACT SQL for MS SQL Server. I removed single letter keywords for some other SQL systems such as "A", "C", "G", and "M". PHP support existed for a while, and I finally added menu support for PHP. Finally, I added a few keywords for C++ that I somehow missed. I have only tested against LO 4.2.4, but, there is no reason that this should not work with any version of LO. Download
  • 3.0.1 Added menu options to support 8085 and x86 Assembler. Recognize more registers and assembler directives. Fixed a assembler directives that contained an extra space in the name. 3.3 The tar file contains the files that I use to build the extension. This uses the extension builder created by Bernard Marcelly. This provides a good working example of creating menus and using a dialog that has localization files. Download
  • 3.0.1 Added menu options to support 8085 and x86 Assembler. Recognize more registers and assembler directives. Fixed a assembler directives that contained an extra space in the name. 3.3 The tar file contains the files that I use to build the extension. This uses the extension builder created by Bernard Marcelly. This provides a good working example of creating menus and using a dialog that has localization files. Download
  • 3.0.0 First release for LibreOffice. Added support for 8085 Assembler and x86 assembler. This capability is available from the macro menus (as in you must run them manually) and I have not yet added them to the menus. 3.4 Download

Feedback

★ ★ ★ ★ ★

Post your review

Reviews

  • Mathieu Jun 5, 2020, 1:22 PM (35 days ago)

    ★ ★ ★ ★ ★

    Thank you very much! This is great!

RSS feed for reviews on this page | RSS feed for all reviews