[sword-devel] Module creation

Jonathan Morgan jonmmorgan at gmail.com
Tue Jan 15 07:27:08 MST 2013


Hi,

On Tue, Jan 15, 2013 at 1:41 PM, Chris Little <chrislit at crosswire.org>wrote:

> On 1/14/2013 12:38 PM, webmedic wrote:
>
>> Hello all
>>
>> I know it's been a long time since I posted anything. The last I was
>> looking at module creation I read a bunch of documentation on osis gbf
>> and vpl. I was rather confused by it all.
>>
>
> GBF is definitely not supported. Use OSIS.
>
>
>  I have since created quite a few modules for the word as I understand
>> SQL and rtf markup is pretty simple.
>>
>> How easy or hard would it be to convert these to osis or gbf? I don't
>> think I have seen a simple relation type chart or something that says
>> this HTML tag equals this osis tag or this gbf tag.
>>
>
> RTF and HTML are presentational markup languages. OSIS and TEI are
> primarily semantic markup languages, though they allow presentational
> markup to some degree.
>
> So producing good OSIS isn't as simple as identifying that RTF {\i1 ...}
> is HTML <i>...</i> is OSIS <hi type="italic">...</hi>. Better OSIS will
> come from determining what you mean by italics and encoding that rather
> than the italic-ness of the text. So, for example, do italics mark foreign
> text, emphasis, or titles? Using <hi> for presentational markup is, of
> course, possible, albeit discouraged.
>
>
>  Also in python is there anything for writing sword modules.
>>
>
> There should be. Others can comment on the Python bindings. I know that
> they exist, but haven't tried to use them.
>

It is certainly possible to create modules from the Python bindings.
BPBible has a wrapper around the functionality which may or may not be a
good source of ideas.  You can see it at
http://code.google.com/p/bpbible/source/browse/trunk/backend/create_module.py.
It can both create a module and create its conf file.

To write it from scratch, the core calls there would be something like:

# Create the SWModule instance.
module = SWRawVerse.createModule(path)

# Set a value for a key (repeat for all keys you want to set).
module.setKey(SWVerseKey("Genesis 1:1"))
module.setEntry("Contents of Genesis 1:1")

You would then need to set up a conf file, point it to the right directory
and so forth.
There's a lot more boilerplate in the file I linked to (some of which I
don't understand what it does) but the basics should be just "create a
module of the write type, and then set values for each key in turn".

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20130116/98a8f1cb/attachment.html>


More information about the sword-devel mailing list