Support for style.css via refactored common.html included in all files

This commit is contained in:
Mark DePristo 2011-07-24 15:42:39 -04:00
parent d0ab6bf7a9
commit 5e0fe2d0f9
3 changed files with 21 additions and 14 deletions

View File

@ -30,8 +30,10 @@ import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import sun.misc.IOUtils;
import java.io.*;
import java.util.*;
@ -40,6 +42,8 @@ import java.util.*;
*
*/
public class GATKDoclet extends ResourceBundleExtractorDoclet {
final protected static File SETTINGS_DIR = new File("settings/helpTemplates");
final protected static File DESTINATION_DIR = new File("testdoc");
final protected static Logger logger = Logger.getLogger(GATKDoclet.class);
public static class DocWorkUnit implements Comparable<DocWorkUnit> {
@ -128,12 +132,16 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
this.rootDoc = rootDoc;
try {
// basic setup
DESTINATION_DIR.mkdirs();
FileUtils.copyFile(new File(SETTINGS_DIR + "/style.css"), new File(DESTINATION_DIR + "/style.css"));
/* ------------------------------------------------------------------- */
/* You should do this ONLY ONCE in the whole application life-cycle: */
Configuration cfg = new Configuration();
// Specify the data source where the template files come from.
cfg.setDirectoryForTemplateLoading(new File("settings/helpTemplates/"));
cfg.setDirectoryForTemplateLoading(SETTINGS_DIR);
// Specify how templates will see the data-model. This is an advanced topic...
cfg.setObjectWrapper(new DefaultObjectWrapper());
@ -200,7 +208,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
Template temp = cfg.getTemplate("generic.index.template.html");
/* Merge data-model with template */
Writer out = new OutputStreamWriter(new FileOutputStream(new File("testdoc/index.html")));
Writer out = new OutputStreamWriter(new FileOutputStream(new File(DESTINATION_DIR + "/index.html")));
try {
temp.process(groupIndexData(indexData), out);
out.flush();
@ -259,7 +267,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
Template temp = cfg.getTemplate(unit.handler.getTemplateName(unit.classDoc));
// Merge data-model with template
File outputPath = new File("testdoc/" + unit.filename);
File outputPath = new File(DESTINATION_DIR + "/" + unit.filename);
try {
Writer out = new OutputStreamWriter(new FileOutputStream(outputPath));
temp.process(unit.forTemplate, out);

View File

@ -1,5 +1,7 @@
<#include "common.html"/>
<#macro emitGroup group>
<table border="1" cellpadding="2">
<table border="1" cellpadding="2" width="100%">
<h2>${group.name}</h2>
<p>
${group.summary}
@ -20,9 +22,7 @@
</#macro>
<html>
<head>
<title>GATK documentation index</title>
</head>
<@makeHeader title="GATK documentation index"/>
<body>
<h1>GATK documentation index</h1>
<#list groups as group>

View File

@ -1,3 +1,5 @@
<#include "common.html"/>
<#macro argumentlist name myargs>
<#if myargs?size != 0>
<tr><th colspan="4" align="left">${name}</th></tr>
@ -39,12 +41,9 @@
</#if>
</#list>
</#macro>
<html>
<head>
<title>${name} documentation</title>
</head>
<@makeHeader title="${name} documentation"/>
<body>
<h1>${name}<h1>
<h2>Brief summary</h2>
@ -60,7 +59,7 @@
<#if arguments.all?size != 0>
<hr>
<h2>Feature specific arguments</h2>
<table border="1" cellpadding="2">
<table border="1" cellpadding="2" width="100%">
<tr>
<th>Name</th>
<th>Synonyms</th>
@ -90,10 +89,10 @@
<#-- This class is related to other documented classes via sub/super relationships -->
<#if relatedDocs?size != 0>
<hr>
<h2>Related capabilities</h2>
<@relatedByType name="Superclasses" type="superclass"/>
<@relatedByType name="Subclasses" type="subclass"/>
<hr>
</#if>
<#-- List all of the -->