Fixed link behavior.

* Removed the automatic document table heading based on the document id.
* Fixed the way 'absolute' links were resolved in `Processor`. A leading `/` for
  a link passed into `Processor.resolveLink` really means "resolve as if I am
  starting from the documentation root."
* Moved the default logging configuration out of the final jar path. This is to
  help with environments that have multiple projects in the same classpath and
  therefore may have multiple `logback.groovy` configurations loading.
* Tweaked CSS.
This commit is contained in:
Jonathan Bernard 2012-01-04 18:11:43 -06:00
parent f0ce2c7174
commit 051cd54dcd
7 changed files with 45 additions and 20 deletions

12
doc/issues/0008fn5.rst Normal file
View File

@ -0,0 +1,12 @@
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
======== ===================

12
doc/issues/0009fn5.rst Normal file
View File

@ -0,0 +1,12 @@
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
======== ===================

View File

@ -1,7 +1,7 @@
#Tue, 03 Jan 2012 14:03:49 -0600 #Wed, 04 Jan 2012 18:05:01 -0600
name=jlp name=jlp
version=1.4a version=1.4
build.number=18 build.number=11
lib.local=true lib.local=true
release.dir=release release.dir=release
main.class=com.jdblabs.jlp.JLPMain main.class=com.jdblabs.jlp.JLPMain

View File

@ -45,7 +45,6 @@ td.docs, th.docs {
.docs tt, .docs code { .docs tt, .docs code {
background: #f8f8ff; background: #f8f8ff;
border: 1px solid #dedede; border: 1px solid #dedede;
font-size: 12px;
padding: 0 0.2em; } padding: 0 0.2em; }
.docs table { .docs table {
@ -60,7 +59,6 @@ td.code, th.code {
font-size: 14px; } font-size: 14px; }
pre, tt, code { pre, tt, code {
font-size: 12px;
line-height: 18px; line-height: 18px;
font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
margin: 0; padding: 0; } margin: 0; padding: 0; }

View File

@ -120,10 +120,6 @@ public class LiterateMarkdownGenerator extends JLPBaseGenerator {
<body> <body>
<div id="container"> <div id="container">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<thead><tr>
<th class="docs"><h1>${escape(processor.currentDocId)}</h1></th>
<th class="code"/>
</tr></thead>
<tbody>""") <tbody>""")
/// Emit all of the blocks in the body of the html file. /// Emit all of the blocks in the body of the html file.
@ -179,17 +175,20 @@ public class LiterateMarkdownGenerator extends JLPBaseGenerator {
/** Add all the directives. We are also assigning priorities here that /** Add all the directives. We are also assigning priorities here that
* we will use along with the line numbers to sort the elements. Our * we will use along with the line numbers to sort the elements. Our
* goal is to preserve the order of doc blocks and doc-block-like * goal is to preserve the order of doc blocks and doc-block-like
* elements (examples, api documentation, etc.) while pushing orgs, * elements (examples, api documentation, etc.) while pushing orgs
* authorship and other directives to the top. */ * and potentially other directives to the top. We used to re-order
* authorship and copyright tags but stopped: in literate-style docs
* the author should have control over their placement and in api-style
* docs we are chopping the whole block up anyways (and this is not
* that code). Given that the only item being re-ordered is *orgs*,
* which do not print anyways, it may be better to cut this out and
* just emit the blocks in their original order, or sort by line number
* only. */
emitQueue = docBlock.directives.collect { directive -> emitQueue = docBlock.directives.collect { directive ->
def queueItem = [lineNumber: directive.lineNumber, value: directive] def queueItem = [lineNumber: directive.lineNumber, value: directive]
switch(directive.type) { switch(directive.type) {
case DirectiveType.Api: queueItem.priority = 50; break case DirectiveType.Org: queueItem.priority = 0; break
case DirectiveType.Author: queueItem.priority = 10; break default: queueItem.priority = 50; break }
case DirectiveType.Copyright: queueItem.priority = 11; break
case DirectiveType.Example: queueItem.priority = 50; break
case DirectiveType.Include: queueItem.priority = 50; break
case DirectiveType.Org: queueItem.priority = 0; break }
return queueItem } return queueItem }

View File

@ -194,7 +194,7 @@ public class Processor {
* : Return the link as-is. * : Return the link as-is.
* *
* *absolute path (starts with `/`)* * *absolute path (starts with `/`)*
* : Returns the link resolved directly against the output root. * : Returns the link resolved against the output root.
* *
* *relative path (no leading `/`)* * *relative path (no leading `/`)*
* : Returns the link resolved against the `TargetDoc` passed in. * : Returns the link resolved against the `TargetDoc` passed in.
@ -233,12 +233,16 @@ public class Processor {
case ~/^\w+:.*/: return link case ~/^\w+:.*/: return link
/// Absolute link, resolve relative to the output root. /// Absolute link, resolve relative to the output root.
case ~/^\/.*/: return outputRoot.canonicalPath + link case ~/^\/.*/:
/// Our link should be the relative path (if needed) plus the
/// link without the leading `/`.
def relPath = getRelativeFilepath(targetDoc.sourceFile, inputRoot)
return (relPath ? "${relPath}/" : "") + link[1..-1]
/// Relative link, resolve using the output root and the source /// Relative link, resolve using the output root and the source
/// document relative to the input root. /// document relative to the input root.
default: default:
def relPath = getRelativePath(inputRoot, targetDoc.sourceFile) def relPath = getRelativeFilepath(inputRoot, targetDoc.sourceFile)
return "${relPath}/${link}" }} return "${relPath}/${link}" }}
/** /**