Code Colorizer Formatter

9 2

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

Project 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. 

Category/Categories

Macro, Writer Extension

Homepage of the Project

http://www.pitonyak.org

Logo

Current Release

Code Colorizer Formatter - 4.1.1

Released Nov 03, 2017 — tested with:

LibreOffice 5.0, LibreOffice 5.1, LibreOffice 5.2, LibreOffice 5.3, LibreOffice 5.4,

I added support for JSON.
More about this release…

MacroFormatterADP-4.1.1.oxt
All platforms
File size: 95 kb

All Releases

Version

Released

Platform(s)

Compatibility

Description

License(s)

Status

4.1.1

Nov 03, 2017
  • All platforms
  • LibreOffice 5.0
  • LibreOffice 5.1
  • LibreOffice 5.2
  • LibreOffice 5.3
  • LibreOffice 5.4
I added support for JSON.
  • MIT (Massachusetts Institute of Technology)
final

4.0.3

  • All platforms
  • LibreOffice 5.0
  • LibreOffice 5.1
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).
  • Public Domain
pre-release

4.0.3 x2

  • All platforms
  • LibreOffice 5.0
  • LibreOffice 5.1
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.
  • Public Domain
pre-release

4.0.2

Sep 02, 2016
    • LibreOffice 5.0
    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.
    • Public Domain
    final

    3.1.4

    Aug 28, 2015
      • LibreOffice 3.3
      • LibreOffice 3.4
      • LibreOffice 3.5
      • LibreOffice 3.6
      • LibreOffice 4.0
      • LibreOffice 4.1
      • LibreOffice 4.2
      • LibreOffice 4.3
      • LibreOffice 4.4
      • LibreOffice 5.0
      Fixed a bug in XML processing and added initial support for GO.
      • Public Domain
      final

      3.1.3

      Mar 01, 2015
        • LibreOffice 3.3
        • LibreOffice 3.4
        • LibreOffice 3.5
        • LibreOffice 3.6
        • LibreOffice 4.0
        • LibreOffice 4.1
        • LibreOffice 4.2
        • LibreOffice 4.3
        • LibreOffice 4.4
        Use a more specific common base for character styles. Add new languages Ruby, Bat, JavaScript, Lisp, and Objective C.
        • Public Domain
        • Public Domain
        • Public Domain
        final

        3.1.1

          • LibreOffice 3.3
          • LibreOffice 3.4
          • LibreOffice 3.5
          • LibreOffice 3.6
          • LibreOffice 4.0
          • LibreOffice 4.1
          • LibreOffice 4.2
          • LibreOffice 4.3
          • LibreOffice 4.4
          This release adds support for BASH.
          • Public Domain
          • Public Domain
          • Public Domain
          pre-release

          3.04

          Jun 02, 2014
            • LibreOffice 4.2
            Added PHP and SQL support. Added a few new C++ keywords.
            • Public Domain
            final

            3.0.1

            Dec 01, 2011
              • LibreOffice 3.3
              • LibreOffice 3.4
              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.
              • Public Domain
              final

              3.0.0

              Nov 30, 2011
                • LibreOffice 3.4
                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.
                • Public Domain
                final

                Legal Disclaimer and Limitations for Downloads

                The Document Foundation has not reviewed, and cannot review, all of the material, including computer software, available on or by means of The Document Foundation's
                websites, and cannot therefore be responsible for that material's content, use or effects. By operating its websites, The Document Foundation does not represent or imply that it endorses the material there available, or that it believes such material to be accurate, useful or nonharmful. You are responsible for taking precautions as necessary to protect yourself and your computer systems from viruses, worms, Trojan horses and other harmful or destructive content. The Document Foundation's websites may contain content that is offensive, indecent or otherwise objectionable, as well as content containing technical inaccuracies, typographical mistakes and other errors. The Document Foundation's websites may also contain material that violates the privacy or publicity rights, or infringes the proprietary rights, of third parties, or the downloading, copying or use of which is subject to additional terms and conditions, stated or unstated. The Document Foundation disclaims any responsibility for any harm resulting from the use by The Document Foundation's visitors of The Document Foundation's websites, or from any downloading by those visitors of content available on or by means of The Document Foundation's websites.

                Changes

                Content contained on The Document Foundation's websites, including these Legal Disclaimers and Limitations, may be changed at the sole discretion of The Document Foundation and without notice. You are bound by any such updates or changes, and so should periodically review these Legal Disclaimers and Limitations.

                If you believe any file is present on the site contrary to any TDF rule or applicable law, please supply full details to info@documentfoundation.org for impartial consideration.