Usage of kateschema converter

Last weekend I went nuts and wrote a script to convert my old theme for Kate/KDevelop, I truly almost lost it.

The script as I made it only works with files exported by the GUI, when you export whole scheme and save it somewhere. I don’t think it will work with only data for one file type (it can be easily modified to do so). So, if you try to use your full kateschema/highlighting file which stores multiple themes at once the script can “export” a random mix (I wonder how usable that would be, maybe we can get some funny results).

The interface/command line options part of the script was done at the last moment when it was actually working (for me that is) and I was deadly tired. Before you start open the script in some text editor and look at the top for “settings” dictionary and its values, which I tried to briefly explain there. There are two configuration options available:

  1. prefferStandAloneData
  2. IncludeCustoms

prefferStandAloneData forces script to use settings stored for that data type. The reasoning for this option is simple, in old file format you could specify color/style settings for one data type differently based on current file type. In other words your CSS file content could be styled in different way when opened standalone in editor, different when viewed in HTML (inside <style></style>), different in PHP and so on. This is one of the reason for moving to theme files, but it is pain to convert. SO select what you wish or design a better solution. A sad thing is that you will not see the generated values as defaults, but I can live with that.

IncludeCustoms allows script to attempt (I am only aware of one tester which is me) to convert the style for all data types/syntax highlighting settings available. When set to False it will generate simple theme file without any custom things, it is nice base to start adapting your current theme which you spent years using.

And start the program:

script.py ThemeName mytheme.kateschema

The script requires 2 arguments.

  1. ThemeName - specify how you wish to name the theme, it is so far only used for metadata
  2. kateschema file - path to your exported kateschema file.

The results will be printed to stdout. I was too tired and this was the simplest way I could think of. You can always redirect the output to the file with your shell:

script.py ThemeName mytheme.kateschema > new.theme

And in the end, import the theme to Kate/KDevelop and enjoy.

For brave one here are my suggestions on improvements.

  • The theme name could be used to select right highlighting setting from global kateschema file, probably by just adding check if string ends with the name. The INI file section for highlighting are names as “Highlighting language - Schema MySchemaName” and such I think this.
  • Some user interface could be made to select theme to export from global file (in my thoughts this is done when you export it from Kate/KDevelop directly). It can be useful in the future
  • There re probably many checks which I did not do in the code. It is probably not possible to convert files for single data type/language.

In short:

  1. Export your theme
  2. Open script in text editor and adjust settings to your needs
  3. Run the script and save the output. (the result is printed to stdout)
  4. Import theme to Kate/KDevelop
  5. Use the script as an example and create even better one.

And I almost forgot, the script can be either found at my repository or in KDE Syntax Highlighting repository.

Articles from blogs I follow:

Calamares towards 3.3.11

I’m going to change up the Calamares release process a little. It’s been slow going as a community-maintained project – which isn’t to say that that is a bad thing. Just slow. I’ve decided to make releases marginally more predictable than “when [ade] has …

via [bobulate] October 24, 2024

There is only one reason why Microsoft Windows is the dominating operating system on the PC desktop

The Internet is filled with blog posts, articles on tech media, and videos on YouTube about why Linux is not the main operating system on the PC desktop. "5 reasons why", "10 reasons why", bla, bla, bla. But they are all wrong.

via unixdigest.com August 24, 2024

Signing Android Apps Using a YubiKey (on NixOS)

In my spare time, I currently develop two Android apps using Flutter: AniTrack, a simple anime and manga tracker based on my own needs, and Moxxy, a modern XMPP client. While I don't provide release builds for AniTrack, I do for Moxxy. Those are signed u…

via PapaTutuWawa's Blog July 24, 2023

Generated by openring