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

View File

@ -120,10 +120,6 @@ public class LiterateMarkdownGenerator extends JLPBaseGenerator {
<body>
<div id="container">
<table cellpadding="0" cellspacing="0">
<thead><tr>
<th class="docs"><h1>${escape(processor.currentDocId)}</h1></th>
<th class="code"/>
</tr></thead>
<tbody>""")
/// 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
* 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
* elements (examples, api documentation, etc.) while pushing orgs,
* authorship and other directives to the top. */
* elements (examples, api documentation, etc.) while pushing orgs
* 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 ->
def queueItem = [lineNumber: directive.lineNumber, value: directive]
switch(directive.type) {
case DirectiveType.Api: queueItem.priority = 50; break
case DirectiveType.Author: queueItem.priority = 10; 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 }
case DirectiveType.Org: queueItem.priority = 0; break
default: queueItem.priority = 50; break }
return queueItem }

View File

@ -194,7 +194,7 @@ public class Processor {
* : Return the link as-is.
*
* *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 `/`)*
* : Returns the link resolved against the `TargetDoc` passed in.
@ -233,12 +233,16 @@ public class Processor {
case ~/^\w+:.*/: return link
/// 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
/// document relative to the input root.
default:
def relPath = getRelativePath(inputRoot, targetDoc.sourceFile)
def relPath = getRelativeFilepath(inputRoot, targetDoc.sourceFile)
return "${relPath}/${link}" }}
/**