Starting basic implementation.

This commit is contained in:
Jonathan Bernard 2011-08-23 10:08:01 -05:00
parent f65d1fc030
commit b142b9f13b
2 changed files with 57 additions and 0 deletions

6
doc/arch.rst Normal file
View File

@ -0,0 +1,6 @@
General overview of process:
1. parse
2. generate md
3. replace links
4. output

View File

@ -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] <src-file> <src-file> ...')
// 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 ->
}
}
}