After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 612368 - Language definition for Apache configuration files
Language definition for Apache configuration files
Status: RESOLVED OBSOLETE
Product: gtksourceview
Classification: Platform
Component: New *.lang file
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
syntax highlighting
Depends on:
Blocks:
 
 
Reported: 2010-03-10 01:29 UTC by Jean-Philippe Fleury
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Language definition for Apache configuration files (20.60 KB, text/plain)
2010-03-10 01:29 UTC, Jean-Philippe Fleury
Details
Language definition file improved (23.30 KB, text/plain)
2010-03-11 02:19 UTC, Jean-Philippe Fleury
Details
Language definition for Apache configuration files (24.01 KB, text/plain)
2011-02-02 04:05 UTC, Jean-Philippe Fleury
Details
Language definition for Apache configuration files (24.12 KB, text/plain)
2011-09-02 19:56 UTC, Jean-Philippe Fleury
Details

Description Jean-Philippe Fleury 2010-03-10 01:29:54 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.
Comment 1 Paolo Borelli 2010-03-10 08:20:26 UTC
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
Comment 2 Paolo Borelli 2010-03-10 08:26:52 UTC
also, by looking at some example httpd.conf, I think we shuld also highlight "strings" like

ErrorDocument 500 "The server made a boo boo."
Comment 3 Jean-Philippe Fleury 2010-03-11 02:19:33 UTC
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).
Comment 4 Paolo Borelli 2010-04-18 10:42:49 UTC
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>(?&lt;!Deny,)Allow(?!,Deny)</keyword>
Comment 5 Jean-Philippe Fleury 2010-04-26 15:53:59 UTC
(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>(?&lt;!Deny,)Allow(?!,Deny)</keyword>

It's to make the difference between directive and option.

In the context "directives", I put:

      <keyword>(?&lt;!Deny,)Allow(?!,Deny)</keyword>
      <keyword>(?&lt;!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>
Comment 6 Jean-Philippe Fleury 2011-02-02 04:05:32 UTC
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.
Comment 7 Ignacio Casal Quinteiro (nacho) 2011-02-02 13:00:32 UTC
Hey the file looks really good. One minor thing:

<keyword>(?&lt;!Allow,)Deny(?!,Allow)</keyword> <!-- See "Allow" directive comment. -->

^^^ why is separated from the other one?
Comment 8 Jean-Philippe Fleury 2011-02-02 15:51:41 UTC
(In reply to comment #7)
> ^^^ why is separated from the other one?

It's just for alphabetical sorting:

...
AliasMatch
Allow: (?&lt;!Deny,)Allow(?!,Deny)
Anonymous
...
DeflateFilterNote
Deny: (?&lt;!Allow,)Deny(?!,Allow)
DirectoryIndex
...

But I could put them together, for example:

...
AliasMatch
(?&lt;!Deny,)Allow(?!,Deny)
(?&lt;!Allow,)Deny(?!,Allow)
Anonymous
...

or sort them according to the gedit "Sort" plugin:

...
LoadModule
LockFile
LogFormat
(?&lt;!Allow,)Deny(?!,Allow)
(?&lt;!Deny,)Allow(?!,Deny)
MetaDir
MetaSuffix
MimeMagicFile
...
Comment 9 Ignacio Casal Quinteiro (nacho) 2011-09-01 21:12:11 UTC
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.
Comment 10 Jean-Philippe Fleury 2011-09-02 19:56:00 UTC
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.
Comment 11 GNOME Infrastructure Team 2021-07-05 10:59:30 UTC
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.