From time to time I play with different representations of interlinear text. I 
thought I’d share the latest iteration which uses CSS3 and HTML5 Flex Box 
layout:

Title: Interlinear text

An example of how to represent interlinear text

Introduction

Interlinear text lines up the text from one translation with details from another translation. The most common print is to pair underlying Greek with a person's language. Here, we are combining the text from the KJV with Greek:

  1. English from the KJV.
  2. Original Greek from Stephanus' TR.
  3. Underlying root Greek word, keyed to the Abbott-Smith lexicon.
  4. Strong's Number.
  5. Robinson's Morphologic Code

This could be extended to show transliteration for the Greek and the order of the words in Stephanus' TR

Example output

Matthew 1:19

19
Then
δε
δέ
1161
CONJ
Joseph
ιωσηφ
Ἰωσήφ
2501
N-PRI
her
αυτης
αὐτός
846
P-GSF
husband,
ο
ὁ
3588
T-NSM
ανηρ
ἀνήρ
435
N-NSM
being
ων
εἰμί
1510
V-PAP-NSM
a just
δικαιος
δίκαιος
1342
A-NSM
man,
and
και
καί
2532
CONJ
not
μη
μή
3361
PRT-N
willing
θελων
θέλω
2309
V-PAP-NSM
to make
παραδειγματισαι
παραδειγματίζω
3856
V-AAN
her
αυτην
αὐτός
846
P-ASF
a publick example,
παραδειγματισαι
παραδειγματίζω
3856
V-AAN
was minded
εβουληθη
βούλομαι
1014
V-AOI-3S
to put
απολυσαι
ἀπολύω
630
V-AAN
her
αυτην
αὐτός
846
P-ASF
away
απολυσαι
ἀπολύω
630
V-AAN
privily.
λαθρα
λάθρᾳ
2977
ADV

Luke 2:37

Showing punctuation isolated.

37
And
και
καί
2532
CONJ
she
αυτη
οὗτος
3778
D-NSF
was
a widow
χηρα
χήρα
5503
N-NSF
of about
ως
ὡς
5613
ADV
fourscore and four
ογδοηκοντατεσσαρων
ὀγδοήκοντα
3589
τέσσαρες
5064
A-GPN
years
ετων
ἔτος
2094
N-GPN
,
which
η
ὅς
3739
R-NSF
departed
αφιστατο
ἀφίστημι
868
V-INI-3S
not
ουκ
οὐ
3756
PRT-N
from
απο
ἀπό
575
PREP
the temple
του
ὁ
3588
T-GSN
ιερου
ἱερόν
2411
N-GSN
,
but served
λατρευουσα
λατρεύω
3000
V-PAP-NSF
God
with fastings
νηστειαις
νηστεία
3521
N-DPF
and
και
καί
2532
CONJ
prayers
δεησεσιν
ὅς
1162
N-DPF
night
νυκτα
νύξ
3571
N-ASF
and
και
καί
2532
CONJ
day
ημεραν
ἡμέρα
2250
N-ASF
.

Explanation

In HTML, elements that follow one another horizontally are inline elements. But elements that follow one another vertically are block elements. <span> is the natural specifier of inline elements and <div> is the natural specifier of block elements.

Here we are stacking the KJV, Greek from the TR, Strong's Numbers and Robinson's morphology codes for a verse.
For example, in Matt 1:19 the first word would be (Then,δε,1161,CONJ).

We want it to stack as in:

    Then
     δε
    1161
    CONJ
    
This requires "block" display in HTML.

So the following is the logical representation:

    <span>
      <div>Then</div>
      <div>δε</div>
      <div>1161</div>
      <div>CONJ</div>
    </span>
    
However, strict HTML does not allow for <div> to be in a <span>. But <div> can contain <div>.

So then we want:

    <div>
      <div>Then</div>
      <div>δε</div>
      <div>1161</div>
      <div>CONJ</div>
    </div>
    

But this does not work, as is, because a div is a block element. Fortunately, one can make any block element be an inline element. CSS3 and HTML5 have a flexible layout mechanism called flex box, that will allow child elements to be laid out as inline elements.

So the following works:

    <div style="display:inline-flex">
      <div>
        <div>Then</div>
        <div>δε</div>
        <div>1161</div>
        <div>CONJ</div>
      </div>
    </div>
    

While this works to flow the words correctly, spacing between one inline block and the next may or may not touch depending on whether there is whitespace (newlines, spaces and/or tabs) between <div> elements.

Alternatively, one can use CSS3 and HTML5 to solve this using flex box layout. Basically, any container can be made to layout its contents as inline-block elements ignoring spacing between elements. bigger or smaller, the space remains proportional. Likewise, when the "words" are wrapped to the next "line" it needs to have some spacing between the lines.

    <div style="display:inline-flex">
      <div style="margin-top:0.25em;margin-bottom:0.25em;padding-left:0.25em;padding-right:0.25em">
        <div>Then</div>
        <div>δε</div>
        <div>1161</div>
        <div>CONJ</div>
      </div>
    </div>
    

Of course, anyone who uses style attributes and not CSS should be ridiculed. ;)

So this should be:

    <style type="text/css">
      div.box
      {
        display       : inline-flex;
      }
      div.box > div
      {
        margin-top    : 0.25em;
        margin-bottom : 0.25em;
        padding-left  : 0.25em;
        padding-right : 0.25em;
      }  
    </style>
    ...
    <div class="box">
    <div>
      <div>Then</div>
      <div>δε</div>
      <div>1161</div>
      <div>CONJ</div>
    </div>
    

All that remains is styling the text so that it is centered and filled from the top down:

    <style type="text/css">
      div.box
      {
        text-align     : center;
      }
    </style>
    

To see exactly how this page is styled, view the source.


This will work in all modern browsers. For Microsoft, that is IE 11.

If you’d like to see the other two iterations, let me know.

In Him,
DM Smith
_______________________________________________
sword-devel mailing list: sword-devel@crosswire.org
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to