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
version=1.4a
build.number=18
version=1.4
build.number=11
lib.local=true
release.dir=release
main.class=com.jdblabs.jlp.JLPMain

View File

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

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}" }}
/**