diff --git a/doc/arch.rst b/doc/arch.rst new file mode 100644 index 0000000..477bd75 --- /dev/null +++ b/doc/arch.rst @@ -0,0 +1,6 @@ +General overview of process: + +1. parse +2. generate md +3. replace links +4. output diff --git a/src/com/jdblabs/jlp/JLPMain.groovy b/src/com/jdblabs/jlp/JLPMain.groovy new file mode 100644 index 0000000..f0a43d7 --- /dev/null +++ b/src/com/jdblabs/jlp/JLPMain.groovy @@ -0,0 +1,51 @@ +package com.jdblabs.jlp + +public class JLPMain { + + public static void main(String args[]) { + + JLPMain inst = new JLPMain() + + // create command-line parser + CliBuilder cli = new CliBuilder( + usage: 'jlp [options] ...') + + // define options + cli.h('Print this help information.', longOpt: 'help', required: false) + + // parse options + def opts = cli.parse(args) + + // display help if requested + if (opts.h) { + cli.usage() + return } + + Map documentContext = [ docs: [:] ] + + // get files passed in + def filenames = opts.getArgs() + def files = filenames.collect { new File(if) } + + // -------- parse input -------- // + files.inject(documentContext) { docContext, file -> + inst.parse(new File(file), docContext) } + + // -------- generate output -------- // + } + + public void parse(File inputFile, Map docCtx) { + def currentDocBlock + def thisDoc = [ blocks:[] ] + + String docName = inputFile.name.substring( + 0, inputFile.name.lastIndexOf('.')) + + docCtx.docs[docName] = thisDoc + + inputFile.eachLine { line, lineNum -> + + } + } + +}