Changed docId algorithm.

* Updated documentation to add manual titles.
* Reworked the way `docIds` are chosen. Now instead of the full relative path
  name we use just the file, or enough of the relative pathname to uniquely
  identify the file.
This commit is contained in:
Jonathan Bernard
2012-01-10 10:11:35 -06:00
parent a86b55726f
commit 6bc3235802
18 changed files with 69 additions and 33 deletions

View File

@ -1,6 +1,7 @@
/**
* # JLPBaseGenerator
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp

View File

@ -1,6 +1,7 @@
/**
* @author Jonathan Bernard
* @copyright JDB Labs 2010-2011
* # JLPMain
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp
@ -18,7 +19,7 @@ import org.slf4j.LoggerFactory
*/
public class JLPMain {
public static final String VERSION = "1.5"
public static final String VERSION = "1.6"
private static Logger log = LoggerFactory.getLogger(JLPMain.class)

View File

@ -1,6 +1,7 @@
/**
* # JLPParser
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp;

View File

@ -1,3 +1,9 @@
/**
* # JLPPegParser
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
* @org jlp.jdb-labs.com/JLPPegParser
*/
package com.jdblabs.jlp;
import com.jdblabs.jlp.ast.*;
@ -10,10 +16,6 @@ import org.parboiled.Rule;
import org.parboiled.annotations.*;
import org.parboiled.parserunners.ReportingParseRunner;
/**
*
* @org jlp.jdb-labs.com/JLPPegParser
*/
@BuildParseTree
public class JLPPegParser extends BaseParser<Object> implements JLPParser {

View File

@ -1,6 +1,7 @@
/**
* # LinkAnchor
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp

View File

@ -1,6 +1,7 @@
/**
* # LiterateMarkdownGenerator
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp

View File

@ -1,6 +1,7 @@
/**
* # MarkdownParser
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp

View File

@ -1,6 +1,7 @@
/**
* @author Jonathan Bernard
* @copyright JDB Labs 2010-2011
* # Processor
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp
@ -108,9 +109,26 @@ public class Processor {
shFile.delete()
/// * Create the processing context for each input file. We are using
/// the relative path of the file as the document id.
/// the name of the file (including the extension) as the id. If there
/// is more than one file with the same name we will include the
/// file's parent directory as well.
inputFiles.each { file ->
def docId = getRelativeFilepath(inputRoot, file)
// Get the relative path as path elements.
def relPath = getRelativeFilepath(inputRoot, file)
def pathParts = relPath.split('/') as List
// Start with just the file name.
def docId = pathParts.pop()
log.trace("New target document: '{}' from source: '{}'",
docId, relPath)
// As long as the current id is taken, add the next parent directory
// to the id.
while(docs[docId] != null) { docId = pathParts.pop() + '/' + docId }
// Finally create the TargetDoc item.
docs[docId] = new TargetDoc(
sourceDocId: docId,
sourceFile: file,

View File

@ -1,6 +1,7 @@
/**
* # TargetDoc
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp

View File

@ -1,6 +1,7 @@
/**
* # ASTNode
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp.ast

View File

@ -1,6 +1,7 @@
/**
* # Block
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp.ast

View File

@ -1,6 +1,7 @@
/**
* # CodeBlock
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
* @org jlp.jdb-labs.com/ast/CodeBlock
*/
package com.jdblabs.jlp.ast

View File

@ -1,6 +1,7 @@
/**
* # Directive
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp.ast

View File

@ -1,6 +1,7 @@
/**
* # DocBlock
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp.ast

View File

@ -1,6 +1,7 @@
/**
* # DocText
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright JDB Labs 2010-2011
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp.ast

View File

@ -1,6 +1,7 @@
/**
* @author Jonathan Bernard
* @copyright JDB Labs 2010-2011
* # SourceFile
* @author Jonathan Bernard (jdb@jdb-labs.com)
* @copyright 2011-2012 [JDB Labs LLC](http://jdb-labs.com)
*/
package com.jdblabs.jlp.ast