Package br.com.caelum.tubaina

Examples of br.com.caelum.tubaina.Book


  @Test
  public void testGeneratorWithNonExistantImage() throws TubainaException, IOException {
    BookBuilder builder = builder("Com imagens");
    builder.addReaderFromString("[chapter qualquer um]\n" + "[img src/test/resources/someImage.gif]");
    try {
      Book b = builder.build();
      new LatexModule().inject(b);
      generator.generate(b, temp);
      Assert.fail("Should raise an exception");
    } catch (TubainaException t) {
      // OK
View Full Code Here


    File path = new File("src/test/resources");
    ResourceLocator.initialize(path);
    BookBuilder builder = builder("Do Instrutor");
    builder.addReaderFromString("[chapter com notas]\n" + "Algo mais no capitulo.\n\n[note]uma nota para o instrutor[/note]");
    Book b = builder.build();
    new LatexModule(true, true).inject(b);
    new LatexGenerator(parser, data).generate(b, temp);
    File texFile = new File(temp, "teste.tex");
    Assert.assertTrue("Book file should exist", texFile.exists());
   
View Full Code Here

  @Test
  public void testGeneratorForStudentTextbook() throws IOException {
    BookBuilder builder = builder("Do Aluno");
    builder.addReaderFromString("[chapter com notas]\n" + "[note]uma nota para o instrutor[/note]");
    Book b = builder.build();
    new LatexModule(false, true).inject(b);
    generator.generate(b, temp);
    File texFile = new File(temp, "teste.tex");
    Assert.assertTrue("Book file should exist", texFile.exists());
    Assert.assertFalse("Should not have INSTRUCTOR TEXTBOOK on the first page",
View Full Code Here

    List<AfcFile> chapterReaders = new ArrayList<AfcFile>();
    String imagePath = "introImage.jpg";
    List<AfcFile> introductionReaders = Arrays.asList(new AfcFile(new StringReader("[chapter intro]\n[img "
        + imagePath + "]"), "file from string"));
    builder.addAllReaders(chapterReaders, introductionReaders);
    Book b = builder.build();
    new LatexModule().inject(b);

    generator.generate(b, temp);
    File copied = new File(temp, imagePath);
View Full Code Here

    @Test
    public void testGenerateBookWithoutSections() {
        List<String> chapters = Arrays.asList("[chapter primeiro] um conteúdo", "[chapter segundo] um conteúdo");
        builder.addReaderFromStrings(chapters);
        Book b = builder.build();
        BookToTOC generator = new BookToTOC();
        List<String> dirTree = new ArrayList<String>();
        dirTree.add("livro");
        dirTree.add("livro/01-primeiro");
        dirTree.add("livro/02-segundo");
View Full Code Here

    @Test
    public void testGenerateBookWithSections() {
        builder.addReaderFromString("[chapter unico] um conteúdo \n" +
                "[section uma] lalala \n" +
                "[section duas] lalala \n");
        Book b = builder.build();
        BookToTOC generator = new BookToTOC();
       

        List<String> dirTree = new ArrayList<String>();
        dirTree.add("livro");
View Full Code Here

    public void shouldGenerateBookWithIntroduction() {
        List<String> agradecimentos = Arrays.asList("[chapter agradecimentos]\n" "um agradecimento\n");
        List<String> prefacio = Arrays.asList("[chapter prefacio]\n" "um prefacio\n");
        builder.addAllReadersOfNonNumberedFromStrings(agradecimentos);
        builder.addAllReadersOfNonNumberedFromStrings(prefacio);
        Book b = builder.build();
        module.inject(b);
        BookToTOC generator = new BookToTOC();
        List<String> dirTree = new ArrayList<String>();
        dirTree.add("livro");
        String toc = generator.generateTOC(b, cfg, dirTree, null).toString();
View Full Code Here

        List<String> chapters = Arrays.asList("[chapter ::primeiro::] um conteúdo", "[chapter **segundo**] um conteúdo");
        builder.addAllReadersOfNonNumberedFromStrings(agradecimentos);
        builder.addAllReadersOfNonNumberedFromStrings(prefacio);
        builder.addReaderFromStrings(chapters);
       
        Book b = builder.build();
        module.inject(b);
        BookToTOC generator = new BookToTOC();
       
        List<String> dirTree = new ArrayList<String>();
        dirTree.add("livro");
View Full Code Here

        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);
       
    String string = singleHtmlChapterGenerator.generateSingleHtmlChapter(book, c).toString();
       
View Full Code Here

    @Test
    public void testGeneratorWithCorrectImages() throws IOException {
      BookBuilder builder = builder("com-imagens");
        builder.addReaderFromString("[chapter qualquer um]\n"
                + "[img baseJpgImage.jpg]");
        Book b = builder.build();
        new HtmlModule().inject(b);

        generator.generate(b, temp);
        File images = new File(temp, "com-imagens/qualquer-um/");
        Assert.assertTrue(images.exists());
View Full Code Here

TOP

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

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.