// Path: src/main/java/com/aestasit/markdown/slidery/configuration/Configuration.java
// public interface Configuration extends ConfigurationBuilder, ConfigurationReader {
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/configuration/ConfigurationBuilder.java
// public interface ConfigurationBuilder {
// 
//   void validate() throws IllegalStateException;
// 
//   ConfigurationBuilder configuration(ConfigurationReader config);
// 
//   ConfigurationBuilder clear();
// 
//   ConfigurationBuilder clearInputFiles();
// 
//   ConfigurationBuilder clearStaticFiles();
// 
//   ConfigurationBuilder clearTemplateFiles();
// 
//   ConfigurationBuilder clearSnippets();
// 
//   ConfigurationBuilder inputFile(File inputFile);
// 
//   ConfigurationBuilder inputFile(File inputFile, Transition transition);
// 
//   ConfigurationBuilder inputFile(File inputFile, Styling styling);
// 
//   ConfigurationBuilder inputFile(File inputFile, Transition transition, Styling styling);
// 
//   ConfigurationBuilder snippet(Location location, String snippet);
// 
//   ConfigurationBuilder defaultTransition(Transition transition);
// 
//   ConfigurationBuilder defaultStyling(Styling styling);
// 
//   ConfigurationBuilder inputFiles(Collection<File> inputFiles);
// 
//   Configuration encoding(String encoding);
// 
//   ConfigurationBuilder encoding(Charset encoding);
// 
//   ConfigurationBuilder templateFile(File templateFile);
// 
//   ConfigurationBuilder templateFile(String targetName, File templateFile);
// 
//   ConfigurationBuilder templateFiles(Collection<File> templateFile);
// 
//   ConfigurationBuilder staticFile(File staticFile);
// 
//   ConfigurationBuilder staticFiles(Collection<File> staticFiles);
// 
//   ConfigurationBuilder staticFile(String relativePath, File staticFile);
// 
//   ConfigurationBuilder staticFiles(String relativePath, Collection<File> staticFiles);
// 
//   Configuration outputFile(File outputFile);
// 
//   // Meta-data
//   ConfigurationBuilder author(String name);
// 
//   ConfigurationBuilder company(String name);
// 
//   ConfigurationBuilder title(String title);
// 
//   ConfigurationBuilder description(String description);
// 
//   ConfigurationBuilder date(Date date);
// 
//   ConfigurationBuilder currentDate();
// 
//   ConfigurationBuilder logo(File file);
// 
//   ConfigurationBuilder incrementalLists();
// 
//   ConfigurationBuilder incrementalLists(boolean state);
// 
//   ConfigurationBuilder includeNotes();
// 
//   ConfigurationBuilder includeNotes(boolean state);
// 
//   ConfigurationBuilder excludeNotes();
// 
//   ConfigurationBuilder stripHtml();
// 
//   ConfigurationBuilder stripHtml(boolean state);   
//   
//   // Styling
//   ConfigurationBuilder theme(String name);
// 
//   ConfigurationBuilder font(String name, URL link);
// 
//   ConfigurationBuilder font(String name);
// 
//   ConfigurationBuilder backgroundColor(String color);
// 
//   ConfigurationBuilder fontColor(String color);
// 
//   ConfigurationBuilder color(String ref, String color);
// 
//   ConfigurationBuilder option(String name, String value);
// 
//   // Rules
//   ConfigurationBuilder transitionRule(String selector, String rule);
// 
//   ConfigurationBuilder stylingRule(String selector, String rule);
// 
//   ConfigurationBuilder splitOutput();
// 
//   ConfigurationBuilder splitOutput(boolean state);
// 
//   ConfigurationBuilder verbose();
// 
//   ConfigurationBuilder verbose(boolean state);
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/configuration/Location.java
// public enum Location {
// 
//   HEAD_START, HEAD_END, BODY_START, SLIDES_START, SLIDES_END, BODY_END
// 
// }


import static org.apache.commons.io.FileUtils.readFileToString;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
import groovy.text.SimpleTemplateEngine;
import groovy.text.Template;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.groovy.control.CompilationFailedException;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.select.Elements;
import com.aestasit.markdown.slidery.configuration.Configuration;
import com.aestasit.markdown.slidery.configuration.ConfigurationBuilder;
import com.aestasit.markdown.slidery.configuration.Location;
import com.uwyn.jhighlight.renderer.Renderer;
import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
  }

  private void renderSyntaxHighlightingHtml(final Document slidesDocument, final Configuration config) {
    for (Element code : slidesDocument.select("code")) {
      Charset encoding = config.getInputEncoding();
      ByteArrayInputStream input = new ByteArrayInputStream(code.text().getBytes(encoding));
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      String className = code.className();
      if (StringUtils.isBlank(className)) {
        className = "java";
      }
      Renderer renderer = XhtmlRendererFactory.getRenderer(className);
      if (renderer != null) {
        try {
          renderer.highlight("slidery", input, out, encoding.name(), true);
          code.html(new String(out.toByteArray(), encoding));
          code.select("br").remove();
          removeComments(code);
          code.html(code.html().trim());
          Element parent = code.parent();
          if (parent.tagName() == "pre") {
            parent.addClass("code");
          }
        } catch (IOException e) {
          // TODO: Handle exception
        }
      }
    }
  }

