From 0cdd75e9394fb8f1e50ff3d8ee9544424426df5d Mon Sep 17 00:00:00 2001 From: sabdelmalik Date: Sat, 30 Sep 2023 16:57:15 -0400 Subject: [PATCH] Apply xsl changes for bespoke versification support --- pom.xml | 2 +- .../step/core/models/BibleVersion.java | 19 +++++ .../step/core/models/LookupOption.java | 4 ++ .../impl/JSwordMetadataServiceImpl.java | 1 + .../jsword/impl/JSwordPassageServiceImpl.java | 6 ++ .../search/impl/SubjectEntryServiceImpl.java | 2 + .../step/core/utils/JSwordUtils.java | 9 +-- .../src/main/resources/HtmlBundle.properties | 2 + .../step/core/service/jsword/impl/default.xsl | 71 ++++++++++++++++--- .../core/service/jsword/impl/interlinear.xsl | 5 +- .../webapp/js/backbone/views/view_display.js | 9 +++ .../js/backbone/views/view_menu_passage.js | 1 + .../js/backbone/views/view_pick_bible.js | 4 +- 13 files changed, 116 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index c9a3e430af..61123e475d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 4.13.1 - 1.6.4-SNAPSHOT + 1.6.5-SNAPSHOT 2.5 diff --git a/step-core/src/main/java/com/tyndalehouse/step/core/models/BibleVersion.java b/step-core/src/main/java/com/tyndalehouse/step/core/models/BibleVersion.java index 04216e42e3..9192791b87 100644 --- a/step-core/src/main/java/com/tyndalehouse/step/core/models/BibleVersion.java +++ b/step-core/src/main/java/com/tyndalehouse/step/core/models/BibleVersion.java @@ -25,6 +25,9 @@ public class BibleVersion implements Serializable { private String shortInitials; private boolean hasSeptuagintTagging; + // SM V11N + private String versification; + /** * @return true if the version contains strong-tagged information */ @@ -208,4 +211,20 @@ public void setHasSeptuagintTagging(final boolean hasSeptuagintTagging) { public boolean isHasSeptuagintTagging() { return hasSeptuagintTagging; } + + // SM ===V11n===========>>> versification + /** + * @return the versification + */ + public String getVersification() { + return this.versification; + } + + /** + * @param versification the versification string + */ + public void setVersification(final String versification) { + this.versification = versification; + } + // SM <<<================== } diff --git a/step-core/src/main/java/com/tyndalehouse/step/core/models/LookupOption.java b/step-core/src/main/java/com/tyndalehouse/step/core/models/LookupOption.java index 415a166a6d..a9e65969d5 100644 --- a/step-core/src/main/java/com/tyndalehouse/step/core/models/LookupOption.java +++ b/step-core/src/main/java/com/tyndalehouse/step/core/models/LookupOption.java @@ -23,6 +23,10 @@ public enum LookupOption { * Showing verse numbers */ VERSE_NUMBERS('V', "VNum", XslConversionType.DEFAULT, true), + /** + * SM Showing extended verse reference + */ + XTENDED_VREFERENCE('X', "XVRef", XslConversionType.DEFAULT, false), /** * Full verse numbers including book and verse numbers */ diff --git a/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordMetadataServiceImpl.java b/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordMetadataServiceImpl.java index c24f613108..28534e3a7c 100644 --- a/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordMetadataServiceImpl.java +++ b/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordMetadataServiceImpl.java @@ -229,6 +229,7 @@ private void addBibleCategoryOptions(final Book book, final Set op options.add(LookupOption.VERSE_NEW_LINE); //SM options.add(LookupOption.NOTES); + options.add(LookupOption.XTENDED_VREFERENCE); } } diff --git a/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordPassageServiceImpl.java b/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordPassageServiceImpl.java index cb4d0929f4..e369aced4e 100644 --- a/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordPassageServiceImpl.java +++ b/step-core/src/main/java/com/tyndalehouse/step/core/service/jsword/impl/JSwordPassageServiceImpl.java @@ -474,6 +474,8 @@ public OsisWrapper getPassageByDisplayMode(List versionsInput, Key refer if (InterlinearMode.INTERLINEAR.equals(desiredModeOfDisplay) && options.contains(LookupOption.CHAPTER_BOOK_VERSE_NUMBER)) { //then we're in a search kind of lookup, so add proper verse numbers options.add(LookupOption.VERSE_NUMBERS); + // SM + options.add(LookupOption.XTENDED_VREFERENCE); } OsisWrapper passageText; @@ -1344,6 +1346,10 @@ protected void setOptions(final TransformingSAXEventProvider tsep, final List verses, fina //add verse numbers // options.add(LookupOption.TINY_VERSE_NUMBERS); options.add(LookupOption.VERSE_NUMBERS); + // SM + options.add(LookupOption.XTENDED_VREFERENCE); } final Versification av11n = this.versificationService.getVersificationForVersion(book); diff --git a/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java b/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java index ad45986c97..3aa708b98c 100644 --- a/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java +++ b/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java @@ -4,10 +4,7 @@ import com.tyndalehouse.step.core.service.helpers.VersionResolver; import org.crosswire.common.util.Language; import org.crosswire.common.util.Languages; -import org.crosswire.jsword.book.Book; -import org.crosswire.jsword.book.BookData; -import org.crosswire.jsword.book.BookException; -import org.crosswire.jsword.book.FeatureType; +import org.crosswire.jsword.book.*; import org.crosswire.jsword.book.basic.AbstractPassageBook; import org.crosswire.jsword.passage.*; import org.crosswire.jsword.versification.BibleBook; @@ -56,6 +53,10 @@ public static List getSortedSerialisableList(final Collection>> + final String v11n = (String) b.getBookMetaData().getProperty(BookMetaData.KEY_VERSIFICATION); + v.setVersification(v11n); + // SM <<<====== v.setName(shortName != null ? shortName : b.getName()); v.setInitials(b.getInitials()); v.setShortInitials(resolver.getShortName(b.getInitials())); diff --git a/step-core/src/main/resources/HtmlBundle.properties b/step-core/src/main/resources/HtmlBundle.properties index e7abab48e0..ff6e5138ba 100644 --- a/step-core/src/main/resources/HtmlBundle.properties +++ b/step-core/src/main/resources/HtmlBundle.properties @@ -33,6 +33,8 @@ video_help=Video demonstrations # Passage options display_headings=Headings display_verseNumbers=Verse numbers +display_extendedReference=Version Reference +display_extendedReference_help=Verse reference displayed for each version display_separateLines=Verses on separate lines display_redLetter=Jesus' words in red display_notes=Notes & References diff --git a/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl b/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl index e935c1b047..9304d57bdc 100644 --- a/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl +++ b/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl @@ -88,6 +88,9 @@ + + + @@ -464,7 +467,16 @@ - + + + + + + + + + + + + + - () + + + + + + + + () + @@ -1910,9 +1934,11 @@
- - - + + + + +
@@ -1923,17 +1949,23 @@ - + + + + - - - - + + + + + + + @@ -1944,6 +1976,10 @@ + + + + @@ -1956,13 +1992,16 @@ + singleVerse - + + + @@ -2047,6 +2086,7 @@ + @@ -2066,6 +2106,15 @@ + + + + + + + + + diff --git a/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/interlinear.xsl b/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/interlinear.xsl index 6642538bd1..2d7bac1e14 100644 --- a/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/interlinear.xsl +++ b/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/interlinear.xsl @@ -83,7 +83,10 @@ - + + + + diff --git a/step-web/src/main/webapp/js/backbone/views/view_display.js b/step-web/src/main/webapp/js/backbone/views/view_display.js index 0209ddf0c5..cdb6d1a29d 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_display.js +++ b/step-web/src/main/webapp/js/backbone/views/view_display.js @@ -90,6 +90,15 @@ var DisplayView = Backbone.View.extend({ } else if (interlinearMode.indexOf("INTERLEAVED") != -1) { step.util.ui._applyCssClassesRepeatByGroup(passageContent, ".verseGrouping", fonts, undefined, 0, '.singleVerse'); } else if (interlinearMode.indexOf("COLUMN") != -1) { + // cater for inserted verse references + // instead of lang1 lang2 lang3 .. we have lang1 r lang2 ref lang3 ref + var newFonts = [fonts[0]]; + if(fonts.length > 1){ + for(var i=1; i < fonts.length; i++){ + newFonts.push(undefined); + newFonts.push(fonts[i]); + } + } step.util.ui._applyCssClassesRepeatByGroup(passageContent, "tr.row", fonts, undefined, 1); } else if(this.model.get("searchType") == 'PASSAGE') { //normal mode, so all we need to do is check the language version, and if greek or hebrew then switch the font diff --git a/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js b/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js index 27a922bb84..6b34344c81 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js +++ b/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js @@ -25,6 +25,7 @@ var PassageMenuView = Backbone.View.extend({ items: [ {initial: "H", key: "display_headings"}, {initial: "V", key: "display_verseNumbers"}, + {initial: "X", key: "display_extendedReference", help: "display_extendedReference_help"}, {initial: "L", key: "display_separateLines"}, {initial: "R", key: "display_redLetter"}, {initial: "N", key: "display_notes"}, diff --git a/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js b/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js index 312fee6f77..ddfbbfd75a 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js +++ b/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js @@ -8,7 +8,7 @@ var PickBibleView = Backbone.View.extend({ '<% _.each(languageBibles, function(languageBible) { %>' + '
  • ' + '' + - '' + + '' + '<%= languageBible.shortInitials %> - <%= languageBible.name %> <%= step.util.ui.getFeaturesLabel(languageBible) %>
  • ' + '<% }) %>' + '' + @@ -23,7 +23,7 @@ var PickBibleView = Backbone.View.extend({ '<% _.each(languageBibles, function(languageBible) { %>' + '
  • ' + '' + - '' + + '' + '<%= languageBible.shortInitials %> - <%= languageBible.name %> <%= step.util.ui.getFeaturesLabel(languageBible) %>
  • ' + '<% }) %>' + '' +