Updated Chapter and Verse parsing to use a proper state machine.

* Functional parsing of the references.
   * Parse out a set of tokens divided into start and end sets
   * Use those tokens to drive a state machine building the final reference.
* Cleaned up formatting. cuddle those curlies!!!
* Fixed test suite to use the dev version of the lib.
This commit is contained in:
Jeremy Wall (zaphar) 2013-04-07 17:56:54 -05:00
parent d01ddd9737
commit 6296781f95
2 changed files with 485 additions and 490 deletions

View File

@ -11,21 +11,22 @@
<meta name="blogchalk" content="United States, Missouri, Saint Louis, English, Jason, Male, 21-25, photography, poetry" />
<meta name="copyright" content="All content copyrighted to Jason Wall, and available by permission of the owner." />
<title>The Bible with Strong's Numbers and Cross References</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<!--<script type="text/javascript" src="js/bible_ref_parsing.js"></script>-->
<script type="text/javascript" src="js/bible_ref_parsing.min.js"></script>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/bible_ref_parsing.js"></script>
<!--<script type="text/javascript" src="js/bible_ref_parsing.min.js"></script>-->
</head>
<body>
<script type="text/javascript">
$(document).ready(function()
{
var tests = [
["acts 1:4 - 60", "Acts 1:4 - 1:60"],
["acts 1:4 - 60", "Acts 1:4 - 1:60"],
["acts 1:4 - *", "Acts 1:4 - 1:*"],
["acts 1:4 - 2:8", "Acts 1:4 - 2:8"],
["acts 1:4 - 1:8", "Acts 1:4 - 1:8"],
["acts 1:4 - 2:8", "Acts 1:4 - 2:8"],
["acts 1:4 - 1:8", "Acts 1:4 - 1:8"],
["acts 1:4 - 2", "Acts 1:4 - 1:4"],
["acts 1:4 - 8", "Acts 1:4 - 1:8"],
["acts 1:4-8", "Acts 1:4 - 1:8"],
["acts 1:4 - 8", "Acts 1:4 - 1:8"],
["acts 1:4-8", "Acts 1:4 - 1:8"],
["john 1:4 - john 2", "John 1:4 - 2:*"],
["john 1 : 4 - john 2", "John 1:4 - 2:*"],
["I john 1:4 - I john 2", "1 John 1:4 - 2:*"],
@ -71,6 +72,7 @@
}
else
{
r += "<b>Expected:</b> " + t[1] + "<br />";
r += "<span style='color:red'>Failed</span><br /><br />";
failed++;
}
@ -80,8 +82,5 @@
});
</script>
</head>
<body>
</body>
</html>

File diff suppressed because it is too large Load Diff