Package br.com.caelum.tubaina.builder

Examples of br.com.caelum.tubaina.builder.BookBuilder.build()


    BookBuilder builder = new BookBuilder(bookName);
    builder.addAll(readers);

    Book b = null;
    try {
      b = builder.build(showNotes);
    } catch (TubainaException e) {
      if (dontCare) {
        LOG.warn(e);
      } else {
        e.printStackTrace();
View Full Code Here


    BookBuilder builder = builder("livro");
    builder.addReaderFromString("[chapter     O que é java?   ]\n" + "texto da seção\n"
        + "[section Primeira seção]\n" + "texto da prim seção\n" + "[section Segunda seção]\n"
        + "texto da segunda seção\n\n");
    builder.addReaderFromString("[chapter Introdução]\n" + "Algum texto de introdução\n");
    book = builder.build();
    temp = new File("tmp");
    temp.mkdir();
  }

  @After
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 LatexModule().inject(b);

    generator.generate(b, temp);

    File[] images = temp.listFiles(new FilenameFilter() {
View Full Code Here

  @Test
  public void testGeneratorWithDoubledImage() throws TubainaException, IOException {
    BookBuilder builder = builder("Com imagens");
    builder.addReaderFromString("[chapter qualquer um]\n" + "[img baseJpgImage.jpg]\n[img baseJpgImage.jpg]");

    Book b = builder.build();
    new LatexModule().inject(b);
    try {
      generator.generate(b, temp);
    } catch (TubainaException t) {
      Assert.fail("Should not raise an exception");
View Full Code Here

  @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

    BookBuilder builder = new BookBuilder(bookName, sectionsManager);
    builder.addAllReaders(afcFiles, introductionAfcFiles);

    Book b = null;
    try {
      b = builder.build();
    } catch (TubainaException e) {
      if (dontCare) {
        LOG.warn(e);
      } else {
        throw e;
View Full Code Here

              + " %%mysql<::db%% dentro :");
     
      builder.addReaderFromString("[chapter Introdução]\n"
          + "Algum texto de introdução\n");
     
      return builder.build();
    }

    @Test
    public void shouldCreateTheBookFileWithEscapedSemicolon() throws Exception {
      Book book = createsSimpleEscapedColonBook("livro");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.