Compare commits
7 Commits
v1.7
...
d937e591cc
Author | SHA1 | Date | |
---|---|---|---|
d937e591cc | |||
477233d020 | |||
928c1ebe3b | |||
e5cd57414e | |||
e1226642cd | |||
71975412d2 | |||
fcdf829cb1 |
31
README.md
31
README.md
@ -59,12 +59,12 @@ This project is in its infancy and some of the larger goals are still unmet:
|
|||||||
|
|
||||||
### Control and Flow
|
### Control and Flow
|
||||||
|
|
||||||
* [JLPMain](jlp://jlp.jdb-labs.com/JLPMain)
|
* [JLPMain](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/JLPMain.groovy.html)
|
||||||
|
|
||||||
The entry point to the JLP executable. Parses the command line input and
|
The entry point to the JLP executable. Parses the command line input and
|
||||||
sets up the processor.
|
sets up the processor.
|
||||||
|
|
||||||
* [Processor](jlp://jlp.jdb-labs.com/Processor)
|
* [Processor](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/Processor)
|
||||||
|
|
||||||
The Processor processes one batch of input files to create a set of output files.
|
The Processor processes one batch of input files to create a set of output files.
|
||||||
It holds the intermediate state needed by the generators and coordinates the
|
It holds the intermediate state needed by the generators and coordinates the
|
||||||
@ -72,39 +72,36 @@ This project is in its infancy and some of the larger goals are still unmet:
|
|||||||
processor only generates HTML documentation and will likely be renamed in
|
processor only generates HTML documentation and will likely be renamed in
|
||||||
the future to reflect this.
|
the future to reflect this.
|
||||||
|
|
||||||
* [JLPBaseGenerator](jlp://jlp.jdb-labs.com/JLPBaseGenerator)
|
* [JLPBaseGenerator](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/JLPBaseGenerator)
|
||||||
|
|
||||||
The Generator processes one input file. It parses the AST for the input file
|
The Generator processes one input file. It parses the AST for the input file
|
||||||
and emits the final documentation for the file. JLPBaseGenerator
|
and emits the final documentation for the file. JLPBaseGenerator
|
||||||
implementations are expected to be tightly coupled to Processor
|
implementations are expected to be tightly coupled to Processor
|
||||||
implementations.
|
implementations.
|
||||||
|
|
||||||
* [LiterateMarkdownGenerator](jlp://jlp.jdb-labs.com/LiterateMarkdownGenerator)
|
* [LiterateMarkdownGenerator](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/LiterateMarkdownGenerator)
|
||||||
|
|
||||||
This implemetation of JLPBaseGenerator generates literate-style
|
This implemetation of JLPBaseGenerator generates literate-style
|
||||||
documentation (as opposed to API-style), using [Markdown] to format the
|
documentation (as opposed to API-style), using
|
||||||
|
[Markdown](http://daringfireball.net/projects/markdown/) to format the
|
||||||
documentation blocks.
|
documentation blocks.
|
||||||
|
|
||||||
[Markdown]: http://daringfireball.net/projects/markdown/
|
|
||||||
|
|
||||||
### Parsing
|
### Parsing
|
||||||
|
|
||||||
* [JLPParser](jlp://jlp.jdb-labs.com/JLPParser)
|
* [JLPParser](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/JLPParser)
|
||||||
|
|
||||||
A very simple interface for parsing JLP input.
|
A very simple interface for parsing JLP input.
|
||||||
|
|
||||||
* [JLPPegParser](jlp://jlp.jdb-labs.com/JLPPegParser)
|
* [JLPPegParser](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/JLPPegParser)
|
||||||
|
|
||||||
A [PEG parser] implemented using the [parboiled] library. This is the
|
A [PEG parser](http://en.wikipedia.org/wiki/Parsing_expression_grammar)
|
||||||
default source code parser. It is able to parse JLP documentation but leaves
|
implemented using the [parboiled](http://www.parboiled.org) library. This
|
||||||
code unparsed. It can be parameterized to fit the differing documentation
|
is the default source code parser. It is able to parse JLP documentation
|
||||||
styles of source languages.
|
but leaves code unparsed. It can be parameterized to fit the differing
|
||||||
|
documentation styles of source languages.
|
||||||
[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)
|
* [SourceFile](https://jdbernard.github.io/jlp/doc/src/com/jdblabs/jlp/JLPPegParserSourceFile)
|
||||||
|
|
||||||
The top-level AST element. This represents a source file.
|
The top-level AST element. This represents a source file.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<project name="Jonathan's Literate Programming" basedir="." default="release">
|
<project name="Jonathan's Literate Programming" basedir="." default="release">
|
||||||
|
|
||||||
<import file="jdb-build-1.9.xml"/>
|
<import file="jdb-build-1.10.xml"/>
|
||||||
<property environment="env"/>
|
<property environment="env"/>
|
||||||
<property file="project.properties"/>
|
<property file="project.properties"/>
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
Implement working internal links using ``jlp://`` schema.
|
|
||||||
=========================================================
|
|
@ -1 +0,0 @@
|
|||||||
Implement language-specific code parsing and comprehension.
|
|
@ -1 +0,0 @@
|
|||||||
Support multi-line block comments.
|
|
@ -1 +0,0 @@
|
|||||||
Make the parser configurable with respect to comment delimiters.
|
|
@ -1,16 +0,0 @@
|
|||||||
Fix delimited doc block behavior.
|
|
||||||
=================================
|
|
||||||
|
|
||||||
Delimited doc blocks require that the start token be the first non-space token
|
|
||||||
on the line it is on and that the end token be on it's own line. This is not in
|
|
||||||
line with the general nature of delimited comment blocks, which do not place
|
|
||||||
any restrictions on what comes before the start delimiter or after the end
|
|
||||||
delimiter.
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
========= ===================
|
|
||||||
Created : 2011-09-07
|
|
||||||
Resolved: 2011-12-25T23:26:07
|
|
||||||
========= ===================
|
|
@ -1,25 +0,0 @@
|
|||||||
Internal links are not smart enough about cross-file linking.
|
|
||||||
=============================================================
|
|
||||||
|
|
||||||
There are two main problems with internal linking as it works now:
|
|
||||||
|
|
||||||
1. The links are resolved relative to the directory of the file being processed
|
|
||||||
when they should be resolved relative to the root output directory.
|
|
||||||
|
|
||||||
For example, consider ``@org id1`` defined in ``dir/file1.src``, then
|
|
||||||
referenced in ``dir/file2.src`` in this manner: ``[link](jlp://id1``. The
|
|
||||||
url written in ``dir/file2.html`` is ``dir/file1.html#id1``. However, when
|
|
||||||
the page is viewed, this url is interpreted relative to the directory of the
|
|
||||||
current page. So if the docs live at ``file:///docs`` then the url will
|
|
||||||
resolve to ``file:///docs/dir/dir/file1.src#id1`` instead of
|
|
||||||
``file:///docs/dir/file1.html#id1``.
|
|
||||||
|
|
||||||
2. The links do substitute the ``html`` suffix to the file names in place of the
|
|
||||||
files' suffixes. In the above example note that the actual urls end in
|
|
||||||
``.src`` like the original input files, but the expected url ends in
|
|
||||||
``.html``.
|
|
||||||
|
|
||||||
========= ==========
|
|
||||||
Created: 2011-09-08
|
|
||||||
Resolved: 2011-09-09
|
|
||||||
========= ==========
|
|
@ -1,12 +0,0 @@
|
|||||||
Encode Documentation and Code Characters for HTML
|
|
||||||
=================================================
|
|
||||||
|
|
||||||
The text of the documentation and the code is not being HTML encoded,
|
|
||||||
so some characters (most notably `<`) are causing wierd display issues
|
|
||||||
in the resulting output.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
======== ===================
|
|
||||||
Created: 2011-12-26T00:43:44
|
|
||||||
======== ===================
|
|
@ -1,12 +0,0 @@
|
|||||||
`Include` Directive.
|
|
||||||
====================
|
|
||||||
|
|
||||||
Add a new directive: `include`. This directive allows the author to include
|
|
||||||
the contents of a URL inline in the documentation (can be an internal JLP
|
|
||||||
reference URL).
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
======== ===================
|
|
||||||
Created: 2011-12-29T11:23:52
|
|
||||||
======== ===================
|
|
@ -1,12 +0,0 @@
|
|||||||
Automatically create document `org` directives.
|
|
||||||
===============================================
|
|
||||||
|
|
||||||
The author should not have to create an `org` directive at the top of every file.
|
|
||||||
This should be done for him during parsing. Ideally the system would be smart enough
|
|
||||||
to notice if he has defined an `org` at the top of a file and use that if he has.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
======== ===================
|
|
||||||
Created: 2012-01-04T17:12:59
|
|
||||||
======== ===================
|
|
@ -1,12 +0,0 @@
|
|||||||
Add a `title` directive for titling documents.
|
|
||||||
==============================================
|
|
||||||
|
|
||||||
Return to defaulting a title for each document. Instead of the internal document id use
|
|
||||||
something more reasonable, like the filename without the path and without the extension.
|
|
||||||
A new attribute `title` could allow the author to override this value.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
======== ===================
|
|
||||||
Created: 2012-01-04T17:14:26
|
|
||||||
======== ===================
|
|
@ -1,18 +0,0 @@
|
|||||||
Modify `org` behavior to include simple anchors.
|
|
||||||
================================================
|
|
||||||
|
|
||||||
Currently JLP supports at most one `org` directive per block which identifies the block.
|
|
||||||
It would be useful to support multiple `org` directives within a block, particularly
|
|
||||||
when there is a large block that may have many interesting internal targets. Maybe the
|
|
||||||
`org` directive should be handled differently when it is used multiple times within a
|
|
||||||
block. This would be discovered in the generator parse phase and we could change the
|
|
||||||
LinkAnchor type at that time. During the parse phase we emit the new type of anchors
|
|
||||||
as `<a id="link-name"/>` into the document. We would also change our search for block
|
|
||||||
ids to inly look for the single-occurance type of `orgs`.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
========= ===================
|
|
||||||
Created : 2012-01-05T11:40:35
|
|
||||||
Resolved: 2012-01-06T14:32:46
|
|
||||||
========= ===================
|
|
32
doc/jlp-notes
Normal file
32
doc/jlp-notes
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
Implement special-purpose Markdown processor. This way it can be intelligent
|
||||||
|
about connecting seperated doc-blocks that should be a unit, can process thing
|
||||||
|
like link references on a whole-document basis, and can be more intelligent
|
||||||
|
about indentation, line numbers for doc blocks.
|
||||||
|
|
||||||
|
Consider building up common, generic AST nodes for code parsers so that most of
|
||||||
|
the work of integrating a new language is already done in the common code,
|
||||||
|
leaving only the very specific behavior to be implemented. For starters:
|
||||||
|
|
||||||
|
CodeUnit
|
||||||
|
: Supports things like classes in OOP, modules, even files if that is a
|
||||||
|
common organizational unit for the language.
|
||||||
|
|
||||||
|
Callable
|
||||||
|
: Supports methods, functions, subroutines, closures, anything that takes
|
||||||
|
parameters and returns a value.
|
||||||
|
|
||||||
|
Structure
|
||||||
|
: May be a useful abstraction for pure data objects (Erlang record
|
||||||
|
definitions, C/C++ unions and structs, enums, etc.).
|
||||||
|
|
||||||
|
Make Directives completely configurable. Do not hard-code an enumeration of
|
||||||
|
possible values. Make the actual directive text just another field on the class.
|
||||||
|
This allows language-specific implementations to extend the built-in Directives
|
||||||
|
easily. It also has the benefit of allowing unknown or invalid directives
|
||||||
|
through the parser without causing the source file to fail to parse. This gives
|
||||||
|
us a better way to warn the user of unknown directives. To this end it may be
|
||||||
|
good to assemble a list of defined directives at runtime, but this would not
|
||||||
|
happen in the parser itself.
|
||||||
|
|
||||||
|
Add back the @doc directive to return to private implementation notes within a
|
||||||
|
block that has so far been marked public with an @api directive.
|
@ -117,7 +117,7 @@
|
|||||||
<target name="-compile-groovy" depends="-init,-init-groovy,-lib,-lib-groovy">
|
<target name="-compile-groovy" depends="-init,-init-groovy,-lib,-lib-groovy">
|
||||||
<mkdir dir="${build.dir}/main/classes"/>
|
<mkdir dir="${build.dir}/main/classes"/>
|
||||||
<groovyc srcdir="${src.dir}/main" destdir="${build.dir}/main/classes"
|
<groovyc srcdir="${src.dir}/main" destdir="${build.dir}/main/classes"
|
||||||
includeAntRuntime="false">
|
includeAntRuntime="false" fork="true">
|
||||||
|
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="groovy.classpath"/>
|
<path refid="groovy.classpath"/>
|
||||||
@ -139,7 +139,7 @@
|
|||||||
<target name="-compile-tests-groovy" depends="-init,compile">
|
<target name="-compile-tests-groovy" depends="-init,compile">
|
||||||
<mkdir dir="${build.dir}/test/classes"/>
|
<mkdir dir="${build.dir}/test/classes"/>
|
||||||
<groovyc srcdir="${src.dir}/test" destdir="${build.dir}/test/classes"
|
<groovyc srcdir="${src.dir}/test" destdir="${build.dir}/test/classes"
|
||||||
includeAntRuntime="false">
|
includeAntRuntime="false" fork="true">
|
||||||
|
|
||||||
<classpath>
|
<classpath>
|
||||||
<path refid="groovy.classpath"/>
|
<path refid="groovy.classpath"/>
|
@ -1,7 +1,7 @@
|
|||||||
#Fri, 27 Jan 2012 18:21:58 -0600
|
#Tue, 13 Aug 2013 08:48:43 -0500
|
||||||
name=jlp
|
name=jlp
|
||||||
version=1.7
|
version=1.7
|
||||||
build.number=24
|
build.number=25
|
||||||
lib.local=true
|
lib.local=true
|
||||||
release.dir=release
|
release.dir=release
|
||||||
main.class=com.jdblabs.jlp.JLPMain
|
main.class=com.jdblabs.jlp.JLPMain
|
||||||
|
@ -18,7 +18,7 @@ public abstract class JLPBaseGenerator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The generator works in close conjunction with a JLP Processor.
|
* The generator works in close conjunction with a JLP Processor.
|
||||||
* This tight coupling in intended for these two classes. The distiction
|
* This tight coupling is intended for these two classes. The distiction
|
||||||
* between the two classes is scope. The Processor class is concerned with
|
* between the two classes is scope. The Processor class is concerned with
|
||||||
* data and behavior common to the whole documentation process whereas the
|
* data and behavior common to the whole documentation process whereas the
|
||||||
* Generator is concerned only with one file. The Generator does have
|
* Generator is concerned only with one file. The Generator does have
|
||||||
|
@ -37,19 +37,19 @@ public class JLPMain {
|
|||||||
/// : Print help information.
|
/// : Print help information.
|
||||||
cli.h('Print this help information.', longOpt: 'help', required: false)
|
cli.h('Print this help information.', longOpt: 'help', required: false)
|
||||||
|
|
||||||
/// -o, --outputdir
|
/// -o, --outputdir <output-directory>
|
||||||
/// : Set the output directory where the documentation will be
|
/// : Set the output directory where the documentation will be
|
||||||
/// written.
|
/// written.
|
||||||
cli.o("Output directory (defaults to 'jlp-docs').",
|
cli.o("Output directory (defaults to 'jlp-docs').",
|
||||||
longOpt: 'output-dir', args: 1, argName: "output-dir",
|
longOpt: 'output-dir', args: 1, argName: "output-dir",
|
||||||
required: false)
|
required: false)
|
||||||
|
|
||||||
/// --css-file
|
/// --css-file <file>
|
||||||
/// : Specify an alternate CSS file for the output documentation.
|
/// : Specify an alternate CSS file for the output documentation.
|
||||||
cli._('Use <css-file> for the documentation css.',
|
cli._('Use <css-file> for the documentation css.',
|
||||||
longOpt: 'css-file', args: 1, required: false, argName: 'css-file')
|
longOpt: 'css-file', args: 1, required: false, argName: 'css-file')
|
||||||
|
|
||||||
/// --relative-path-root
|
/// --relative-path-root <root-directory>
|
||||||
/// : Override the current working directory. This is useful if you
|
/// : Override the current working directory. This is useful if you
|
||||||
/// are invoking jlp remotely, or if the current working directory
|
/// are invoking jlp remotely, or if the current working directory
|
||||||
/// is incorrectly set by the executing environment.
|
/// is incorrectly set by the executing environment.
|
||||||
|
@ -513,8 +513,8 @@ public class JLPPegParser extends BaseParser<Object> implements JLPParser {
|
|||||||
/// ### Utility/Helper Functions. ###
|
/// ### Utility/Helper Functions. ###
|
||||||
/// ---------------------------------
|
/// ---------------------------------
|
||||||
|
|
||||||
/// The `popAs` functions exist primarily to make the parser rules more readable
|
/// The `popAs` functions exist primarily to make the parser rules more
|
||||||
/// by providing shortcuts for common casts.
|
/// readable by providing shortcuts for common casts.
|
||||||
String popAsString() { return (String) pop(); }
|
String popAsString() { return (String) pop(); }
|
||||||
Integer popAsInt() { return (Integer) pop(); }
|
Integer popAsInt() { return (Integer) pop(); }
|
||||||
|
|
||||||
@ -524,8 +524,8 @@ public class JLPPegParser extends BaseParser<Object> implements JLPParser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* #### addToDocBlock
|
* #### addToDocBlock
|
||||||
* Add the given block to the [`SourceFile`] node expected to be at the top of
|
* Add the given block to the [`SourceFile`] node expected to be at the top
|
||||||
* the parser value stack.
|
* of the parser value stack.
|
||||||
*
|
*
|
||||||
* [`SourceFile`]: jlp://jlp.jdb-labs.com/ast/SourceFile
|
* [`SourceFile`]: jlp://jlp.jdb-labs.com/ast/SourceFile
|
||||||
*/
|
*/
|
||||||
@ -535,8 +535,8 @@ public class JLPPegParser extends BaseParser<Object> implements JLPParser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* #### addToDocBlock
|
* #### addToDocBlock
|
||||||
* Add the given [`Directive`] or [`DocText`] to the [`DocBlock`] expected to be at the
|
* Add the given [`Directive`] or [`DocText`] to the [`DocBlock`] expected
|
||||||
* top of the parser value stack.
|
* to be at the top of the parser value stack.
|
||||||
*
|
*
|
||||||
* [`Directive`]: jlp://jlp.jdb-labs.com/ast/Directive
|
* [`Directive`]: jlp://jlp.jdb-labs.com/ast/Directive
|
||||||
* [`DocText`]: jlp://jlp.jdb-labs.com/ast/DocText
|
* [`DocText`]: jlp://jlp.jdb-labs.com/ast/DocText
|
||||||
|
@ -130,10 +130,8 @@ public class Processor {
|
|||||||
def relPath = getRelativeFilepath(inputRoot, file)
|
def relPath = getRelativeFilepath(inputRoot, file)
|
||||||
def pathParts = relPath.split('/') as List
|
def pathParts = relPath.split('/') as List
|
||||||
|
|
||||||
// Get our file type.
|
|
||||||
def fileType = sourceTypeForFile(file)
|
|
||||||
|
|
||||||
// We will skip binary files and files we know nothing about.
|
// We will skip binary files and files we know nothing about.
|
||||||
|
def fileType = sourceTypeForFile(file)
|
||||||
if (fileType == 'binary' || fileType == 'unknown') { return; }
|
if (fileType == 'binary' || fileType == 'unknown') { return; }
|
||||||
|
|
||||||
// Start with just the file name.
|
// Start with just the file name.
|
||||||
|
Reference in New Issue
Block a user