GNOME Bugzilla – Bug 356275
[PATCH] New .lang file for DocBook
Last modified: 2007-08-15 10:12:53 UTC
I'm attaching a .lang file for DocBook. When testing this, I got the impression that having all 400-odd docbook elements slowed things down a bit, so I have just put in the common ones (as found in the GNOME user guide). They are separated into groups by function, eg header elements, text formatting.
Created attachment 72901 [details] Docbook lang file
Created attachment 74469 [details] Alternative version of the lang file This is an alternative version of the lang file already attached. It contains the complete list of DocBook tags (all 405!) rather than the subset of those commonly in use.
Joachim: I'd like to commit one of your two files. Which one do you think it is better? Does the second one present performance problems?
I've been using the second one for some time and I haven't noticed any performance problems. However, I have found a small bug with the highlighting of the DTD and entity declarations. This is what all of Gnome's docbook files have: <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ <!ENTITY appname "MY-GNOME-APPLICATION"> <!ENTITY app "<application>MY-GNOME-APPLICATION</application>"> <!ENTITY appversion "2.0"> <!ENTITY manrevision "2.0"> <!ENTITY date "March 2002"> <!-- This is a comment --> ]> Currently, the first three lines get matched as a DTD (up to the first '>'), and the rest as entities definitions (and the comment as a comment). I've fixed my version so the whole block matches as a DTD -- but then I'd like the entity definitions within it to match too (and the comment too). Is that possible with the old version of the highlighter, and how? If that's not possible, then I've also tried a fix so only the first two lines match as DTD. I think it's better to have the entity definitions shown even if it means the final ']>' is stray. Let me know which of the two fixes I should go for, and I can commit myself if you like :)
Judging from Paolo's above comment and from a brief chat with Joachim, I told him to commit the second file with the first suggested fix for the issue in the last comment (since I prefer a correct but not very useful hl to an incorrect hl). Leaving this bug open and cc'ing muntyan since the file needs to be added to gsv2
Committed to gsv1. Leaving open.
One needs to write lang file v2 from scratch. It would be good to have some description of the docbook format, is it xml with some special element names highlighted?
Docbook is just an XML format: http://www.docbook.org/tdg/en/html/docbook.html What I've tried to do with the v1 syntax file is give different colours to different types of keyword. For example, SECTION, TITLE, PARA are to do with document structure, and GUILABEL, GUIBUTTON, KEYCAP and to do with the user interface. There's no 'official' grouping of keywords into different types, it's just my choices. Also, the DocBook manuals the GDP writes set up XML entities (look at the top of the Gedit manual for example) and I wanted those declarations to be highlighted too. I could help with the v2 syntax file, but I'll probably need a lot of help to compile gtksourceview and gedit from source so I can test it. Otherwise, when it arrives in Ubuntu mainstream I can work on it then.
I ported docbook-lang to the new format.