X-Git-Url: https://git.wpitchoune.net/gitweb/?p=asciidoctor_to_rss.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2FMain.java;fp=src%2Fmain%2Fjava%2FMain.java;h=0000000000000000000000000000000000000000;hp=64b4d8820b65610dd7cbb20e25e957fc9d881dc5;hb=f40278e6f437943d1d4eee937a8203dff046cb28;hpb=76238691b4a28a8d248bad0f17245ac273ff3ace diff --git a/src/main/java/Main.java b/src/main/java/Main.java deleted file mode 100644 index 64b4d88..0000000 --- a/src/main/java/Main.java +++ /dev/null @@ -1,171 +0,0 @@ -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Properties; -import java.util.logging.Logger; - -import org.asciidoctor.Asciidoctor; -import org.asciidoctor.Asciidoctor.Factory; -import org.asciidoctor.ast.DocumentHeader; - -import com.rometools.rome.feed.synd.SyndContentImpl; -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import com.rometools.rome.feed.synd.SyndFeed; -import com.rometools.rome.feed.synd.SyndFeedImpl; -import com.rometools.rome.io.FeedException; -import com.rometools.rome.io.SyndFeedOutput; - -public class Main { - private static final Logger LOG = Logger.getLogger(Main.class.getSimpleName()); - private static final String KEY_HTML_HEADER_FILE = "html.header.file"; - private static final String KEY_FEED_TITLE = "feed.title"; - - private static File toHTMLFile(File dir, File adoc) { - int idx; - String name; - - name = adoc.getName(); - - idx = name.lastIndexOf('.'); - - if (idx >= 0) - name = name.substring(0, idx); - - return new File(dir, name + ".html"); - } - - private static SyndContentImpl toSyndContentImpl(String description) { - SyndContentImpl ret; - - ret = new SyndContentImpl(); - ret.setType("text/html"); - ret.setValue(description); - - return ret; - } - - private static String getFeedTitle(Properties props) { - return props.getProperty(KEY_FEED_TITLE); - } - - private static void appendHTMLHeader(StringBuffer sb, Properties props) - throws IOException { - String fileName; - File f; - - fileName = props.getProperty(KEY_HTML_HEADER_FILE); - - if (fileName == null) { - LOG.info(KEY_HTML_HEADER_FILE + " is not set"); - return ; - } - - f = new File(fileName); - - sb.append("
\n"); - sb.append(new String(Files.readAllBytes(f.toPath()), - StandardCharsets.UTF_8)); - sb.append("\n"); - } - - public static void main(String[] args) throws FileNotFoundException, IOException, FeedException { - File inDir, html, outDir; - File[] adocs; - StringWriter desc; - Asciidoctor asciidoctor; - SyndFeed feed; - Properties props; - ArrayList