Exemplo n.º 1
0
        public void ToUsx_EmptySegments()
        {
            var delta = Delta.New()
                        .InsertChapter("1")
                        .InsertVerse("1")
                        .InsertBlank("verse_1_1")
                        .InsertVerse("2")
                        .InsertBlank("verse_1_2")
                        .InsertPara("p")
                        .InsertBlank("verse_1_2/li_1")
                        .InsertPara("li")
                        .InsertBlank("verse_1_2/li_2")
                        .InsertPara("li")
                        .InsertBlank("verse_1_2/p_1")
                        .InsertVerse("3")
                        .InsertBlank("verse_1_3")
                        .InsertPara("p")
                        .Insert("\n");

            DeltaUsxMapper mapper     = CreateMapper();
            XElement       newUsxElem = mapper.ToUsx("2.5", "PHM", null, delta);

            XElement expected = Usx("PHM",
                                    Chapter("1"),
                                    Para("p",
                                         Verse("1"),
                                         Verse("2")),
                                    Para("li"),
                                    Para("li"),
                                    Para("p",
                                         Verse("3")));

            Assert.IsTrue(XNode.DeepEquals(newUsxElem, expected));
        }
Exemplo n.º 2
0
        public void ToDelta_SectionHeader()
        {
            XElement usxElem = Usx("PHM",
                                   Chapter("1"),
                                   Para("p",
                                        Verse("1"),
                                        Verse("2")),
                                   Para("s"),
                                   Para("p",
                                        Verse("3")));

            DeltaUsxMapper mapper   = CreateMapper();
            Delta          newDelta = mapper.ToDelta("12345", usxElem);

            var expected = Delta.New()
                           .InsertChapter("1")
                           .InsertVerse("1")
                           .InsertBlank("verse_1_1")
                           .InsertVerse("2")
                           .InsertBlank("verse_1_2")
                           .InsertPara("p")
                           .InsertBlank("s_1")
                           .InsertPara("s")
                           .InsertVerse("3")
                           .InsertBlank("verse_1_3")
                           .InsertPara("p")
                           .Insert("\n");

            Assert.IsTrue(newDelta.DeepEquals(expected));
        }
Exemplo n.º 3
0
 public ParatextSendReceiveRunner(IOptions <SendReceiveOptions> options, IRepository <User> userRepo,
                                  IRepository <SendReceiveJob> jobRepo, IRepository <TranslateProject> projectRepo,
                                  ParatextService paratextService, IProjectRepositoryFactory <TranslateDocumentSet> docSetRepoFactory,
                                  DeltaUsxMapper deltaUsxMapper, ILogger <ParatextSendReceiveRunner> logger)
 {
     _options           = options;
     _userRepo          = userRepo;
     _jobRepo           = jobRepo;
     _projectRepo       = projectRepo;
     _paratextService   = paratextService;
     _docSetRepoFactory = docSetRepoFactory;
     _deltaUsxMapper    = deltaUsxMapper;
     _logger            = logger;
 }
Exemplo n.º 4
0
        public void ToUsx_HeaderPara()
        {
            var delta = Delta.New()
                        .InsertText("Philemon", "h_1")
                        .InsertPara("h")
                        .Insert("\n");

            DeltaUsxMapper mapper     = CreateMapper();
            XElement       newUsxElem = mapper.ToUsx("2.5", "PHM", null, delta);

            XElement expected = Usx("PHM",
                                    Para("h", "Philemon"));

            Assert.IsTrue(XNode.DeepEquals(newUsxElem, expected));
        }
Exemplo n.º 5
0
        public void ToUsx_ConsecutiveSameStyleEmptyParas()
        {
            var delta = Delta.New()
                        .InsertPara("p")
                        .InsertPara("p")
                        .Insert("\n");

            DeltaUsxMapper mapper     = CreateMapper();
            XElement       newUsxElem = mapper.ToUsx("2.5", "PHM", null, delta);

            XElement expected = Usx("PHM",
                                    Para("p"),
                                    Para("p"));

            Assert.IsTrue(XNode.DeepEquals(newUsxElem, expected));
        }
