Category Archives: Developers

Animated Bracket Matching in Kate Part

Kate in 4.13 will have a new features: Animated bracket matching!


Since the feature might be visually distracting, it is turned off by default. To enable this feature, you have to go into the “Appearance” config page and check “[x] Animate bracket matching.” Due to feature and message freeze, this feature will be available in 4.13 and not in 4.12.

By the way, over the years we were asked several times to add the feature to jump to the matching bracket. This feature already exists. It is called “Move to Matching Bracket” and is bound by default to the shortcut “Ctrl+6″. You can change the shortcut in the “Configure Shortcuts” dialog.

Kate XML Completion: Converting DTD to MetaDTD

Kate has this nifty little plugin called “XML Completion.” This plugin loads a Meta DTD file and uses this information for context sensitive completion. To use it, you first have to load it in the settings dialog, and then assign a Meta DTD through the XML menu:

In our example, we work on a Kate XML highlighting definition file and therefore loaded the file “language.dtd.xml” which is shipped with Kate. Having assigned a Meta DTD file, we now have these nice code hints:

Kate ships with several Meta DTD files, such as HTML4 (strict, loose) or XHTML 1.0 transitional, KConfigXT DTD, KPartsGUI or XSLT. While this is really cool, you may ask about arbitrary DTDs you may be using. Unfortunately, Kate only supports Meta DTD, so what now?

Installing dtdparser

Luckily, the tool dtdparser (on sourceforge) converts a DTD to Meta DTD. We first need to install dtdparse. Since openSUSE does not provide a package (what about other distros?), I downloaded SGML-DTDParse-2.00.zip, extracted it and ran (see README file)

perl Makefile.PL

Make sure there are no missing perl dependencies. I for instance had to install perl-Text-DelimMatch and perl-XML-DOM:

sudo zypper install perl-Text-DelimMatch perl-XML-DOM

Then continue with the build and install process (the result of make test should be PASS):

make
make test
sudo make install 

Now we successfully installed dtdparse on the system. So we are finally ready to convert DTDs.

Converting DTD to Meta DTD with dtdparser

Having installed dtdparser, it is as easy as calling

dtdparse file.dtd > file.dtd.xml

to convert a DTD to Meta DTD. The conversion should work out of the box. If you want, you can edit the generated .xml file, for instance the “title” attribute is always set to “?untitled?”. While this is not used by the XML Completion plugin (yet?), it’s still nicer to have it properly fixed.

Contributing Meta DTDs to Kate

Whenever you have a DTD that is of use also for other users, please send the generated Meta DTD to kwrite-devel@kde.org (our mailing list). Further, it would be really cool if someone added support to convert DTDs on the fly to Meta DTD, so the Kate XML Completion plugin would just work for DTDs as well. Any takers?

Call at Distribution Packagers

Please consider including dtdparser by default, as it seems to be a very useful too. Are there alternatives to convert DTD to Meta DTD?

Video Tutorials Learning C++ (in German)

I just stumbled over a really good tutorial on youtube that teaches C++ from the very beginning (in German). The tutorial is split into lots of small episodes, each about 10 to 15 minutes. The quality of these tutorials is very good in terms of video, voice and also contents. Subject is mostly “pure” C++ and later a bit of Qt is used, so it does not cover C nor lots of additional libraries. Still, if you want to understand the details, you might want to give it a try :-)

PS: The tutorials use Kate Part, just look at the code folding bar on the left. So the author is definitely doing something right :-p