Announcing BundesGit for LibreOffice

Posted by Bjoern Michaelsen on 7 April 2014

Announcing BundesGit for LibreOffice

"I fought the law and the law won"

-- Sonny Curtis and the Crickets -- prominently covered by the Clash

So in a few minutes, I will be leaving for the meeting at Open Knowledge Lab in Hamburg for Code for Germany in Hamburg -- but I dont want to show up empty-handed. Earlier I learned about BundesGit which is a project to put all federal german laws in a git repository in easily parsable markdown language. This project was featured prominently e.g. on Wired, Heise and got me wondering that having all those laws available at the tip of your hand would be quite useful for lawyers. So here I went and quickly wrote an extension to do just that. When you install the extension:

  • it downloads all the german federal laws from github and indexes them on the next restart of LibreOffice (completely in the background without annoying the user)
  • that takes about ~5 minutes (and it only checks for updates on the next start, so no redownload)
  • once indexed you can insert a part of a law easily in any text in Writer using the common abbreviations that lawyers use for these:
  • Type the abbreviation of the paragraph on an otherwise empty line, e.g. "gg 1" for the first Artikel of the Grundgesetz
  • press Ctrl-Shift-G (G for Git, Gesetz or whatever you intend it to mean)
  • LibreOffice will replace the abbreviation with the part of that law

BundesGit for LibreOffice

Now this is still a proof-of-concept:

  • It requires a recent version (1.9 or higher) of git in the path. While that is for example true in the upcoming version of Ubuntu 14.04 LTS, other distributions might still have older versions of git, or -- on Windows -- none at all: Packing a git binary into the extension is left as an exercise for the reader.
  • I have not checked it to parse all the different laws and find all the paragraphs. It also ignores some non-text content in the repository for now. Patches welcome!
  • While it stays in the background most of the time intentionally to not get into the way of the user, it could use some error reporting or logging, so users are not left in the dark if it fails to work.
On the other hand, the extension is a good example what you can do with less than 300 lines of Python3 (including tests) in LibreOffice extensions. Thus the code was hopefully verbosely enough commented and was uploaded to sdk-examples repository, where it lives alongside this LibreOffice does print on Tuesdays extension that also serves as an example. Of course, if there other useful repositories of texts online, it can be quickly adapted to provide those too.

So download BundesGit for LibreOffice and test it on Ubuntu 14.04 LTS (trusty).

 

addendum: This has been featured on golem.de and linux-magazin.de (both german).

 

Originally published on 2014-04-07 16:39:45 on wordpress.