This is a Python module to provide a USFM parser. This project also consists of few USFM to other format converters.
To run the usfm program, you need Python 3.4 and few other third party dependencies. This is only tested in Debian GNU/Linux - Jessie version and Fedora 20. It may work in other GNU/Linux distributions also. These are the steps to install usfm program in Debian GNU/Linux and Fedora 20.
Install development libraries and other dependencies as root user
Debian
# apt-get -y build-dep python3 # apt-get -y install wget git
Fedora
# yum install -y yum-utils wget git # yum-builddep python3
Install Python 3.4
Download Python 3.4 XZ compressed source tarball
$ wget -c https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tar.xz
Extract Python source tarball, build and install
$ tar Jxvf Python-3.4.2.tar.xz $ cd Python-3.4.2 $ ./configure --prefix=$HOME/usr $ make $ make install
Create a virtual environment and activate it
$ $HOME/usr/bin/pyvenv $HOME/ve $ source $HOME/ve/bin/activate
Clone the parsely code from the Git repository and install it
$ cd $HOME $ git clone git@github.com:python-parsley/parsley.git $ cd parsley $ python setup.py install
Clone the usfm code from the Git repository and install it
$ cd $HOME $ git clone git@github.com:tfbf/usfm.git $ cd usfm $ python setup.py develop
Now you can run the usfm program with various arguments The syntax looks like this:
$ usfm -c <path/to/html.cfg> -p <file/path/or/pattern> -d <output/directory> --html
Examples to convert USFM files to HTML:
$ usfm -c ../svpm/conf/html.cfg> -p ../svpm/usfm1910/*.usfm -d svpm --html