This script converts a dictionary or commentary IMP file to a Sword module.
Steps
These steps use “personal commentary” and “personal dictionary” modules as examples, but the steps apply to any other commentary or dictionary also. Note, however, that modules names should not be longer than 15 characters.
Download example source files and add some content:
Install dependencies: python3, libsword-utils (imp2vs and imp2ld)
Download the script: swordmodgen.py
Create directories for generated module files:
$ mkdir ~/.sword/modules/comments/zcom/personalcomm/ $ mkdir ~/.sword/modules/lexdict/zld/personaldict/
Generate modules (add the --force option to allow old module files in the destination directory to be replaced on subsequent runs):
$ swordmodgen.py -c comm.imp ~/.sword/modules/comments/zcom/personalcomm/ $ swordmodgen.py -d dict.imp ~/.sword/modules/lexdict/zld/personaldict/
Download, edit, and add the Sword configuration files:
Write personalcomm.conf to ~/.sword/mods.d/personalcomm.conf
Write personaldict.conf to ~/.sword/mods.d/personaldict.conf
Editing the IMP files with Emacs
If you will be editing IMP files with Emacs, the following (added to your ~/.emacs file) will make filling (M-q) work correctly.
(define-derived-mode imp-mode text-mode "IMP"
"Major mode for editing IMP bible files."
(setq paragraph-separate "\\([ \t\f]*\\|\\$\\$\\$.*\\)$"))
(add-to-list 'auto-mode-alist '("\\.imp\\'" . imp-mode))
See also
imp2osis.pl (does not work without heading lines in the IMP file)
OSIS Python module on GitHub (and see this sword-devel message)