[jsword-devel] JSword now handles images

DM Smith dmsmith555 at yahoo.com
Thu Oct 5 04:35:13 MST 2006


I have added support for images to JSword. Both ThML <img> and OSIS  
<figure> are supported.

It is expected that the src attribute of these tags uses a reference  
from the root directory where the module is held. If the images are  
in an images subdirectory, say for the KJV, then you might see  
<figure src="/images/pic.jpg"/> in OSIS or <img src="/images/pic.jpg"/ 
 > in ThML. SWORD requires them to be preceded with / as if each  
module was a separate web server/application.

In making this change, I made the location of the directory  
containing mods.d and modules a URL attribute of BookMetaData. For  
lack of a better name I named this location the "Library" since it  
houses one or more books. Also, in the same fashion, I added another  
URL attribute to BookMetaData to represent the root location of the  
files for a module and called it "Location" for lack of a better  
name. It is this to which relative references refer.

This information used to be held by  
org.crosswire.jsword.sword.AbstractBackend. So it has been moved from  
there. While this was a big checkin, it simplified the code.

Unfortunately for BibleDesktop, the HTML renderer does not understand  
<base href="baseurl"/>. So each crafted <img> tag needs to have the  
image path assembled.

If your target is a real browser, using base is preferred. But, since  
SWORD modules use absolute references, you will need to remove the  
leading '/' when crafting the src attribute of the <img> tag.

I mentioned that these locations are URLs. This will allow for remote  
modules in the future.

In His Service,
	DM



More information about the jsword-devel mailing list