Skip to content

Current rendering rules

David Instone-Brewer edited this page Jun 9, 2018 · 13 revisions

Status

  • Incomplete - line 1358 so far
  • Missing UI/JS impact on below
  • Real parsing at end of document to be completed
  • Missing interlinear displays

Input parameters from user

  • Removing Vowels (Hebrew)
  • Removing pointing (cantillation/accents)
  • Visual mode (single line, interleaved compared, interlinear, columns, columns compared)
  • New lines on each verses (very helpful in some modules like French for example)
  • Red letter (so called Words of Christ)
  • Headings (only applies to non-canonical headings - e.g. Psalms sub lines are kept cos they are part of the original)
  • Dividing Hebrew into parts - e.g. semantically colour each part of a Hebrew word
  • Notes (to display or not)
  • Cross references (to display or not)
  • Colour coding morphology
  • User's language (e.g. did they input the book name in English, Swahili, etc. all handled by Sword Engine)
  • The reference
  • Show introductions

Divisions and paragraphs, pre and post-verse content

  • paragraphs

    • div[@type='paragraph'][@sID]" or 'p'
    • Marks a new line (we use <span class='paragraph'></span> for start and
    • We don't render paragraphs in notes
  • paragraph ends

    • div[@type='paragraph'][@eID]
    • Currently <br /> for end)
  • introduction (div[@type='introduction'][@sID], div[@type='introduction'][@eID]")

    • Currently not included - believe ESV has some (DIB: Yes, it does, and we have the rights to them if we wish)
  • div

    • x-center => center page
  • colophon (part of the original, finishes off an epistle)

  • Versification issues (especially when comparing) - e.g. a multiple source version verses map to a single verse in the secondary version.

    • div[@subType='x-duplicate'] (this is code I added to JSword - and might need to have that added to Sword - or use some other mechanism)
    • <span class="versification-notice duplicate-notice" international="duplicate_notice">*</span>
  • Versification issues (a verse in a secondary Bible is missed out entirely)

    • x-omitted-verses
  • div[@type='x-p'] or milestone[@type = 'x-p']

    • new paragraph

Rendering verses

  • verse and verse[@sid]
    • Find all x-preverse content
      • For titles, render them in two different ways:
        • Canonical titles should be be rendered the same colour (but bold) as the text. (Psalms have lots of examples of canonical titles)
        • Non canonical titles should be a different colour/font/etc.
        • Canonical titles should always be rendered even if Headings option is turned off!
      • Then render verse numbers
        • Has a hover link with its OSIS ref & might be worth storing the v11n against it (at least against the book/version)
        • For non simple views
        • Some modules will contain the verse number (@n attribute). Others won't so you'll need to use the OSIS ref to work out the number!
          • n should take priority.
          • Note some modules have verse numbers like "9-11". They don't have an individual verse '10'
          • Similar rendering goes on in the notes columns
      • Render the content
      • For verse by verse view, insert a new line here.

Render the content

  • a

  • render a link - I think these are usually internal links (or external if commentaries)

  • w

    • lemma = Strong number (often)
    • morph = robinson morphology
    • Assume if morph then lemma exists (makes no sense to have grammar on its own)
    • Ideally we should have some rules input by user to dictate the styling / colouring of the grammar (Talk to David/Patrick about this)
    • css classes currently indexed into module (ought to change as per David/Patrick point)
    • Morph has different colours
      • if robinson code starts with robinson: or ROBINSON:
        • singular vs plural
          • @number=="Singular" or @number == "Plural" in csv file
        • Masculine (blue, ) vs Feminine (Red) vs Neuter (black)
          • gender class = "Feminine" (or "Masculine" or "Neuter")
    • At the moment, strong number is rendered onto word and the ui collects all the numbers to form the verse hover
    • On hover, we highlight all same strong numbers immediately
    • On hover, we also ask server for related numbers and they are also highlighted in a slightly muted colour (hover over 'work' in Ex1:14 https://www.stepbible.org/?q=version=ESV|reference=Exod.1&options=HNVUG)
    • Once clicked but not hovering over, words (same strong & related strongs) are all displayed in gray until next click
    • Can't quite remember what the underline means (maybe David can help here)(DIB: nope, confuses me too)
    • Adding spaces if the next child is not a @type = seg and not a @type = x-punct (punctuation) and not @type = maqef and not @type = sof-pasuq
  • seg

    • Indicates a segment of a w word. Usually in Hebrew...
    • General modules
      • looks like some modules declare their own font-face, font-size and color attributes in @type
    • Usually in ancient language modules
      • @type = x-variant, indicates a variant of the word in the original
        • @sub-type = x-class-1 or x-1
          • We render these as notes (with specific CSS class, "note variant")
    • If divide hebrew is option is "On",
      • we alternate two colours to display the different parts of the Hebrew word (classes segC1 & segC2)
  • speaker

    • if @who = Jesus, then check Words of Christ / Red Letter option
    • otherwise, mark-up a class (e.g. class='speech')
  • title

    • For pre-verse titles (@subType = x-preverse)

      • Canonical psalm titles (same colour as text), @canonical = true & @type = psalm, render a psalm heading
      • Other canonical titles (same colour as text), render @canonical = true
      • Otherwise render as CSS = "heading <@type>".
        • x-speaker attribute (@type maybe on ESV for example)
          • mark as heading & italics - for example in Song of Solomons He vs She
        • not sure how many others there are
    • Titles with levels

      • @level = 1/2/3/4/5, rendered as h1/h2/h3/h4/h5
      • all others rendered as h6
    • Xgen titles

      • In JSword, can have x-gen, which is where the engine adds the heading, usually rendered as the long version of the verse number
  • abbr (abbreviations)

    • if @expansion, then use @expansion,
    • if @expan use @expan
  • reference ( think within notes that are either cross-references or normal notes)

    • Render as a link with a short verse name
    • Link either to popup or new passage (we currently render a popup first and then popup takes us to another passage)
  • caption

    • CSS class to indicate caption (think only used in modules with images - we only have 1 prototype at the moment)
  • catchWord (in Hebrew I think) (DIB: Commonly used for comments on a translated word)

    • if children have got rdg[@x-qere], then use hbFontSmall & put the text "(Ketiv)" in front
    • if has children of rdg, then put hbFontSmall
    • Render in bold otherwise
  • closer, date - render as is

  • doxology, colophon, refrain, attribution

    • italic rendering
  • doxology[@sid]

    • We seem to add class x-doxology
  • divineName

    • small caps (not it can be GOD and LORD but other languages have other names)
  • figure (don't think currently in STEP, though we lots of modules that will have pictures)

  • foreign

    • em class="foreign" with extra space before no punctuation after rendering the text.
  • head/head (e.g. a head with another head element inside)

    • That's a subhead - so we render class="head"
  • index (don't think we render these but they're marked with internal anchors):

    • Rendered as <a name=@id class=index>
  • inscription

    • You can find some in Daniel (inscription on the wall)
    • if @type = x-p-inscription, then we add a class
    • otherwise small caps
  • item (part of a list)

    • e.g. Ezr.10.18-21 - see layout & OSIS XML here
    • rendered as li
  • lg

    • rendered as class = "lg"

lg[@sid](think this is a list grouping - think NIV uses a lot of these as well as Neno)

  • rendered with class "lg"

  • if words of Christ is On, we seem to add a new line before we start the line group

  • rendered with startLineGroup

  • l (list item)

    • if @type != 'x-no-break' then put a line break in!
    • render text inside a level1/level2/etc. I think this is for indentation
  • lg[@eid]

    • Rendered with endLineGroup
  • lb (line break)

    • render as < /p>, except if:
      • @type = 'x-continued' at which point we add class x-continued
  • list

    • if there are 'label' elements, then
      • Rendered as <dl class=list> for the list container & <dt class=label> & <dd class="item">
      • If list within a list, then <dd class=list-wrapper>
    • if no label elements, then render as
      • <li class=item> and <li class="list-wrapper">
  • Words of Christ

    • This can apply to lots of things, e.g. divineName, simple Text

Dealing with notes and cross references

  • For cross-references markers (rendered within the text) (note[@type = 'crossReference'])

    • multiple notes get separators (e.g. a ',' unless it's the last one)
    • Generate a note letter as a link to the specified note verse number (in side bar currently)
  • For cross-references (rendered outside of the text) (note[@type = 'crossReference'])

    • multiple notes get separators (e.g. a ',' unless it's the last one)
    • @type is used for the type of note in the CSS class
  • For note markers (rendered within the text) - anything != note[@type = 'crossReference']

    • multiple notes get separators (e.g. a ',' unless it's the last one)
    • @type is used for the type of note in the CSS class
    • if @type and @type = 'x-verse-numbering'" then uses @n
    • else generates a note marker (currently a downwards looking triangle - recent modification by David)
  • For note themselves (outside the text / in sidebar or footer/etc.) - anything != note[@type = 'crossReference']

    • Currently class side-note
    • Marker is in bold
    • For Hebrew notes (rdg[@type='x-qere')
      • Direction to be set ot RTL
      • Class current qereDisplay
    • Render content
    • We don't render paragraphs in notes
  • Language direction

    • Needs to be modelled at some point in the rendering
      • For column / line view, you need to render it at the line/cell element
      • Otherwise can render it at the top level

Spacing generally

  • Looks like there are lots of extra space rules which we piled up over time.
  • Look for   for a summary of the occurrences in default.xsl

What we don't match

header revisionDes work title contributor creator subject atch=date description publisher type format identifier source language relation coverage rights scope workPrefix castList castGroup castItem actor role roleDesc teiHeader refSystem titlePage

Current real-time conversions in Java (to be completed)

** getting the passage Key (short or long form) - step almost always uses short form (but copes with multiple languages for Book names) (1kgs 2) - unless it's a heading within the book and that would be full name (1 Kings 2) ** Getting the current v11n (versification) ** Colour coding for morphology

  • Interleaving provider (provides the Bible name for each line when using interleaving mode)

  • StringConversionUtils: ** Transforms to unaccented Greek or accented greek ** Transforms to unaccented Hebrew leaving vowels or removes vowels entirely and accents (cantillation) ** getStrongPaddedKey() Normalises strong numbers (some modules have 0 padded and some don't, so we get one consistent format out so that we can lookup our indexes elsewhere)

  • Line 756 - When dealing with 'w', we seem to add extra spaces if text element doesn't start with punctuation, e.g. between words

  • Hebrew: Deals with Maqef and soft-pasuq (David can comment on this)

jsword:

  • Gets key objects (e.g. a reference + its v11n)

  • Warnings when there are mismatches in verse numbers and a missing verse or a duplicate verse (e.g. some modules have different verse numbers, but further still, others map 1 verse to 2 verses in another module yielding virtual 'missing' verses when displaying or 'duplicate' verses when displaying)

Interlinear provider

  • Pre-caching and coding the verse/passage words & strong numbers

  • e.g. as many calls as required to Sword libraries, so that we have maps of everything in memory. For the new paradigm with JSON, think of it as enriching the 'word' with more data in it. Morphology provider

  • Ditto - pre-caching morphology so that the rendering can do a fast lookup

  • Lines/Tabular rendering (not sure how Sword would do this or if it does) ** Ask Troy, but essentially render in columns or lines. ** JSword currently provides two levels of coding of the diff: