Skip to content

Commit

Permalink
Merge pull request #141 from STEPBible/master_with_xsl_changes
Browse files Browse the repository at this point in the history
Apply xsl changes for bespoke versification support
  • Loading branch information
patricksptang authored Oct 2, 2023
2 parents 0dd308c + cf67c1a commit c9a7bff
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<junit.version>4.13.1</junit.version>

<!-- jsword dependencies -->
<jsword.version>1.6.4-SNAPSHOT</jsword.version>
<jsword.version>1.6.5-SNAPSHOT</jsword.version>
<!-- <jdom.version>1.1.1</jdom.version> -->
<javatar.version>2.5</javatar.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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 <<<==================
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ private void addBibleCategoryOptions(final Book book, final Set<LookupOption> op
options.add(LookupOption.VERSE_NEW_LINE);
//SM
options.add(LookupOption.NOTES);
options.add(LookupOption.XTENDED_VREFERENCE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ public OsisWrapper getPassageByDisplayMode(List<String> 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;
Expand Down Expand Up @@ -1344,6 +1346,10 @@ protected void setOptions(final TransformingSAXEventProvider tsep, final List<Lo
case VERSE_NUMBERS:
tsep.setParameter(LookupOption.TINY_VERSE_NUMBERS.getXsltParameterName(), true);
break;
case XTENDED_VREFERENCE:
// SM
tsep.setParameter(LookupOption.XTENDED_VREFERENCE.getXsltParameterName(), true);
break;
case CHAPTER_BOOK_VERSE_NUMBER:
tsep.setParameter(LookupOption.VERSE_NUMBERS.getXsltParameterName(), true);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ private boolean collectVersesFromReferences(final List<OsisWrapper> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,6 +53,10 @@ public static List<BibleVersion> getSortedSerialisableList(final Collection<Book
for (final Book b : bibles) {
final BibleVersion v = new BibleVersion();
final String shortName = (String) b.getProperty("shortName");
// SM Add versification =======>>>
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()));
Expand Down
2 changes: 2 additions & 0 deletions step-core/src/main/resources/HtmlBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
<!-- Whether to output Verse numbers or not -->
<xsl:param name="VNum" select="'false'"/>

<!-- SM Whether to output version verse reference or not -->
<xsl:param name="XVRef" select="'false'"/>

<!-- Whether to output Chapter and Verse numbers or not -->
<xsl:param name="CVNum" select="'false'"/>

Expand Down Expand Up @@ -464,7 +467,16 @@
<xsl:variable name="verse">
<xsl:choose>
<xsl:when test="@n">
<xsl:value-of select="jsword:shape($shaper, string(@n))"/>
<!-- SM -->
<xsl:if test="$XVRef = 'true'">
<xsl:value-of
select="jsword:shape($shaper, substring-after(substring-after($firstOsisID, '.'), '.'))"/>
</xsl:if>
<!-- SM -->
<xsl:if test="$XVRef != 'true'">
<xsl:value-of select="jsword:shape($shaper, string(@n))"/>
</xsl:if>
<!-- <xsl:value-of select="jsword:shape($shaper, string(@n))"/>-->
</xsl:when>
<xsl:otherwise>
<xsl:value-of
Expand All @@ -490,9 +502,21 @@
</xsl:template>

<xsl:template name="interleavedVersion">
<!-- SM -->
<xsl:variable name="verse" select="(div[@osisID] | verse)[1]"/>
<xsl:variable name="firstOsisID" select="substring-before(concat($verse/@osisID, ' '), ' ')"/>

<xsl:if test="$Interleave = 'true'">
<xsl:variable name="version" select="interleaving:getNextVersion($interleavingProvider)"/>
<span class="smallResultKey" data-version="{$version}">(<xsl:value-of select="$version"/>)
<span class="smallResultKey" data-version="{$version}">
<!-- SM -->
<xsl:if test="$XVRef = 'true'">
<xsl:value-of select="concat('(', $version, ': ', $firstOsisID, ')')"/>
</xsl:if>
<!-- SM -->
<xsl:if test="$XVRef != 'true'">
(<xsl:value-of select="$version"/>)
</xsl:if>
</span>
</xsl:if>
</xsl:template>
Expand Down Expand Up @@ -1910,9 +1934,11 @@
<xsl:otherwise>
<div class="verseGrouping">
<xsl:variable name="verse" select="cell/verse"/>
<xsl:call-template name="interleavedVerseNum">
<xsl:with-param name="verse" select="$verse"/>
</xsl:call-template>
<xsl:if test="$XVRef != 'true'">
<xsl:call-template name="interleavedVerseNum">
<xsl:with-param name="verse" select="$verse"/>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates/>
</div>
</xsl:otherwise>
Expand All @@ -1923,17 +1949,23 @@
<xsl:when test="cell[@role = 'label']">
<xsl:if test="$HideCompareHeaders != 'true'">
<tr>
<th class="headingVerseNumber"></th>
<!-- SM move to outputComparingTableHeader template-->
<xsl:if test="$XVRef != 'true'">
<th class="headingVerseNumber"></th>
</xsl:if>
<xsl:call-template name="outputComparingTableHeader"></xsl:call-template>
</tr>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<tr class="row">
<xsl:variable name="verse" select="(cell/div[@osisID] | cell/verse)[1]"/>
<xsl:call-template name="columnVerseNumber">
<xsl:with-param name="verse" select="$verse"/>
</xsl:call-template>
<!-- SM -->
<xsl:if test="$XVRef != 'true'">
<xsl:variable name="verse" select="(cell/div[@osisID] | cell/verse)[1]"/>
<xsl:call-template name="columnVerseNumber">
<xsl:with-param name="verse" select="$verse"/>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates/>
</tr>
</xsl:otherwise>
Expand All @@ -1944,6 +1976,10 @@
</xsl:template>

<xsl:template name="outputComparingTableHeader">
<!-- SM -->
<xsl:if test="$XVRef = 'true'">
<th class="headingVerseNumber"></th>
</xsl:if>
<xsl:variable name="version" select="interleaving:getNextVersion($interleavingProvider)"/>
<th class="comparingVersionName" data-version="{$version}">
<xsl:value-of select="$version"/>
Expand All @@ -1956,13 +1992,16 @@

<xsl:template name="interleaveVerse">
<xsl:param name="cell-direction"/>
<xsl:param name="verse" select="''"/>
<xsl:param name="classes" select="''"/>

<xsl:element name="span">
<xsl:attribute name="class">singleVerse
<xsl:value-of select="$classes"/><xsl:value-of select="$cell-direction"/>
</xsl:attribute>
<xsl:call-template name="interleavedVersion"/>
<xsl:call-template name="interleavedVersion">
<!-- <xsl:with-param name="verse" select="$verse"/> -->
</xsl:call-template>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
Expand Down Expand Up @@ -2047,6 +2086,7 @@
<xsl:choose>
<!-- interleaving or tabular column form -->
<xsl:when test="$Interleave = 'true'">
<xsl:variable name="verse" select="(div[@osisID] | verse)[1]"/>
<xsl:if test="$comparing = false()">
<xsl:call-template name="interleaveVerse">
<xsl:with-param name="cell-direction" select="$cell-direction"/>
Expand All @@ -2066,6 +2106,15 @@
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!-- SM -->
<xsl:if test="$XVRef = 'true'">
<xsl:variable name="verse" select="(div[@osisID] | verse)[1]"/>
<xsl:call-template name="columnVerseNumber">
<xsl:with-param name="verse" select="$verse"/>
</xsl:call-template>
</xsl:if>


<xsl:if test="$comparing = false()">
<xsl:call-template name="columnVerse">
<xsl:with-param name="cell-direction" select="$cell-direction"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@
<!-- Whether to output Verse numbers or not -->
<xsl:param name="VNum" select="'false'"/>

<!-- Whether to output Chapter and Verse numbers or not -->
<!-- SM Whether to output extended verse reverence or not -->
<xsl:param name="XVRef" select="'false'"/>

<!-- Whether to output Chapter and Verse numbers or not -->
<xsl:param name="CVNum" select="'false'"/>

<!-- Whether to output Book, Chapter and Verse numbers or not -->
Expand Down
18 changes: 17 additions & 1 deletion step-web/src/main/webapp/js/backbone/views/view_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,23 @@ 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) {
step.util.ui._applyCssClassesRepeatByGroup(passageContent, "tr.row", fonts, undefined, 1);
var versionRef= (options.indexOf('X') > -1);
if(versionRef)
{
// 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", newFonts, undefined, 1);
}
else{
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
if (fonts[0]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
4 changes: 2 additions & 2 deletions step-web/src/main/webapp/js/backbone/views/view_pick_bible.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var PickBibleView = Backbone.View.extend({
'<% _.each(languageBibles, function(languageBible) { %>' +
'<li class="list-group-item stepModalFgBg" data-initials="<%= languageBible.shortInitials %>">' +
'<a class="glyphicon glyphicon-info-sign" title="<%= __s.passage_info_about_version %>" target="_blank" href="http://<%= step.state.getDomain() %>/version.jsp?version=<%= languageBible.shortInitials %>"></a>' +
'<a class="resource" href="javascript:void(0)">' +
'<a class="resource" href="javascript:void(0)" title="Versification=<%= languageBible.versification %>">' +
'<%= languageBible.shortInitials %> - <%= languageBible.name %> <span class="pull-right"><%= step.util.ui.getFeaturesLabel(languageBible) %></span></a></li>' +
'<% }) %>' +
'</li>' +
Expand All @@ -23,7 +23,7 @@ var PickBibleView = Backbone.View.extend({
'<% _.each(languageBibles, function(languageBible) { %>' +
'<li class="list-group-item stepModalFgBg" data-initials="<%= languageBible.shortInitials %>">' +
'<a class="glyphicon glyphicon-info-sign" title="<%= __s.passage_info_about_version %>" target="_blank" href="http://<%= step.state.getDomain() %>/version.jsp?version=<%= languageBible.shortInitials %>"></a>' +
'<a class="resource" href="javascript:void(0)">' +
'<a class="resource" href="javascript:void(0)" title="Versification=<%= languageBible.versification %>">' +
'<%= languageBible.shortInitials %> - <%= languageBible.name %> <span class="pull-right"><%= step.util.ui.getFeaturesLabel(languageBible) %></span></a></li>' +
'<% }) %>' +
'</li>' +
Expand Down

0 comments on commit c9a7bff

Please sign in to comment.