Example #1
0
        public void Parse_ParagraphStartsMidVerseAndHasAnotherVerse()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "Cutcut Cwiny Maleŋ otero Yecu woko wa i tim. " +
                                                        "<verse number=\"13\" style=\"v\" />Ci obedo i tim nino pyeraŋwen; Catan ocako bite, " +
                                                        "ma onoŋo en tye kacel ki lee tim, kun lumalaika gikonye.</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual(1, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual("Cutcut Cwiny Maleŋ otero Yecu woko wa i tim. Ci obedo i tim nino pyeraŋwen; Catan ocako bite, ma onoŋo en tye kacel ki lee tim, kun lumalaika gikonye.", blocks[1].GetText(false));
            Assert.AreEqual("Cutcut Cwiny Maleŋ otero Yecu woko wa i tim. {13}\u00A0Ci obedo i tim nino pyeraŋwen; Catan ocako bite, ma onoŋo en tye kacel ki lee tim, kun lumalaika gikonye.", blocks[1].GetText(true));
        }
Example #2
0
        public void Parse_ParagraphWithFigureInMiddle_FigureIsIgnored()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "This text is before the figure, " +
                                                        "<figure style=\"fig\" desc=\"\" file=\"4200118.TIF\" size=\"col\" loc=\"\" copy=\"\" ref=\"1.18\">" +
                                                        "Cutcut gutugi weko obwugi</figure>" +
                                                        "and this text is after.</para >");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual(1, blocks[1].BlockElements.Count);
            Assert.AreEqual("This text is before the figure, and this text is after.", blocks[1].GetText(false));
        }
