GNOME Bugzilla – Bug 612368
Language definition for Apache configuration files
Last modified: 2021-07-05 10:59:30 UTC
Created attachment 155698 [details] Language definition for Apache configuration files I wrote a language definition for Apache configuration files, based on the one written by Jan Janssen for Kate, and under LGPL (<http://kate-editor.org/syntax/3.2/apache.xml>). I attach the ".lang" file. Would it be possible to release it with GtkSourceView? Thanks.
Thanks! the file looks good, I think we can include it in the next version even if we are string frozen (by putting it in POTFILES.skip for now). Just a couple of nitpicks - I do not like very much the name "Alternates"... is that standard Apache terminology or something you came up with? - I prefer to use two spaces indent instead of tabs for xml files, so that it is consistent with the other lang files
also, by looking at some example httpd.conf, I think we shuld also highlight "strings" like ErrorDocument 500 "The server made a boo boo."
Created attachment 155818 [details] Language definition file improved (In reply to comment #1) > - I do not like very much the name "Alternates"... is that standard Apache > terminology or something you came up with? It was used in the Kate's file. I attach a new file. I changed some terms: container => section-directive alternates => options used two spaces indent and added a few contexts (decimal, double-quoted-string, escaped-character, back-reference and server-variable).
Hi, a thing that came up while discussing this file on irc is that as far as I understand apache directives are case insensitive another slightly suspicious thing is this line in a keyword list: <keyword>(?<!Deny,)Allow(?!,Deny)</keyword>
(In reply to comment #4) > Hi, a thing that came up while discussing this file on irc is that as far as I > understand apache directives are case insensitive Yes. See the doc: > Directives in the configuration files are case-insensitive, but arguments to > directives are often case sensitive. Source: http://httpd.apache.org/docs/2.2/en/configuring.html#syntax But I don't know how to deal with it in GtkSourceView 2.x. The attribute "case-sensitive" seems to be usable only for the tag "default-regex-options". See the language definition v2.0 reference: http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-reference.html With GtkSourceView 1.x, there was an element "keyword-list" that was accepting such an attribute, as we can see in the XML format description for syntax highlight for the GtkSourceView 1.x library: /usr/share/gtksourceview-2.0/language-specs/language.rng An example can be found in this file: /usr/share/gtksourceview-2.0/language-specs/msil.lang However, "keyword-list" seems to have been removed in GtkSourceView 2.x. Must I revert to version 1 to be able to use case insensitive keywords? > another slightly suspicious thing is this line in a keyword list: > > <keyword>(?<!Deny,)Allow(?!,Deny)</keyword> It's to make the difference between directive and option. In the context "directives", I put: <keyword>(?<!Deny,)Allow(?!,Deny)</keyword> <keyword>(?<!Allow,)Deny(?!,Allow)</keyword> and in the context "options", I put: <keyword>Deny,Allow</keyword> <keyword>Allow,Deny</keyword> The directives "Allow" and "Deny" will be styled with «style-ref="directives"», and the options "Deny,Allow" and "Allow,Deny" will be styled with «style-ref="options"». Here's an example: <Directory /docroot> Order Deny,Allow Deny from all Allow from env=let_me_in </Directory>
Created attachment 179859 [details] Language definition for Apache configuration files Here's a new version of the language definition for Apache configuration files. ChangeLog: - directives and options are now case-insensitive - differentiation between the "Options" directive and the "Options" option - more comments - options sorted alphabetically - no trailing spaces - no options duplicated May it be included in the next version? Thanks.
Hey the file looks really good. One minor thing: <keyword>(?<!Allow,)Deny(?!,Allow)</keyword> <!-- See "Allow" directive comment. --> ^^^ why is separated from the other one?
(In reply to comment #7) > ^^^ why is separated from the other one? It's just for alphabetical sorting: ... AliasMatch Allow: (?<!Deny,)Allow(?!,Deny) Anonymous ... DeflateFilterNote Deny: (?<!Allow,)Deny(?!,Allow) DirectoryIndex ... But I could put them together, for example: ... AliasMatch (?<!Deny,)Allow(?!,Deny) (?<!Allow,)Deny(?!,Allow) Anonymous ... or sort them according to the gedit "Sort" plugin: ... LoadModule LockFile LogFormat (?<!Allow,)Deny(?!,Allow) (?<!Deny,)Allow(?!,Deny) MetaDir MetaSuffix MimeMagicFile ...
ok, so let's keep it as it is. I was about to push the lang file but I realized that it is missing the classes. See other lang files to know how to deal with them.
Created attachment 195525 [details] Language definition for Apache configuration files (In reply to comment #9) > I was about to push the lang file but I realized that it is missing the > classes. See other lang files to know how to deal with them. Done. See the new attached file.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/gtksourceview/-/issues/ Thank you for your understanding and your help.