[sword-devel] JavaScript & SWORD modules

Greg Hellings greg.hellings at gmail.com
Sun Jan 19 12:57:41 MST 2014


There has been much discussion of late about accessing Sword through
JavaScript, producing JavaScript bindings for Sword, or porting Sword into
JavaScript. JS provides a unique challenge because it is so heavily
dominated by browser-side work and most server-side solutions are either
very immature or focused heavily on pure JS work that producing Sword
bindings ranges from impossible (in the browser) to questionable (browser
plugins) to an unexplored unknown (server-side plugins). This almost unique
situation has led most of us to more or less ignore it.

Multiple efforts have been made to allow JavaScript implementations to
directly read a Sword module file format, but this can be fraught with
difficulty. One commonality between every JavaScript environment I've ever
worked with is its ability to handle JSON-formatted data. To that end, I
have put together a demo application based on JSword and Undertow (the core
library that forms the basis of the renamed JBoss-now-WildFly) that shows
how simple it is to expose basic module text to the reader in
JSON-formatted text. Anyone is free to see the source at
https://github.com/greg-hellings/jsword-json

The README file has basic build and run directions. I have a sample of it
up and running at http://www.thehellings.com:10001/ and ws://
www.thehellings.com:10002/ but I have only installed a few simple modules
that are exposed in the public domain to avoid licensing problems. The
method I use for listing out the contents of the module itself don't work
very well with General Books, which is due to my desire to keep the source
as simple as possible, which requires a break from how JSword expects
GenBook contents to be accessed. This is not insurmountable but my
intention was not for this first cut to be production-worthy but only for
it to serve as a demonstration of how easy interfacing between Sword and
JavaScript could be if one were to write a simple web service backend.

Opinions, corrections, questions, pull requests, and general insults about
my approach are welcomed.

--Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20140119/224f9dbb/attachment.html>


More information about the sword-devel mailing list