[sword-devel] Tables across verse boundaries

DM Smith dmsmith at crosswire.org
Mon Mar 17 18:01:21 MST 2014

On Mar 17, 2014, at 1:07 PM, Chris Burrell <chris at burrell.me.uk> wrote:

> Hello
> I'm looking at converting a module that has tables across verse boundaries... Is this supported?

It should be. At least by osis2mod. I don't know if SWORD renderers have code for tables. I'll leave that for someone else to answer. JSword probably will choke on tables. I'll go into that in a bit.

> I'm using the sword utilities to convert the module, however, I'm seeing that the 'table' element is getting dropped?

I'm presuming that you are using osis2mod. osis2mod should not drop anything. To verify what osis2mod creates I recommend creating a raw module (that is, use no compression flags) and use the -d 2 flag. This will put milestones for the start and end of the verses into the module. Then you can use a text editor (stay away from NotePad as the line endings may not be windows friendly) to look at the file and search for the constructs.

>  (both using mod2imp to check,

Using mod2imp is also useful because it marks each index entry with the verse slot name. But it may not be necessary, if the raw file gives what you wish.

> as well as using JSword).

JSword has some problems going to OSIS. It assumes that each verse is well-formed xml. If it is not, it strips all xml, leaving text (with notes inline).

This is a fairly safe assumption, but tables will probably will make that fail.

This assumption is something that all SWORD/JSword frontends make at some points. Two examples:
Search results list that show verse content as well as references.
Stacked or side-by-side parallel display.

> If this is supported, does someone have some example mark-up that I could use as a starting point?

I'm trying to understand where in a Bible a table would be useful. I can see it in an introduction. But spanning verses? No way. There is no tabular data in the Bible. (Please correct me if I'm wrong!)

I have seen people use tables to control rendering. If this is what is being done, some one needs guidance.

In a commentary, which is indexed by verse numbers, anything could happen.

Regarding sample markup, it is analogous to simple HTML tables, but other than <table> the element names are different.
The <table> element can be wholly contained within:
Nothing else can be a parent to <table>.

A table has a few attributes, cols and rows to give dimensions; canonical to indicate whether it contains canonical material; and the standard OSIS attributes.
It can contain a <head> and also <row> elements. Both are optional, but it doesn't make sense to have a table without rows.

I'm not clear what is the purpose of head. It can contain many of the same content as a verse.

The <row> element can only contain <cell> elements and it has a role attribute that can have a value of label or data. It also has a canonical attribute and the standard OSIS attributes.

The <cell> element can contain pretty much anything that a <div> or a <chapter> can contain except <div> and <chapter>. It also has the same role attribute, but defaults to data. It also has an align attribute with a value from left, right, center, justify, start and end. And of course it has canonical and standard OSIS attributes.

Since a table cannot be milestoned, the element it is contained within also cannot be milestoned. The manual states that for any given element you can chose to use the milestoned version or the container version but not both in the same document.

I guess a verse can be split across multiple cells and even rows by using the milestoned version of a verse.

If a <table> only has a single column, a <list> may be a better container.

Hope this helps.

Together in His Service,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20140317/a852cb18/attachment.p7s>

More information about the sword-devel mailing list