forked from grails/grails-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.1 stream of documentation added to trunk
git-svn-id: https://svn.codehaus.org/grails/trunk@8957 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
- Loading branch information
graeme
committed
Mar 24, 2009
1 parent
92dfa0f
commit 412536d
Showing
456 changed files
with
19,384 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bin/ | ||
checkout/ | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module relativePaths="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/groovy" isTestSource="false" /> | ||
<excludeFolder url="file://$MODULE_DIR$/bin" /> | ||
<excludeFolder url="file://$MODULE_DIR$/output" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="module-library"> | ||
<library name="Radeox"> | ||
<CLASSES> | ||
<root url="jar://$MODULE_DIR$/lib/oro-2.0.8.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/lib/commons-logging-1.1.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/lib/radeox.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES> | ||
<root url="file://$MODULE_DIR$/../../radeox/src/java" /> | ||
</SOURCES> | ||
</library> | ||
</orderEntry> | ||
<orderEntry type="module-library"> | ||
<library name="Groovy"> | ||
<CLASSES> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/groovy-1.1-rc-1-SNAPSHOT.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/ant-1.7.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/junit-3.8.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/maven-artifact-ant-2.0.4-dep.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/jsp-api-2.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/mx4j-3.0.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/servlet-api-2.4.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/mockobjects-core-0.09.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/asm-util-2.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/asm-tree-2.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/ant-junit-1.7.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/gant-0.3.4-SNAPSHOT.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/commons-logging-1.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/ant-launcher-1.7.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/xstream-1.2.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/jline-0.9.91.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/antlr-2.7.6.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/commons-cli-1.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/asm-analysis-2.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/ivy-1.4.1.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/bsf-2.4.0.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/asm-2.2.jar!/" /> | ||
<root url="jar://$MODULE_DIR$/../../groovy/target/install/lib/xpp3_min-1.1.3.4.O.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES /> | ||
</library> | ||
</orderEntry> | ||
<orderEntryProperties /> | ||
</component> | ||
</module> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
import org.radeox.engine.BaseRenderEngine; | ||
import org.radeox.api.engine.*; | ||
import org.radeox.engine.context.BaseInitialRenderContext | ||
import org.grails.doc.DocEngine; | ||
|
||
def ant = new AntBuilder() | ||
|
||
GRAILS_HOME = "checkout/grails" | ||
CONTEXT_PATH = DocEngine.CONTEXT_PATH | ||
SOURCE_FILE = DocEngine.SOURCE_FILE | ||
|
||
props = new Properties() | ||
new File("./resources/doc.properties").withInputStream {input -> | ||
props.load(input) | ||
} | ||
new File("${GRAILS_HOME}/build.properties").withInputStream {input -> | ||
props.load(input) | ||
} | ||
|
||
title = props.title | ||
version = props."grails.version" | ||
authors = props.author | ||
|
||
def compare = [compare: {o1, o2 -> | ||
def idx1 = o1.name[0..o1.name.indexOf(' ') - 1] | ||
def idx2 = o2.name[0..o2.name.indexOf(' ') - 1] | ||
def nums1 = idx1.split(/\./).findAll { it.trim() != ''}*.toInteger() | ||
def nums2 = idx2.split(/\./).findAll { it.trim() != ''}*.toInteger() | ||
// pad out with zeros to ensure accurate comparison | ||
while (nums1.size() < nums2.size()) { | ||
nums1 << 0 | ||
} | ||
while (nums2.size() < nums1.size()) { | ||
nums2 << 0 | ||
} | ||
def result = 0 | ||
for (i in 0..<nums1.size()) { | ||
result = nums1[i].compareTo(nums2[i]) | ||
if (result != 0) break | ||
} | ||
result | ||
}, | ||
equals: { false }] as Comparator | ||
|
||
files = new File("./src/guide").listFiles().findAll { it.name.endsWith(".gdoc") }.sort(compare) | ||
context = new BaseInitialRenderContext(); | ||
context.set(CONTEXT_PATH, "..") | ||
|
||
ant = new AntBuilder() | ||
cache = [:] | ||
|
||
engine = new DocEngine(context) | ||
templateEngine = new groovy.text.SimpleTemplateEngine() | ||
context.setRenderEngine(engine) | ||
|
||
book = [:] | ||
for (f in files) { | ||
def chapter = f.name[0..-6] | ||
book[chapter] = f | ||
} | ||
|
||
toc = new StringBuffer() | ||
soloToc = new StringBuffer() | ||
fullContents = new StringBuffer() | ||
chapterContents = new StringBuffer() | ||
chapterTitle = null | ||
|
||
void writeChapter(String title, StringBuffer content) { | ||
new File("output/guide/${title}.html").withWriter { | ||
template.make(title: title, content: content.toString()).writeTo(it) | ||
} | ||
content.delete(0, content.size()) // clear buffer | ||
} | ||
|
||
ant.mkdir(dir: "output/guide") | ||
ant.mkdir(dir: "output/guide/pages") | ||
new File("resources/style/guideItem.html").withReader {reader -> | ||
template = templateEngine.createTemplate(reader) | ||
|
||
for (entry in book) { | ||
//println "Generating documentation for $entry.key" | ||
def title = entry.key | ||
def level = 0 | ||
def matcher = (title =~ /^(\S+?)\.? /) // drops last '.' of "xx.yy. " | ||
if (matcher.find()) { | ||
level = matcher.group(1).split(/\./).size() - 1 | ||
} | ||
def margin = level * 10 | ||
|
||
if (level == 0) { | ||
if (chapterTitle) // initially null, to collect sections | ||
writeChapter(chapterTitle, chapterContents) | ||
|
||
chapterTitle = title // after previous used to write prev chapter | ||
|
||
soloToc << "<div class=\"tocItem\" style=\"margin-left:${margin}px\"><a href=\"${chapterTitle}.html\">${chapterTitle}</a></div>" | ||
} | ||
else { | ||
soloToc << "<div class=\"tocItem\" style=\"margin-left:${margin}px\"><a href=\"${chapterTitle}.html#${entry.key}\">${entry.key}</a></div>" | ||
} // level 0=h1, (1..n)=h2 | ||
|
||
|
||
def hLevel = level == 0 ? 1 : 2 | ||
def header = "<h$hLevel><a name=\"${title}\">${title}</a></h$hLevel>" | ||
|
||
context.set(SOURCE_FILE, entry.value) | ||
context.set(CONTEXT_PATH, "..") | ||
def body = engine.render(entry.value.text, context) | ||
|
||
toc << "<div class=\"tocItem\" style=\"margin-left:${margin}px\"><a href=\"#${title}\">${title}</a></div>" | ||
fullContents << header << body | ||
chapterContents << header << body | ||
|
||
new File("output/guide/pages/${title}.html").withWriter { | ||
template.make(title: title, content: body).writeTo(it) | ||
} | ||
} | ||
} | ||
if (chapterTitle) // write final chapter collected (if any seen) | ||
writeChapter(chapterTitle, chapterContents) | ||
|
||
|
||
ant.mkdir(dir: "output") | ||
ant.mkdir(dir: "output/img") | ||
ant.mkdir(dir: "output/css") | ||
ant.mkdir(dir: "output/ref") | ||
|
||
ant.copy(file: "resources/style/index.html", todir: "output") | ||
ant.copy(todir: "output/img") { | ||
fileset(dir: "resources/img") | ||
} | ||
ant.copy(todir: "output/css") { | ||
fileset(dir: "resources/css") | ||
} | ||
ant.copy(todir: "output/ref") { | ||
fileset(dir: "resources/style/ref") | ||
} | ||
|
||
vars = [ | ||
title: props.title, | ||
subtitle: props.subtitle, | ||
footer: props.footer, | ||
authors: props.authors, | ||
version: props."grails.version", | ||
copyright: props.copyright, | ||
|
||
toc: toc.toString(), | ||
body: fullContents.toString() | ||
] | ||
|
||
new File("./resources/style/layout.html").withReader {reader -> | ||
template = templateEngine.createTemplate(reader) | ||
new File("output/guide/single.html").withWriter {out -> | ||
template.make(vars).writeTo(out) | ||
} | ||
vars.toc = soloToc | ||
vars.body = "" | ||
new File("output/guide/index.html").withWriter {out -> | ||
template.make(vars).writeTo(out) | ||
} | ||
} | ||
|
||
menu = new StringBuffer() | ||
files = new File("src/ref").listFiles().toList().sort() | ||
reference = [:] | ||
new File("resources/style/referenceItem.html").withReader {reader -> | ||
template = templateEngine.createTemplate(reader) | ||
for (f in files) { | ||
if (f.directory && !f.name.startsWith(".")) { | ||
def section = f.name | ||
reference."${section}" = [:] | ||
menu << "<h1 class=\"menuTitle\">${f.name}</h1>" | ||
new File("output/ref/${f.name}").mkdirs() | ||
def textiles = f.listFiles().findAll { it.name.endsWith(".gdoc")}.sort() | ||
def usageFile = new File("src/ref/${f.name}.gdoc") | ||
if (usageFile.exists()) { | ||
def data = usageFile.text | ||
reference."${section}".usage = data | ||
context.set(SOURCE_FILE, usageFile.name) | ||
context.set(CONTEXT_PATH, "../..") | ||
def contents = engine.render(data, context) | ||
new File("output/ref/${f.name}/Usage.html").withWriter {out -> | ||
template.make(content: contents).writeTo(out) | ||
} | ||
menu << "<div class=\"menuUsageItem\"><a href=\"${f.name}/Usage.html\" target=\"mainFrame\">Usage</a></div>" | ||
} | ||
for (txt in textiles) { | ||
def name = txt.name[0..-6] | ||
menu << "<div class=\"menuItem\"><a href=\"${f.name}/${name}.html\" target=\"mainFrame\">${name}</a></div>" | ||
def data = txt.text | ||
reference."${section}"."$name" = data | ||
context.set(SOURCE_FILE, txt.name) | ||
context.set(CONTEXT_PATH, "../..") | ||
def contents = engine.render(data, context) | ||
//println "Generating reference item: ${name}" | ||
new File("output/ref/${f.name}/${name}.html").withWriter {out -> | ||
template.make(content: contents).writeTo(out) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
vars.menu = menu | ||
new File("./resources/style/menu.html").withReader {reader -> | ||
template = templateEngine.createTemplate(reader) | ||
new File("output/ref/menu.html").withWriter {out -> | ||
template.make(vars).writeTo(out) | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
println "Done. Look at output/index.html" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module relativePaths="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="false"> | ||
<output url="file://bin" /> | ||
<exclude-output /> | ||
<output-test url="file://bin" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
<excludeFolder url="file://$MODULE_DIR$/bin" /> | ||
<excludeFolder url="file://$MODULE_DIR$/checkout" /> | ||
<excludeFolder url="file://$MODULE_DIR$/dist" /> | ||
<excludeFolder url="file://$MODULE_DIR$/out" /> | ||
<excludeFolder url="file://$MODULE_DIR$/output" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="module-library"> | ||
<library> | ||
<CLASSES> | ||
<root url="jar://$APPLICATION_HOME_DIR$/lib/javaee.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES /> | ||
</library> | ||
</orderEntry> | ||
<orderEntryProperties /> | ||
</component> | ||
</module> | ||
|
Oops, something went wrong.