Skip to content

nibags/apparmor-ksyntaxhighlighting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppArmor Profiles Syntax Highlighting Definition for Kate (KSyntaxHighlighting Framework)

Example of AppArmor profile syntax highlighting

Author: Nibaldo González (nibgonz@gmail.com)

Last Change: February 2021

Last Version: Version 15 is included in KDE Frameworks 5.80.0+ and is based on AppArmor 3.0.

This file is part of the KDE's KSyntaxHighlighting Framework.

Description:

Add syntax highlighting to KDE text editors (such as Kate, KWrite, KDevelop or any application that uses the KSyntaxHighlighting or KTextEditor Framework) for the AppArmor Security Profiles.

The apparmor.xml file contains the definition of the syntax highlighting. If you want to test the highlighting, you can find a sample AppArmor profile in the test folder.

For details on the syntax of AppArmor profiles, visit:

About XML Files of Syntax Highlighting Definition:

The syntax highlighting definition files, of the KSyntaxHighlighting Framework, consist of XML files that are compiled in the KDE Frameworks libraries.

However, these XML files can also be stored in:

For local user $HOME/.local/share/org.kde.syntax-highlighting/syntax/
For all users /usr/share/org.kde.syntax-highlighting/syntax/
For Flatpak packages $HOME/.var/app/package-name/data/org.kde.syntax-highlighting/syntax/
For Snap packages $HOME/snap/package-name/current/.local/share/org.kde.syntax-highlighting/syntax/
On Windows %USERPROFILE%\AppData\Local\org.kde.syntax-highlighting\syntax\
On macOS $HOME/Library/Application Support/org.kde.syntax-highlighting/syntax/

For more details of KSyntaxHighlighting Framework, visit:

Installation:

If you do not have the latest version of KDE Frameworks, you can manually install the latest apparmor.xml file.

Copy the apparmor.xml file to the directory of the XML syntax definition files, mentioned in the previous section.

Ex.: For local user:

mkdir -p $HOME/.local/share/org.kde.syntax-highlighting/syntax/
cp ./apparmor.xml $HOME/.local/share/org.kde.syntax-highlighting/syntax/

For all users:

sudo mkdir -p /usr/share/org.kde.syntax-highlighting/syntax/
sudo cp ./apparmor.xml /usr/share/org.kde.syntax-highlighting/syntax/

Usage:

Syntax highlighting of AppArmor profiles is automatically applied to named files: bin.*, sbin.*, usr.bin.*, usr.sbin.*, usr.lib.*, usr.lib64.*, usr.lib32.*, usr.libx32.*, usr.libexec.*, usr.local.bin.*, usr.local.sbin.*, usr.local.lib*, opt.*, etc.cron.*, snap.*, snap-update-ns.* & snap-confine.*.

You can also force the syntax highlighting, by writing a comment with:

kate: syntax AppArmor Security Profile;

List of Versions:

apparmor.xml
Version
Date KDE
Frameworks
AppArmor
Support
Relevant Changes
15 Feb. 19, 2021 5.80.0 3.0.0 Improvements in the performance of RegExpr rules.
12 Oct. 02, 2020 5.75.0 3.0.0 Add ABI rules and new profile flags.
9 Jun. 20, 2019 5.60.0 2.13.3
  • Add new network domain keywords.
  • Fixes: remove unsupported "to" operator for link rules and only highlight the "in" operator in mount rules. Only highlight valid numbers in rlimit rules.
8 Apr. 02, 2019 5.58.0 2.13.2
  • Do not highlight variable assignments and alias rules within profiles.
  • Remove one indentation.
7 Sep. 15, 2018 5.51.0 2.13.0
  • Update itemData's style for the new Solarized color schemes of Kate.
  • Fixed freezing of Kate when using this highlighter in open rules, after the update to KF5.50.0.
6 Jul. 24, 2018 5.50.0 2.13.0
  • Add "if exists" in Include rules.
  • Multiple fixes and improvements.
4 & 5 Jan. 25, 2018 5.43.0 2.12.0
  • Add keywords of network and mount rules, default abstractions, default variables and others.
  • Do not allow comments within rules and in variable assignment lines.
2 & 3 Sep. 24, 2017 5.39.0 2.11.0
  • Each rule has its own context.
  • The profile label is highlighted in the profile header and the profile transition rules.
1 Initial version, not published.