// Path: src/main/java/com/aestasit/markdown/slidery/configuration/Configuration.java
// public interface Configuration extends ConfigurationBuilder, ConfigurationReader {
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/configuration/ConfigurationBuilder.java
// public interface ConfigurationBuilder {
// 
//   void validate() throws IllegalStateException;
// 
//   ConfigurationBuilder configuration(ConfigurationReader config);
// 
//   ConfigurationBuilder clear();
// 
//   ConfigurationBuilder clearInputFiles();
// 
//   ConfigurationBuilder clearStaticFiles();
// 
//   ConfigurationBuilder clearTemplateFiles();
// 
//   ConfigurationBuilder clearSnippets();
// 
//   ConfigurationBuilder inputFile(File inputFile);
// 
//   ConfigurationBuilder inputFile(File inputFile, Transition transition);
// 
//   ConfigurationBuilder inputFile(File inputFile, Styling styling);
// 
//   ConfigurationBuilder inputFile(File inputFile, Transition transition, Styling styling);
// 
//   ConfigurationBuilder snippet(Location location, String snippet);
// 
//   ConfigurationBuilder defaultTransition(Transition transition);
// 
//   ConfigurationBuilder defaultStyling(Styling styling);
// 
//   ConfigurationBuilder inputFiles(Collection<File> inputFiles);
// 
//   Configuration encoding(String encoding);
// 
//   ConfigurationBuilder encoding(Charset encoding);
// 
//   ConfigurationBuilder templateFile(File templateFile);
// 
//   ConfigurationBuilder templateFile(String targetName, File templateFile);
// 
//   ConfigurationBuilder templateFiles(Collection<File> templateFile);
// 
//   ConfigurationBuilder staticFile(File staticFile);
// 
//   ConfigurationBuilder staticFiles(Collection<File> staticFiles);
// 
//   ConfigurationBuilder staticFile(String relativePath, File staticFile);
// 
//   ConfigurationBuilder staticFiles(String relativePath, Collection<File> staticFiles);
// 
//   Configuration outputFile(File outputFile);
// 
//   // Meta-data
//   ConfigurationBuilder author(String name);
// 
//   ConfigurationBuilder company(String name);
// 
//   ConfigurationBuilder title(String title);
// 
//   ConfigurationBuilder description(String description);
// 
//   ConfigurationBuilder date(Date date);
// 
//   ConfigurationBuilder currentDate();
// 
//   ConfigurationBuilder logo(File file);
// 
//   ConfigurationBuilder incrementalLists();
// 
//   ConfigurationBuilder incrementalLists(boolean state);
// 
//   ConfigurationBuilder includeNotes();
// 
//   ConfigurationBuilder includeNotes(boolean state);
// 
//   ConfigurationBuilder excludeNotes();
// 
//   ConfigurationBuilder stripHtml();
// 
//   ConfigurationBuilder stripHtml(boolean state);   
//   
//   // Styling
//   ConfigurationBuilder theme(String name);
// 
//   ConfigurationBuilder font(String name, URL link);
// 
//   ConfigurationBuilder font(String name);
// 
//   ConfigurationBuilder backgroundColor(String color);
// 
//   ConfigurationBuilder fontColor(String color);
// 
//   ConfigurationBuilder color(String ref, String color);
// 
//   ConfigurationBuilder option(String name, String value);
// 
//   // Rules
//   ConfigurationBuilder transitionRule(String selector, String rule);
// 
//   ConfigurationBuilder stylingRule(String selector, String rule);
// 
//   ConfigurationBuilder splitOutput();
// 
//   ConfigurationBuilder splitOutput(boolean state);
// 
//   ConfigurationBuilder verbose();
// 
//   ConfigurationBuilder verbose(boolean state);
// 
// }
// 
// Path: src/main/java/com/aestasit/markdown/slidery/configuration/Location.java
// public enum Location {
// 
//   HEAD_START, HEAD_END, BODY_START, SLIDES_START, SLIDES_END, BODY_END
// 
// }


// Path: src/main/java/com/aestasit/markdown/slidery/converters/TextTemplateConverter.java
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
import groovy.text.SimpleTemplateEngine;
import groovy.text.Template;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.codehaus.groovy.control.CompilationFailedException;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.select.Elements;
import com.aestasit.markdown.slidery.configuration.Configuration;
import com.aestasit.markdown.slidery.configuration.ConfigurationBuilder;
import com.aestasit.markdown.slidery.configuration.Location;
import com.uwyn.jhighlight.renderer.Renderer;
import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;

  }

  private void renderSyntaxHighlightingHtml(final Document slidesDocument, final Configuration config) {
    for (Element code : slidesDocument.select("code")) {
      Charset encoding = config.getInputEncoding();
      ByteArrayInputStream input = new ByteArrayInputStream(code.text().getBytes(encoding));
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      String className = code.className();
      if (StringUtils.isBlank(className)) {
        className = "java";
      }
      Renderer renderer = XhtmlRendererFactory.getRenderer(className);
      if (renderer != null) {
        try {
          renderer.highlight("slidery", input, out, encoding.name(), true);
          code.html(new String(out.toByteArray(), encoding));
          code.select("br").remove();
          removeComments(code);
          code.html(code.html().trim());
          Element parent = code.parent();
          if (parent.tagName() == "pre") {
            parent.addClass("code");
          }
        } catch (IOException e) {
          // TODO: Handle exception
        }
      }
    }
  }

  private void removeComments(Node parent) {