Exemplo n.º 6
0
        public void ToUsx_VerseText()
        {
            var delta = Delta.New()
                        .InsertChapter("1")
                        .InsertVerse("1")
                        .InsertText("Verse text.", "verse_1_1")
                        .InsertPara("p")
                        .Insert("\n");

            DeltaUsxMapper mapper     = CreateMapper();
            XElement       newUsxElem = mapper.ToUsx("2.5", "PHM", null, delta);

            XElement expected = Usx("PHM",
                                    Chapter("1"),
                                    Para("p",
                                         Verse("1"),
                                         "Verse text."));

            Assert.IsTrue(XNode.DeepEquals(newUsxElem, expected));
        }
Exemplo n.º 7
0
        public void ToDelta_Note()
        {
            XElement usxElem = Usx("PHM",
                                   Chapter("1"),
                                   Para("p",
                                        Verse("1"),
                                        "This is a verse with a footnote",
                                        Note("f", "+",
                                             Char("fr", "1.1: "),
                                             Char("ft", "Refers to "),
                                             Char("fq", "a footnote"),
                                             ". ",
                                             Char("xt", "John 1:1"),
                                             " and ",
                                             Char("xt", "Mark 1:1"),
                                             "."),
                                        ", so that we can test it."));

            DeltaUsxMapper mapper   = CreateMapper();
            Delta          newDelta = mapper.ToDelta("12345", usxElem);

            var expected = Delta.New()
                           .InsertChapter("1")
                           .InsertVerse("1")
                           .InsertText("This is a verse with a footnote", "verse_1_1")
                           .InsertNote(0, Delta.New()
                                       .InsertChar("1.1: ", "fr")
                                       .InsertChar("Refers to ", "ft")
                                       .InsertChar("a footnote", "fq")
                                       .Insert(". ")
                                       .InsertChar("John 1:1", "xt")
                                       .Insert(" and ")
                                       .InsertChar("Mark 1:1", "xt")
                                       .Insert("."), "f", "+", "verse_1_1")
                           .InsertText(", so that we can test it.", "verse_1_1")
                           .InsertPara("p")
                           .Insert("\n");

            Assert.IsTrue(newDelta.DeepEquals(expected));
        }
Exemplo n.º 8
0
        public void ToUsx_Note()
        {
            var delta = Delta.New()
                        .InsertChapter("1")
                        .InsertVerse("1")
                        .InsertText("This is a verse with a footnote", "verse_1_1")
                        .InsertNote(0, Delta.New()
                                    .InsertChar("1.1: ", "fr")
                                    .InsertChar("Refers to ", "ft")
                                    .InsertChar("a footnote", "fq")
                                    .Insert(". ")
                                    .InsertChar("John 1:1", "xt")
                                    .Insert(" and ")
                                    .InsertChar("Mark 1:1", "xt")
                                    .Insert("."), "f", "+", "verse_1_1")
                        .InsertText(", so that we can test it.", "verse_1_1")
                        .InsertPara("p")
                        .Insert("\n");

            DeltaUsxMapper mapper     = CreateMapper();
            XElement       newUsxElem = mapper.ToUsx("2.5", "PHM", null, delta);

            XElement expected = Usx("PHM",
                                    Chapter("1"),
                                    Para("p",
                                         Verse("1"),
                                         "This is a verse with a footnote",
                                         Note("f", "+",
                                              Char("fr", "1.1: "),
                                              Char("ft", "Refers to "),
                                              Char("fq", "a footnote"),
                                              ". ",
                                              Char("xt", "John 1:1"),
                                              " and ",
                                              Char("xt", "Mark 1:1"),
                                              "."),
                                         ", so that we can test it."));

            Assert.IsTrue(XNode.DeepEquals(newUsxElem, expected));
        }