Example #3
0
        public void Parse_ChapterAndPara_BecomeTwoBlocks()
        {
            var doc    = UsxDocumentTests.CreateMarkOneDoc("<para style=\"s1\">Lok ma Jon Labatija otito</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual(1, blocks[0].ChapterNumber);
            Assert.AreEqual(0, blocks[0].InitialStartVerseNumber);
            Assert.AreEqual("1", blocks[0].GetText(false));
            Assert.AreEqual(1, blocks[1].ChapterNumber);
            Assert.AreEqual(0, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual("Lok ma Jon Labatija otito", blocks[1].GetText(false));
        }
Example #4
0
        public void Parse_OnlyVerseInParagraphConsistsEntirelyOfNote_DoNotIncludeParagraph()
        {
            // World English Bible, LUK 17:36, PG-594
            var doc = UsxDocumentTests.CreateMarkOneDoc(
                "  <para style=\"p\">\r\n" +
                "    <verse number=\"36\" style=\"v\" /><note caller=\"+\" style=\"f\">Some Greek manuscripts add: “Two will be in the field: the one taken, and the other left.”</note></para>\r\n" +
                "  <para style=\"p\">\r\n" +
                "    <verse number=\"37\" style=\"v\" />They, answering, asked him, “Where, Lord?”</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual(2, blocks[1].BlockElements.Count);
            Assert.AreEqual("{37}\u00A0They, answering, asked him, “Where, Lord?”", blocks[1].GetText(true));
        }
Example #5
0
        public void Parse_NodeWithNoChildren_IgnoresNode()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "<verse number=\"1\" style=\"v\" />এই হল যীশু খ্রীষ্টের বংশ তালিকা৷ ইনি ছিলেন রাজা দায়ূদের বংশধর, দায়ূদ ছিলেন অব্রাহামের বংশধর৷</para>" +
                                                        "<para style=\"b\" />" +
                                                        "<para style=\"li\">" +
                                                        "<verse number=\"2\" style=\"v\" />অব্রাহামের ছেলে ইসহাক৷</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(3, blocks.Count);
            Assert.AreEqual("c", blocks[0].StyleTag);
            Assert.AreEqual("p", blocks[1].StyleTag);
            Assert.AreEqual("li", blocks[2].StyleTag);
        }
Example #6
0
        public void Parse_ParagraphWithNote_NoteIsIgnored()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"q1\">" +
                                                        "<verse number=\"3\" style=\"v\" />" +
                                                        "<note caller=\"-\" style=\"x\">" +
                                                        "<char style=\"xo\" closed=\"false\">1.3: </char>" +
                                                        "<char style=\"xt\" closed=\"false\">Ic 40.3</char>" +
                                                        "</note>dwan dano mo ma daŋŋe ki i tim ni,</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual("dwan dano mo ma daŋŋe ki i tim ni,", blocks[1].GetText(false));
            Assert.AreEqual("{3}\u00A0dwan dano mo ma daŋŋe ki i tim ni,", blocks[1].GetText(true));
        }
Example #7
0
        public void Parse_WhitespaceBetweenCharAndNoteElements_WhitespaceIsIgnored()
        {
            // World English Bible, MAT 5:27, PG-593
            var doc = UsxDocumentTests.CreateMarkOneDoc(
                "  <para style=\"p\">\r\n" +
                "    <verse number=\"27\" style=\"v\" />\r\n" +
                "    <char style=\"wj\">“You have heard that it was said, </char>\r\n" +
                "    <note caller=\"+\" style=\"f\">TR adds “to the ancients”.</note> <char style=\"wj\">‘You shall not commit adultery;’</char><note caller=\"+\" style=\"x\">Exodus 20:14</note> <verse number=\"28\" style=\"v\" /><char style=\"wj\">but I tell you that everyone who gazes at a woman to lust after her has committed adultery with her already in his heart. </char> <verse number=\"29\" style=\"v\" /><char style=\"wj\">If your right eye causes you to stumble, pluck it out and throw it away from you. For it is more profitable for you that one of your members should perish, than for your whole body to be cast into Gehenna.</char><note caller=\"+\" style=\"f\">or, Hell</note> <verse number=\"30\" style=\"v\" /><char style=\"wj\">If your right hand causes you to stumble, cut it off, and throw it away from you. For it is more profitable for you that one of your members should perish, than for your whole body to be cast into Gehenna.</char><note caller=\"+\" style=\"f\">or, Hell</note></para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual(8, blocks[1].BlockElements.Count);
            Assert.AreEqual("“You have heard that it was said, ‘You shall not commit adultery;’ but I tell you that everyone who gazes at a woman to lust after her has committed adultery with her already in his heart. If your right eye causes you to stumble, pluck it out and throw it away from you. For it is more profitable for you that one of your members should perish, than for your whole body to be cast into Gehenna. If your right hand causes you to stumble, cut it off, and throw it away from you. For it is more profitable for you that one of your members should perish, than for your whole body to be cast into Gehenna.", blocks[1].GetText(false));
            Assert.AreEqual("{27}\u00A0“You have heard that it was said, ‘You shall not commit adultery;’ {28}\u00A0but I tell you that everyone who gazes at a woman to lust after her has committed adultery with her already in his heart. {29}\u00A0If your right eye causes you to stumble, pluck it out and throw it away from you. For it is more profitable for you that one of your members should perish, than for your whole body to be cast into Gehenna. {30}\u00A0If your right hand causes you to stumble, cut it off, and throw it away from you. For it is more profitable for you that one of your members should perish, than for your whole body to be cast into Gehenna.", blocks[1].GetText(true));
        }
Example #8
0
        public void Parse_VerseBridge_AcrossMultipleParagraphs()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "<verse number=\"1-3\" style=\"v\" />" +
                                                        "Verse 1-3 beginning text" +
                                                        "</para><para style=\"p\">" +
                                                        "Verse 1-3 continuing text</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(3, blocks.Count);
            Assert.AreEqual(1, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual(3, blocks[1].InitialEndVerseNumber);
            Assert.AreEqual(1, blocks[2].InitialStartVerseNumber);
            Assert.AreEqual(3, blocks[2].InitialEndVerseNumber);
        }
Example #9
0
        public void Parse_IsParagraphStart()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "<verse number=\"1\" style=\"v\" />" +
                                                        "Verse 1 text</para>" +
                                                        "<para style=\"p\">" +
                                                        "Verse 2 text" +
                                                        "<verse number=\"2\" style=\"v\" />" +
                                                        "more Verse 2 text</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(3, blocks.Count);
            Assert.IsTrue(blocks[0].IsParagraphStart);             //chapter
            Assert.IsTrue(blocks[1].IsParagraphStart);
            Assert.IsTrue(blocks[2].IsParagraphStart);
        }
Example #10
0
        public void Parse_SpecificChapterLabel()
        {
            var doc    = UsxDocumentTests.CreateMarkOneDoc("<para style=\"cl\">Specific-Chapter One</para><para style=\"s1\">Lok ma Jon Labatija otito</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.AreEqual(1, blocks[0].ChapterNumber);
            Assert.AreEqual(0, blocks[0].InitialStartVerseNumber);
            Assert.AreEqual("Specific-Chapter One", blocks[0].GetText(false));
            Assert.AreEqual("BC-MRK", blocks[0].CharacterId);
            Assert.True(blocks[0].IsParagraphStart);
            Assert.AreEqual(1, blocks[1].ChapterNumber);
            Assert.AreEqual(0, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual("Lok ma Jon Labatija otito", blocks[1].GetText(false));
            Assert.IsNull(blocks[1].CharacterId);
            Assert.True(blocks[1].IsParagraphStart);
        }
Example #11
0
        public void Parse_SingleNarratorParagraphWithVerseNumbers_GeneratesSingleNarratorBlock()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "<verse number=\"1\" style=\"v\" />" +
                                                        "Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa, " +
                                                        "<verse number=\"2\" style=\"v\" />" +
                                                        "kit ma gicoyo kwede i buk pa lanebi Icaya ni,</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(2, blocks.Count);
            Assert.IsTrue(blocks[0].CharacterIs("MRK", CharacterVerseData.StandardCharacter.BookOrChapter));
            Assert.IsTrue(blocks[1].CharacterId == Block.kNotSet);
            Assert.AreEqual(1, blocks[1].ChapterNumber);
            Assert.AreEqual(1, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual("Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa, kit ma gicoyo kwede i buk pa lanebi Icaya ni,", blocks[1].GetText(false));
            Assert.AreEqual("{1}\u00A0Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa, {2}\u00A0kit ma gicoyo kwede i buk pa lanebi Icaya ni,", blocks[1].GetText(true));
        }
Example #12
0
        public void Parse_ProcessChaptersAndVerses_BlocksGetCorrectChapterAndVerseNumbers()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "<verse number=\"1\" style=\"v\" />" +
                                                        "Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa, " +
                                                        "<verse number=\"2\" style=\"v\" />" +
                                                        "kit ma gicoyo kwede i buk pa lanebi Icaya ni,</para>" +
                                                        "<chapter number=\"2\" style=\"c\" />" +
                                                        "<para style=\"p\">" +
                                                        "<verse number=\"1\" style=\"v\" />" +
                                                        "Ka nino okato manok, Yecu dok odwogo i Kapernaum, ci pire owinnye ni en tye paco.</para>" +
                                                        "<para style=\"q1\">" +
                                                        "This is poetry, dude.</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(5, blocks.Count);
            Assert.AreEqual("c", blocks[0].StyleTag);
            Assert.IsTrue(blocks[0].IsChapterAnnouncement);
            Assert.AreEqual("MRK", blocks[0].BookCode);
            Assert.AreEqual(1, blocks[0].ChapterNumber);
            Assert.AreEqual(0, blocks[0].InitialStartVerseNumber);
            Assert.AreEqual("1", blocks[0].GetText(true));
            Assert.AreEqual("p", blocks[1].StyleTag);
            Assert.AreEqual(1, blocks[1].ChapterNumber);
            Assert.AreEqual(1, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual("{1}\u00A0Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa, {2}\u00A0kit ma gicoyo kwede i buk pa lanebi Icaya ni,", blocks[1].GetText(true));

            Assert.AreEqual("c", blocks[2].StyleTag);
            Assert.IsTrue(blocks[2].IsChapterAnnouncement);
            Assert.AreEqual("MRK", blocks[2].BookCode);
            Assert.AreEqual(2, blocks[2].ChapterNumber);
            Assert.AreEqual(0, blocks[2].InitialStartVerseNumber);
            Assert.AreEqual("2", blocks[2].GetText(true));
            Assert.AreEqual("p", blocks[3].StyleTag);
            Assert.AreEqual(2, blocks[3].ChapterNumber);
            Assert.AreEqual(1, blocks[3].InitialStartVerseNumber);
            Assert.AreEqual("{1}\u00A0Ka nino okato manok, Yecu dok odwogo i Kapernaum, ci pire owinnye ni en tye paco.", blocks[3].GetText(true));
            Assert.AreEqual("q1", blocks[4].StyleTag);
            Assert.AreEqual(2, blocks[4].ChapterNumber);
            Assert.AreEqual(1, blocks[4].InitialStartVerseNumber);
            Assert.AreEqual("This is poetry, dude.", blocks[4].GetText(true));
        }
Example #13
0
        public void Parse_ParaStartsWithVerseNumber_BlocksGetCorrectChapterAndVerseNumbers()
        {
            var doc = UsxDocumentTests.CreateMarkOneDoc("<para style=\"p\">" +
                                                        "<verse number=\"12\" style=\"v\" />" +
                                                        "Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa,</para>" +
                                                        "<para style=\"p\">" +
                                                        "<verse number=\"13\" style=\"v\" />" +
                                                        "Ka nino okato manok, Yecu dok odwogo i Kapernaum, ci pire owinnye ni en tye paco.</para>");
            var parser = GetUsxParser(doc);
            var blocks = parser.Parse().ToList();

            Assert.AreEqual(3, blocks.Count);
            Assert.AreEqual(1, blocks[1].ChapterNumber);
            Assert.AreEqual(12, blocks[1].InitialStartVerseNumber);
            Assert.AreEqual("Acakki me lok me kwena maber i kom Yecu Kricito, Wod pa Lubaŋa,", blocks[1].GetText(false));

            Assert.AreEqual(1, blocks[2].ChapterNumber);
            Assert.AreEqual(13, blocks[2].InitialStartVerseNumber);
            Assert.AreEqual("Ka nino okato manok, Yecu dok odwogo i Kapernaum, ci pire owinnye ni en tye paco.", blocks[2].GetText(false));
        }