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,4 +1,6 @@
# Overview
# J Literate Programming
## Overview
*Jonathan's Literate Programming* is my take on literate programming.
This project grew out of a desire for a documentation system that:
@ -53,9 +55,9 @@ This project is in its infancy and some of the larger goals are still unmet:
JLP processing directives would allow the author to specify which is
intended on a file (or block?) level.
# Project Architecture
## Project Architecture
## Control and Flow
### Control and Flow
* [JLPMain](jlp://jlp.jdb-labs.com/JLPMain)
@ -85,7 +87,7 @@ This project is in its infancy and some of the larger goals are still unmet:
[Markdown]: http://daringfireball.net/projects/markdown/
## Parsing
### Parsing
* [JLPParser](jlp://jlp.jdb-labs.com/JLPParser)
@ -101,7 +103,7 @@ This project is in its infancy and some of the larger goals are still unmet:
[PEG parser]: http://en.wikipedia.org/wiki/Parsing_expression_grammar
[parboiled]: http://www.parboiled.org
## Abstract Syntax Tree
### Abstract Syntax Tree
* [SourceFile](jlp://jlp.jdb-labs.com/ast/SourceFile)

View File

@ -1,7 +1,7 @@
#Fri, 06 Jan 2012 12:20:57 -0600
#Tue, 10 Jan 2012 10:00:20 -0600
name=jlp
version=1.5
build.number=6
version=1.6
build.number=5
lib.local=true
release.dir=release
main.class=com.jdblabs.jlp.JLPMain

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