LibreOffice Logo LibreOffice Logo Extensions, Documentation and Templates repository

Code Colorizer Formatter

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

★ ★ ★ ★ ☆
Extensions Writer
Download latest

latest release: 2024-03-21 15:39:12

Description

Colorize Basic, Bash, Bat, C++, C#, Java, Perl, Python, R, Rust, 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: www.pitonyak.org

Release Description Compatibility Operating Systems License Release notes Updated  
5.0.1 3.3 Linux, Windows, macOS MIT Updated lots of keywords. 

As requested, I added Rust support. I do not use Rust, but it seemed to work on the examples that I pulled off the web. If you find something that does not work, let me know. 
2020-10-01 14:23:28 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 2020-03-05 22:49:55 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.
2020-03-05 22:49:55 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.
2020-03-05 22:49:55 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. 2020-03-05 22:49:54 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. 2020-03-05 22:49:53 Download
3.1.4 Fixed a bug in XML processing and added initial support for GO. 3.3 2020-03-05 22:49:52 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.
2020-03-05 22:49:52 Download
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.  2020-03-05 22:49:51 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.
2020-03-05 22:49:51 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.
2020-03-05 22:49:50 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.
2020-03-05 22:49:50 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. 2020-03-05 22:49:50 Download
Show more

Related Extensions

localwriter

Logo for localwriter

A LibreOffice Writer extension that adds local-inference generative AI features.

09-2024

1995

★ ★ ★ ★ ☆

VBA Expressions

Logo for VBA Expressions

VBA Expressions is a powerful string expression evaluator for LO Basic, providing the user with more than 100 mathematical, statistical, financial, date-time, logical and text manipulation functions, with support for variables and arrays.

10-2024

5658

★ ★ ★ ★ ★

GigaChat plugin(Individual)

Logo for GigaChat plugin(Individual)

The GigaChat plugin, is an innovative tool leveraging neural network technology to effectively execute user requests. This cutting-edge plugin utilizes advanced AI algorithms to fulfill a wide range of user needs and interactions, providing effic

04-2024

274

★ ☆ ☆ ☆ ☆

APA version 7 template

Logo for APA version 7 template

An APA 7 template for reports a complex version.

06-2024

901

Not rated yet

GigaChat plugin(Enterprise)

Logo for GigaChat plugin(Enterprise)

The GigaChat plugin, is an innovative tool leveraging neural network technology to effectively execute user requests. This cutting-edge plugin utilizes advanced AI algorithms to fulfill a wide range of user needs and interactions, providing effic

04-2024

906

Not rated yet

Thai Thesaurus

Logo for Thai Thesaurus

This Thai thesaurus provides Thai synonyms data generated from the dataset of PyThaiNLP thai-synonym project.

04-2024

218

★ ★ ★ ★ ★

Feedback

★ ★ ★ ★ ☆

Post your review

You cannot post reviews until you have logged in. Login Here.

Reviews

  • Łukasz Konieczny Dec 14, 2020, 10:32 AM (4 years ago)

    ★ ★ ★ ★ ★

    Thank you for this LibreOffice extension. It's great.
    There is only one problem. I use version 5.0.1 and configuration menu in this release is missing. Could you fix it? Thank you in advance.

    • L M Mar 23, 2023, 3:44 PM (20 months ago)

      I confirm that Configuration doesn't work here too... Moreover, I tried installing version 4.1.1 to complete the configuration and now I have the font set as "Courier New", no matter how I try to change it! :/

  • Nashvin Aug 14, 2020, 2:51 PM (4 years ago)

    ★ ★ ★ ★ ★

    Thank you!
    Very easy to use.
    Everything works great!

  • artin Aug 13, 2020, 1:14 AM (4 years ago)

    ★ ★ ★ ★ ★

    Are you going to release it for Rust?

    • Andrew Pitonyak Sep 30, 2020, 8:41 PM (4 years ago)

      I do not know rust, but, I do have a "working" version that supports rust. Need to work out the permissions issues here since I cannot currently push a new update, I will work with them on that. If you drop me an email (andrew@pitonyak.org) I can send you the oxt directly until the permissions on this web site are worked out.

  • Christopher Aug 6, 2020, 7:32 PM (4 years ago)

    ☆ ☆ ☆ ☆ ☆

    Thanks a lot! :)

  • Oscar Jul 12, 2020, 5:38 PM (4 years ago)

    ★ ★ ★ ★ ★

    Thank you!

  • Mathieu Jun 5, 2020, 1:22 PM (4 years ago)

    ★ ★ ★ ★ ★

    Thank you very much! This is great!

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