Package br.com.caelum.tubaina

Examples of br.com.caelum.tubaina.Chapter


        introductionChaptersToKindle = new IntroductionChaptersToKindle(parser, cfg, bookRoot);
    }

    @Test
    public void shouldGenerateIntroductionChapters() throws Exception {
        Chapter preface = new ChapterBuilder("preface", "label""preface text", "", 0, true, new SectionsManager()).build();
        new KindleModule().inject(preface);
        String introductionChapters = introductionChaptersToKindle.generateIntroductionChapters(
                Arrays.asList(preface)).toString();
        assertTrue(introductionChapters.contains("<h2>preface</h2>"));
        assertTrue(introductionChapters.contains("preface text"));
View Full Code Here


        return tokens.length - 1;
    }

    @Test
    public void testGeneratePartWithChapters() {
        Chapter chapter = createChapter("chapter title", "introduction",
                "[section section one] section content");
        List<BookPart> bookParts = new BookPartsBuilder(new SectionsManager()).addPartFrom("[part \"parte 1\"]")
                .addChaptersToLastAddedPart(Arrays.asList(chapter)).build();
        BookPart part = bookParts.get(0);
        new KindleModule().inject(part);
View Full Code Here

        dirTree.add("livro/01-capitulo/01-primeira");
        dirTree.add("livro/01-capitulo/02-segunda");

        SingleHtmlChapterGenerator singleHtmlChapterGenerator = new SingleHtmlChapterGenerator(parser, cfg, new ArrayList<String>());
       
        Chapter c = createChapter("introducao", "[section primeira] conteudo da primeira "
                + "\n[section segunda] conteudo da segunda");
       
        Book book = new BookBuilder("some name", new SectionsManager()).build();
        new HtmlModule().inject(book);
        new HtmlModule().inject(c);
View Full Code Here

    return tokens.length - 1;
  }

  @Test
  public void testGenerateChapterWithSections() {
    Chapter chapter = createChapter("chapter title", "introduction", "[section section one] section content");
    new KindleModule().inject(chapter);
   
    String generatedContent = chapterToString.generateKindleHtmlChapter(chapter).toString();
    assertEquals(2, countOccurrences(generatedContent, "<div class='referenceable'>"));
    assertEquals(1, countOccurrences(generatedContent, "<h2.*>\\d+ - chapter title</h2>"));
View Full Code Here

                offset = matcher.end(2);
            }
        }

        IntroductionChunk intro = new IntroductionChunk(new ChunkSplitter(resources, "all", sectionsManager).splitChunks(introduction));
        return new Chapter(title, label, intro, sections, resources, chapterNumber, introductionChapter);
    }
View Full Code Here

            String introduction = extractIntroduction(content);

            content = content.substring(introduction.length());

            Chapter chapter = new ChapterBuilder(title, label, introduction, content, chapterNumber, introductionChapter, sectionsManager).build();
            chapters.add(chapter);
            sectionsManager.nextChapter();
            if (!introductionChapter)
                chapterNumber++;
        }
View Full Code Here

TOP

Related Classes of br.com.caelum.tubaina.Chapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.