<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I've committed this change to JSword.<div class="">Thanks!</div><div class=""><br class=""></div><div class="">In Him,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>DM</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 11, 2014, at 5:27 PM, Martin Denham <<a href="mailto:mjdenham@gmail.com" class="">mjdenham@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">There was a more flexible way to create this parser. The previous was rather fussy about the ids passed in. This new version (attached) should handle all combinations:<div class=""><br class=""></div><div class=""><div class=""><font face="courier new, monospace" class=""> @Test</font></div><div class=""><font face="courier new, monospace" class=""> public void testChapterParsing() {</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen.1", osisParser.parseOsisRef(testV11n, "Gen.1").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Mark.10", osisParser.parseOsisRef(testV11n, "Mark.10").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen.1-Gen.3", osisParser.parseOsisRef(testV11n, "Gen.1-Gen.3").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Obad", osisParser.parseOsisRef(testV11n, "Obad.1").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Obad", osisParser.parseOsisRef(testV11n, "Obad").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen", osisParser.parseOsisRef(testV11n, "Gen").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> }</font></div><div class=""><font face="courier new, monospace" class=""><br class=""></font></div><div class=""><font face="courier new, monospace" class=""> @Test</font></div><div class=""><font face="courier new, monospace" class=""> public void testMixedLengthParsing() {</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen-Exod.1", osisParser.parseOsisRef(testV11n, "Gen-Exod.1").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen.2-Gen.3", osisParser.parseOsisRef(testV11n, "Gen.2.1-Gen.3").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen.1-Gen.3", osisParser.parseOsisRef(testV11n, "Gen-Gen.3").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen.1-Gen.3.4", osisParser.parseOsisRef(testV11n, "Gen-Gen.3.4").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> assertEquals("Gen.3.4-Exod", osisParser.parseOsisRef(testV11n, "Gen.3.4-Exod").getOsisRef());</font></div><div class=""><font face="courier new, monospace" class=""> }</font></div></div><div class=""><br class=""></div><div class="">Comments?</div><div class=""><br class=""></div><div class="">Cheers</div><div class="">Martin</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 2 September 2014 18:02, Martin Denham <span dir="ltr" class=""><<a href="mailto:mjdenham@gmail.com" target="_blank" class="">mjdenham@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Hi DM,<div class=""><br class=""></div><div class="">There is a unit test attached to the previous e-mail that covers the scenarios you have mentioned:</div><div class=""><div class=""> @Test</div><div class=""> public void testChapterParsing() {</div><span class=""><div class="">
assertEquals("Gen.1", SimpleOsisParser.parseOsisRef(testV11n, "Gen.1").getOsisRef());</div></span><div class=""> assertEquals("Mark.10", SimpleOsisParser.parseOsisRef(testV11n, "Mark.10").getOsisRef());</div>
<div class=""> assertEquals("Gen.1-Gen.3", SimpleOsisParser.parseOsisRef(testV11n, "Gen.1-Gen.3").getOsisRef());</div><div class=""> assertEquals("Obad", SimpleOsisParser.parseOsisRef(testV11n, "Obad.1").getOsisRef());</div>
<div class=""> }</div></div><div class=""><br class=""></div><div class="">One assumption is that chapters start with verse 1, although this could probably be changed to assume they start with verse 0 if that is correct.</div><div class=""><br class=""></div><div class="">Cheers</div><span class="HOEnZb"><font color="#888888" class="">
<div class="">Martin</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br class=""><br class=""><div class="gmail_quote">On 1 September 2014 16:22, DM Smith <span dir="ltr" class=""><<a href="mailto:dmsmith@crosswire.org" target="_blank" class="">dmsmith@crosswire.org</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Meant to respond to your first email. This is needed. Hope to review it soon. Work is crazy.<div class="">
<br class=""></div><div class="">The challenge with interpreting Gen.1 is that you have to know if it stands alone is the left part of a range or the right part of the range. When it stands alone it refers to the whole chapter, when it is the first part of a range it means the first verse of the chapter and if is the end of the range then it is the last verse of the range.</div>
<div class=""><br class=""></div><div class="">We also have the complication that of what the first verse or the whole chapter means. Does it include verse 0?</div><div class=""><br class=""></div><div class="">Since the start and the end of an OSIS range have to be valid OSIS refs the parsing of a range is much easier than user input ranges which might be like Gen 1:2-5. The -5 is ambiguous and has to be interpreted in context of what stands in front of it.<div class="">
<br class=""></div><div class="">-- DM</div><div class=""><br class=""><div class=""><div class=""><div class=""><div class="">On Aug 30, 2014, at 3:05 PM, Martin Denham <<a href="mailto:mjdenham@gmail.com" target="_blank" class="">mjdenham@gmail.com</a>> wrote:</div><br class=""></div></div><blockquote type="cite" class="">
<div class=""><div class=""><div dir="ltr" class="">I have taken a stab at adding the above functionality to SimpleOsisParser so that it can also parse refs like 'Gen.1', 'Gen.1-Gen.3', 'Obad.1'. I would like to make the methods non-static but tried to make as few changes as possible to the existing code but it may be that this enhancement necessitates some refactoring.<div class="">
<br class=""></div><div class="">Can somebody review the attached code and say if it is acceptable?<br class=""><div class=""><br class=""></div><div class="">Martin</div></div></div><div class="gmail_extra"><br class=""><br class=""><div class="gmail_quote">On 30 August 2014 15:23, Martin Denham <span dir="ltr" class=""><<a href="mailto:mjdenham@gmail.com" target="_blank" class="">mjdenham@gmail.com</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">Are there any plans to extend the SimpleOsisParser to be able to parse chapter references like "Gen.1" instead of just verse references e.g. "Gen.1.1" or verse range references e.g. "Gen.1.1-Gen.1.3"?</div>
<div class=""><br class=""></div><div class="">The following fails so I can't parse a reference to the whole of Genesis 1 easily:</div><div class=""><br class=""></div><div class=""><div class=""> assertEquals("Gen.1", SimpleOsisParser.parseOsisRef(testV11n, "Gen.1").getOsisRef());</div>
</div><div class=""><br class=""></div><div class="">other than by entering "Gen.1.1-Gen.1.31" which, funnily enough, returns the Osis I originally tried to enter "Gen.1".<span class=""><font color="#888888" class=""><br class=""></font></span></div>
<span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Martin</div></font></span></div>
</blockquote></div><br class=""></div>
</div></div><span class=""><SimpleOsisParser.java></span><span class=""><SimpleOsisIDParserTest.java></span>_______________________________________________<br class="">jsword-devel mailing list<br class=""><a href="mailto:jsword-devel@crosswire.org" target="_blank" class="">jsword-devel@crosswire.org</a><br class="">
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank" class="">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br class=""></blockquote></div><br class=""></div></div></div><br class="">_______________________________________________<br class="">
jsword-devel mailing list<br class="">
<a href="mailto:jsword-devel@crosswire.org" target="_blank" class="">jsword-devel@crosswire.org</a><br class="">
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank" class="">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></div></blockquote></div><br class=""></div>
<span id="cid:BA511A19-B139-44BF-8B88-CB5CE1A18F79@woh.rr.com"><OsisParser.java></span><span id="cid:6C5A16B2-6923-48B2-BCED-7106E74D6077@woh.rr.com"><OsisParserTest.java></span>_______________________________________________<br class="">jsword-devel mailing list<br class=""><a href="mailto:jsword-devel@crosswire.org" class="">jsword-devel@crosswire.org</a><br class="">http://www.crosswire.org/mailman/listinfo/jsword-devel<br class=""></div></blockquote></div><br class=""></div></body></html>