[sword-devel] What is the command to retrieve text by args like "Genesis 1:1"

Luke Plant L.Plant.98 at cantab.net
Thu May 7 02:05:03 MST 2009

On Monday 27 April 2009 14:56:24 Wei-Wei Guo wrote:
> Dear all,
> I want to write a Sword extension for Sphinx. The extension can
> help on Bible study by this way:
> If I type :bible:`Genesis 1:1` in text, after compiling, the
> following line will be inserted
>     In the beginning God created the heavens and the earth.
> So I need to know, is it possible to call a command generating the
> previous line with argument of "Genesis 1:1" or something similar?
> And if the command can select Bible texts module, such as ChiNCVs
> or ASV, it would be better.
> If there is no such convenient command, could you point me to some
> materials with which I can write a simple script. Except an API
> primer, I don't find any other document like man page or help file
> of Sword.

I'm presuming you want to write in Python.  You need to build the 
Sword Python SWIG bindings (from the sword source tarball), and I have 
some Python code here which should provide a basis for what you need.


The function "get_bible_text()" is what you need to look at, the rest 
may or may not be relevant.

The code seems somewhat cumbersome, there may be an easier way.  Also, 
the process of converting to plain text is somewhat hacky, and I only 
implemented what I needed (I mainly use the ESV module).

The code is original and is in the public domain.



After your hands become coated with grease, your nose will begin to 

Luke Plant || http://lukeplant.me.uk/

More information about the sword-devel mailing list