obsolete/HACKING.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Tue, 05 Dec 2023 13:24:46 +0200
changeset 1353 dcda231188dc
parent 337 33b08a8b7fb1
permissions -rw-r--r--
New articles.

.. -*- coding: utf-8 -*-

=======================
 gadict HACKING guide.
=======================
.. contents::
   :local:

Dictionary source file format.
==============================

For source file format used dictd C5 file format. See::

  $ man 1 dictfmt

Shortly:

 * Headwords was preceded by 5 or more underscore characters ``_`` and a blank
   line.
 * All text until the next headword is considered the definition.
 * Any leading ``@`` characters are stripped out, but the file is otherwise
   unchanged.

For convenience also used such assumptions:

 * Headwords was separated by ``;<SPACE>`` (and all was placed on single line).
 * UTF-8 encoding was used.
 * Lines started with ``#`` striped out (comment syntax).
 * First line with ``ABOUT:`` used as description of dictionary.
 * First URL (line with ``http://``) used as dictionary home page.

Comment syntax convention.
==========================

As 'dictd -c5' format does not support comment syntax we filter out all lines
that start with '#'.

Dictionary file name convention.
================================

BNF form::

  FILE ::= PREFIX "-" NAME "-" LANG ".dict-c5"
  PREFIX ::= "gadict"
  LANG ::= ISOCODE | ISOCODE "-" ISOCODE

where ``ISOCODE`` is ISO 639-1 language (2 letter) code, currently ``en``,
``ru``, ``uk`` in use, ``NAME`` is dictionary abbreviated name.