diff options
author | Scott Main <smain@google.com> | 2009-11-20 10:41:49 -0800 |
---|---|---|
committer | Scott Main <smain@google.com> | 2009-11-20 10:41:49 -0800 |
commit | 2fa99f1dd62389ceda5d0c6b5360c40be8f0b87c (patch) | |
tree | 95620ce5bcc8c760863bd3862f31106266806d8f /tools/droiddoc/src/SampleCode.java | |
parent | d920ec8354940653e6cf53a1540360cca3bcc5f7 (diff) | |
download | build-2fa99f1dd62389ceda5d0c6b5360c40be8f0b87c.zip build-2fa99f1dd62389ceda5d0c6b5360c40be8f0b87c.tar.gz build-2fa99f1dd62389ceda5d0c6b5360c40be8f0b87c.tar.bz2 |
droiddoc change: revise the sample code generating script so that
all the source code pages are NOT generated for the offline version
of the docs (only show source in html for online docs).
This won't work until a companion change from framwork/base/Android.mk
is submitted (but shouldn't break the build).
Change-Id: I06c404540870071c2a5a8aa460e156506fd975cb
Diffstat (limited to 'tools/droiddoc/src/SampleCode.java')
-rw-r--r-- | tools/droiddoc/src/SampleCode.java | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/tools/droiddoc/src/SampleCode.java b/tools/droiddoc/src/SampleCode.java index e2283bd..1f00be2 100644 --- a/tools/droiddoc/src/SampleCode.java +++ b/tools/droiddoc/src/SampleCode.java @@ -38,13 +38,14 @@ public class SampleCode { } } - public void write() { + public void write(boolean offlineMode) { File f = new File(mSource); if (!f.isDirectory()) { System.out.println("-samplecode not a directory: " + mSource); return; } - writeDirectory(f, mDest); + if (offlineMode) writeIndexOnly(f, mDest); + else writeDirectory(f, mDest); } public static String convertExtension(String s, String ext) { @@ -99,10 +100,8 @@ public class SampleCode { // write the index page int i; - HDF hdf = DroidDoc.makeHDF(); - hdf.setValue("page.title", dir.getName() + " - " + mTitle); - hdf.setValue("projectTitle", mTitle); + HDF hdf = writeIndex(dir); hdf.setValue("subdir", subdir); i=0; for (String d: dirs) { @@ -115,15 +114,32 @@ public class SampleCode { hdf.setValue("files." + i + ".href", convertExtension(f, ".html")); i++; } + + ClearPage.write(hdf, "sampleindex.cs", relative + "/index" + DroidDoc.htmlExtension); + } + + public void writeIndexOnly(File dir, String relative) { + HDF hdf = writeIndex(dir); + ClearPage.write(hdf, "sampleindex.cs", relative + "/index" + + DroidDoc.htmlExtension); + } + + public HDF writeIndex(File dir) { + HDF hdf = DroidDoc.makeHDF(); + + hdf.setValue("page.title", dir.getName() + " - " + mTitle); + hdf.setValue("projectTitle", mTitle); + String filename = dir.getPath() + "/_index.html"; - String summary = SampleTagInfo.readFile(new SourcePositionInfo(filename, -1,-1), filename, - "sample code", true, false, true); + String summary = SampleTagInfo.readFile(new SourcePositionInfo(filename, + -1,-1), filename, "sample code", true, false, true); + if (summary == null) { summary = ""; } hdf.setValue("summary", summary); - - ClearPage.write(hdf, "sampleindex.cs", relative + "/index" + DroidDoc.htmlExtension); + + return hdf; } public void writePage(File f, String out, String subdir) { |