Package br.com.caelum.tubaina.parser.html

Source Code of br.com.caelum.tubaina.parser.html.BookToTOC

package br.com.caelum.tubaina.parser.html;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import br.com.caelum.tubaina.Book;
import br.com.caelum.tubaina.template.FreemarkerProcessor;
import br.com.caelum.tubaina.util.HtmlSanitizer;
import br.com.caelum.tubaina.util.VersionGenerator;
import freemarker.template.Configuration;

public class BookToTOC {

  public StringBuffer generateTOC(final Book b, final Configuration cfg, final List<String> dirTree) {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("name", b.getName());
    map.put("chapters", b.getChapters());
    map.put("dirTree", dirTree);
    map.put("textbookVersion", new VersionGenerator().generate());
    map.put("sanitizer", new HtmlSanitizer());

    return new FreemarkerProcessor(cfg).process(map, "html/toc.ftl");
  }
}
TOP

Related Classes of br.com.caelum.tubaina.parser.html.BookToTOC

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.