[jsword-devel] Lexical Word form in MorphGNT

Mullins, Steven Steven.Mullins at dmme.virginia.gov
Wed May 14 12:44:32 MST 2008


DM,

I think that it is a good idea to define a protocol for lex.  There are a 
few Greek lexicons in the sword modules that it "could" link to with
a bit of work.  The lexicons are upper-case and the lexical forms are
lower, besides the Unicode issues involved.  But I think it can be done.
I don't have any hyperlinks in the xls code for lex, but that would be
a nice function to put in later, when the protocol is working.

Yes the OSISUtil code is dead.  It was an artifact of an earlier attempt
that I aborted.  It should be discarded.

I think defaulting all non-strongs to display as [lex] will work good
for now.  Later, if hyperlinks are added in the xls code for linking
to lexicon modules, another catch-all bin can be set up.

Since I am very new to jsword, what is the best way to contribute code?

Looking forward to helping.  I'm glad to return a little bit of work back
the Biblical Open Source community, since I have benefited so much from it.

Thanks,

Steve


Steve,
Good timing! This will make it into the release. I am in the process of
committing your change.

I've applied the change to simple.xsl with a minor change to create a
variable lex.def.protocol whose value is 'lex:' and use that.

I didn't apply the patch to OSISUtil as it would be dead code. The new
stuff is not used anywhere. Was there something else that should be
included in the patch?

It would be easier for me if the patch is attached as a zip.

I think it would be good to make a minor modification to your code that
rather than looking for lemma.Strong, it is the default for all lemmas
that are not Strong's numbers. This would handle two types of values:
lemma="A:B"
and
lemma="B"
both outputting [B], where A is not in strong: and x-Strongs:

Looking forward to more contributions!

DM

On May 14, 2008, at 12:32 PM, Mullins, Steven wrote:

This is my first code contribution to this project.  Woo Hoo!

Right now in the MorphGNT module, if Strongs numbers are checked yes, nothing is shown.  This is because in the MorphGNT module, the value for the strongs numbers in the source is not a strongs number, it is the dictionary (lexical) form of the word.  With this code added, and strongs checked yes, the lexical form will display inline in square brackets.  The other modules do not appear to be affected.

Changes were made based on revision 1859. 

bibledesktop.diff
Index: src/main/resources/xsl/cswing/simple.xsl
===================================================================
--- src/main/resources/xsl/cswing/simple.xsl	(revision 1859)
+++ src/main/resources/xsl/cswing/simple.xsl	(working copy)
@@ -130,6 +130,7 @@
           SUB.lemma { font-size: 75%; color: red; }
           SUP.verse { font-size: 75%; color: gray; }
           SUP.note { font-size: 75%; color: green; }
+          FONT.lex { color: red; }
           FONT.jesus { color: red; }
           FONT.speech { color: blue; }
           FONT.strike { text-decoration: line-through; }
@@ -528,6 +529,11 @@
         <xsl:with-param name="morph" select="@morph"/>
       </xsl:call-template>
     </xsl:if>
+    <xsl:if test="$Strongs = 'true' and starts-with(@lemma, 'lemma.Strong:')">
+      <xsl:call-template name="lemma">
+        <xsl:with-param name="lemma" select="@lemma"/>
+      </xsl:call-template>
+    </xsl:if>
     <!--
         except when followed by a text node or non-printing node.
         This is true whether the href is output or not.
@@ -572,8 +578,11 @@
         <xsl:when test="substring($orig-lemma, 1, 1) = 'H'">
           <xsl:value-of select="$hebrew.def.protocol"/>
         </xsl:when>
+        <xsl:when test="substring($orig-lemma, 1, 1) = 'G'">
+          <xsl:value-of select="$greek.def.protocol"/>
+        </xsl:when>
         <xsl:otherwise>
-          <xsl:value-of select="$greek.def.protocol"/>
+          <xsl:value-of select="'lex:'"/>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
@@ -598,6 +607,9 @@
       </xsl:choose>
     </xsl:variable>
     <xsl:choose>
+      <xsl:when test="$protocol = 'lex:'">
+        <font class="lex">[<xsl:value-of select="$orig-lemma"/>]</font>
+      </xsl:when>
       <xsl:when test="$separator = ''">
         <!-- <sub class="strongs"><a href="{$protocol}{$orig-lemma}">S<xsl:number level="any" from="/osis//verse" format="1"/><xsl:number value="$sub" format="a"/></a></sub> -->
         <sub class="strongs"><a href="{$protocol}{$orig-lemma}"><xsl:value-of select="format-number(substring($orig-lemma,2),'#')"/></a></sub>





jsword.diff
Index: src/main/java/org/crosswire/jsword/book/OSISUtil.java
===================================================================
--- src/main/java/org/crosswire/jsword/book/OSISUtil.java	(revision 1859)
+++ src/main/java/org/crosswire/jsword/book/OSISUtil.java	(working copy)
@@ -199,14 +199,20 @@
      * Constant for a Strong's numbering lemma
      */
     public static final String LEMMA_STRONGS = "strong:"; //$NON-NLS-1$
-    public static final String MORPH_ROBINSONS = "robinson:"; //$NON-NLS-1$
-
+    public static final String MORPH_ROBINSONS = "robinson:"; //$NON-NLS-1$  
+    
     /**
      * Constant for Strong's numbering morphology
      */
     public static final String MORPH_STRONGS = "x-StrongsMorph:T"; //$NON-NLS-1$
 
     /**
+     * Constant for a Strong's numbering lemma in MorphGreek Module
+     * which is really the lexical form of the word.
+     */
+    public static final String LEMMA_LEXICAL = "lemma.Strong:"; //$NON-NLS-1$
+    
+    /**
      * Constant to help narrow down what we use "q" for. In this case: blockquote
      */
     public static final String Q_BLOCK = "blockquote"; //$NON-NLS-1$




More information about the jsword-devel mailing list