All Downloads are FREE. Search and download functionalities are using the official Maven repository.

confluencemavenplugin.Markdown Maven / Gradle / Ivy

Go to download

Enables you to maintain confluence pages whitin your code and update a confluence space when your are ready to do that.

There is a newer version: 1.0.3
Show newest version
package confluencemavenplugin;

import java.io.*;

import org.apache.commons.io.*;

import com.github.rjeschke.txtmark.Processor;

public class Markdown {

	private String text;
	private File file;

	public Markdown(String text) {
		this.text = text;
		this.file = null;
	}
	
	public Markdown(File file) throws FileNotFoundException, IOException {
		this(IOUtils.toString(new FileReader(file)));
		this.file = file;
	}

	public String toHtml() {
		return Processor.process(text);
	}
	
	public void toHtmlFile(File directory) throws IOException {
		toHtmlFile(directory, FilenameUtils.getBaseName(file.getName()) + ".html");
	}

	public void toHtmlFile(File directory, String filename) throws IOException {
		File html = new File(directory, filename);
		Writer writer = new FileWriter(html);
		IOUtils.write(toHtml(), writer);
		writer.close();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy