Package br.com.caelum.tubaina.bibliography

Source Code of br.com.caelum.tubaina.bibliography.HtmlBibliographyGenerator

package br.com.caelum.tubaina.bibliography;

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

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

public class HtmlBibliographyGenerator implements BibliographyGenerator {

    private final Configuration config;

    public HtmlBibliographyGenerator(Configuration freeMarkerConfig) {
        this.config = freeMarkerConfig;
    }

    public String generateTextOf(Bibliography bibliography) {
      if (bibliography.isEmpty()) {
        return "";
      }
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("bibliography", bibliography);
        map.put("sanitizer", new HtmlSanitizer());
        return new FreemarkerProcessor(config).process(map, "bibliography.ftl").toString();
       
    }

}
TOP

Related Classes of br.com.caelum.tubaina.bibliography.HtmlBibliographyGenerator

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.