Package br.com.caelum.tubaina

Examples of br.com.caelum.tubaina.Chapter


      }
    }

    IntroductionChunk intro = new IntroductionChunk(new ChunkSplitter(resources, "all").splitChunks(introduction));

    return new Chapter(title, intro, sections, resources);
  }
View Full Code Here


      if (introductionMatcher.find())
        introduction = introductionMatcher.group(1);
     
      content = content.substring(introduction.length());

      Chapter chapter = new ChapterBuilder(title, introduction, content).build();
      chapters.add(chapter);
     
    }
   
    return chapters;
View Full Code Here

    @Test
    public void shouldBuildBookParts() throws Exception {
        String partOneText = "[part \"part one\"]";
        String partTwoText = "[part \"part two\"]";
        Chapter first = new ChapterBuilder("first", "introduction",
                "[section test]\nchpater 1 text", 1, sectionsManager).build();
        Chapter second = new ChapterBuilder("second", "introduction",
                "[section test]\nchpater 2 text", 2, sectionsManager).build();
        Chapter third = new ChapterBuilder("third", "introduction",
                "[section test]\nchpater 3 text", 3, sectionsManager).build();
        List<BookPart> bookParts = new BookPartsBuilder(sectionsManager).addPartFrom(partOneText)
                .addChaptersToLastAddedPart(Arrays.asList(first)).addPartFrom(partTwoText)
                .addChaptersToLastAddedPart(Arrays.asList(second, third)).build();
View Full Code Here

   
    @Test
    public void shouldBuildBookPartsWithIllustration() throws Exception {
        String partOneText = "[part \"part one\" illustration=resources/image.png]";
        String partTwoText = "[part \"part two\"]";
        Chapter first = new ChapterBuilder("first", "introduction",
                "[section test]\nchpater 1 text", 1, sectionsManager).build();
        Chapter second = new ChapterBuilder("second", "introduction",
                "[section test]\nchpater 2 text", 2, sectionsManager).build();
        Chapter third = new ChapterBuilder("third", "introduction",
                "[section test]\nchpater 3 text", 3, sectionsManager).build();
        List<BookPart> bookParts = new BookPartsBuilder(sectionsManager).addPartFrom(partOneText)
                .addChaptersToLastAddedPart(Arrays.asList(first)).addPartFrom(partTwoText)
                .addChaptersToLastAddedPart(Arrays.asList(second, third)).build();
       
View Full Code Here

    }

    @Test
    public void shouldBuildBookPartsWithIntro() throws Exception {
        String partOneText = "[part \"part one\"]\n introduction text";
        Chapter first = new ChapterBuilder("first", "introduction",
                "[section \"test\"]\nchpater 1 text", 1, sectionsManager).build();
        Chapter second = new ChapterBuilder("second", "introduction",
                "[section \"test\"]\nchpater 2 text", 2, sectionsManager).build();

        List<BookPart> bookParts = new BookPartsBuilder(sectionsManager).addPartFrom(partOneText)
                .addChaptersToLastAddedPart(Arrays.asList(first, second)).build();
        assertEquals("introduction text", bookParts.get(0).getIntroductionText());
View Full Code Here

        + "[section secao um]\n" + "conteudo da secao um";
    builder.addReaderFromString(content);
    Book b = builder.build();
    module.inject(b);
    BookPart bookPart = b.getParts().get(0);
    Chapter chapter = bookPart.getChapters().get(0);
    assertEquals("capitulo um", chapter.getTitle());
    assertEquals("secao um", chapter.getSections().get(0).getTitle());

    assertEquals("parte um", bookPart.getTitle());
    assertEquals(true, bookPart.isPrintable());
  }
View Full Code Here

        + "[section secao um]\n" + "conteudo da secao um";
    builder.addReaderFromStrings(Arrays.asList(chapter0, chapter1));
    Book b = builder.build();
    module.inject(b);
    BookPart bookPart = b.getParts().get(1);
    Chapter chapter = bookPart.getChapters().get(0);
    assertEquals("capitulo um", chapter.getTitle());
    assertEquals("secao um", chapter.getSections().get(0).getTitle());

    assertEquals("parte um", bookPart.getTitle());
    assertEquals(true, bookPart.isPrintable());

    assertEquals(false, b.getParts().get(0).isPrintable());
View Full Code Here

        + "introducao do capitulo um\n" + "[section secao um]\n" + "conteudo da secao um";
    builder.addReaderFromString(content);
    Book b = builder.build();
    module.inject(b);
    BookPart bookPart = b.getParts().get(0);
    Chapter chapter = bookPart.getChapters().get(0);
    assertEquals("capitulo um", chapter.getTitle());
    assertEquals("secao um", chapter.getSections().get(0).getTitle());

    assertEquals("parte um", bookPart.getTitle());
    assertEquals(true, bookPart.isPrintable());
  }
View Full Code Here

        + "[section secao um]\n" + "conteudo da secao um";
    builder.addReaderFromString(content);
    Book b = builder.build();
    module.inject(b);
    BookPart bookPart = b.getParts().get(0);
    Chapter chapter = bookPart.getChapters().get(0);
    assertEquals("capitulo um", chapter.getTitle());
    assertEquals("label of this chapter", chapter.getLabel());
  }
View Full Code Here

                "<h3.*>\\W*\\d+\\.1 - section one\\W*</h3>"));
    }

    @Test
    public void testGenerateANotPrintablePartWithChapters() {
        Chapter chapter = createChapter("chapter title", "introduction",
                "[section section one] section content");
        List<BookPart> bookParts = new BookPartsBuilder(new SectionsManager()).addChaptersToLastAddedPart(
                Arrays.asList(chapter)).build();
        BookPart part = bookParts.get(0);
        new KindleModule().inject(part);
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.