public void test(LnChapter chapter)
 {
     Assert.AreEqual(chapter.title, "title");
     Assert.AreEqual(chapter.paragraphs.Count, 1);
     Assert.AreEqual(chapter.paragraphs.First().InnerText, "innerText");
     Assert.AreEqual(chapter.chapNumber, 12);
 }
        public LnChapter Parse(HtmlDocument doc)
        {
            List <HtmlNode> paragraphs = new List <HtmlNode>();
            HtmlNode        p          = HtmlTextNode.CreateNode("innerText");

            paragraphs.Add(p);
            LnChapter c = new LnChapter("title", paragraphs);

            c.chapNumber = 12;
            return(c);
        }
Esempio n. 3
0
        private void CheckParsers()
        {
            IParser xiaowazParser = new ParserFactory().GetParser("xiaowaz.fr");

            Assert.AreEqual(xiaowazParser.GetType(), typeof(XiaowazParser));

            IParser customParser = new ParserFactory().GetParser("customParser");

            Assert.AreEqual(customParser.GetType(), typeof(CustomParser));

            LnChapter chapter = customParser.Parse(null);

            ((CustomParser)customParser).test(chapter);
        }
Esempio n. 4
0
        //   <meta name="cover" content="cover-image" />
        public override void AddChapter(LnChapter lnChapter)
        {
            lnChapter.title = string.IsNullOrEmpty(lnChapter.title)
                ? string.Format(Globale.DEFAULT_CHAPTER_TITLE, lnChapter.chapNumber)
                : lnChapter.title;

            string content =
                GetHeader(lnParameters.name, lnChapter.title)
                + string.Join("\r\n", lnChapter.paragraphs.Select(p => p.OuterHtml.Replace("<br>", "").Replace("<hr>", "")))
                + GetFooter();
            string chapFilename = "chap" + nbChapInEpub + ".html";

            epub.AddXhtmlData(chapFilename, content);
            epub.AddNavPoint(lnChapter.title, chapFilename, nbChapInEpub);

            nbChapInEpub++;
        }
Esempio n. 5
0
        public override void AddChapter(LnChapter lnChapter)
        {
            if (lnChapter.title == null)
            {
                lnChapter.title = string.Format(Globale.DEFAULT_CHAPTER_TITLE, lnChapter.chapNumber.ToString().PadLeft(3, '0'));
            }

            PdfChapter pdfChapter = new PdfChapter(lnChapter.title, lnChapter.chapNumber);

            foreach (string paragraph in lnChapter.paragraphs.ParseHtmlNodeToStringList())
            {
                pdfChapter.Add(
                    new PdfParagraph(paragraph)
                {
                    Alignment     = Element.ALIGN_JUSTIFIED,
                    SpacingBefore = 15
                });
            }

            pdfChapters.Add(pdfChapter);
        }
Esempio n. 6
0
 public abstract void AddChapter(LnChapter lnChapter);