Chromium Code Reviews| Index: utils/apidoc/apidoc.dart |
| diff --git a/utils/apidoc/apidoc.dart b/utils/apidoc/apidoc.dart |
| index 2d8aaf9b74c0c907a3412b98fd845cab45169a78..5db70df490def61428ef00c2b2ce794c72cd3644 100644 |
| --- a/utils/apidoc/apidoc.dart |
| +++ b/utils/apidoc/apidoc.dart |
| @@ -109,6 +109,9 @@ void main() { |
| print('Generating docs...'); |
| final apidoc = new Apidoc(mdn, outputDir, mode); |
| apidoc.document(); |
| + |
| + print('Building App Cache manifest'); |
| + apidoc.generateAppCacheManifest(); |
| } |
| class Apidoc extends doc.Dartdoc { |
| @@ -173,6 +176,8 @@ class Apidoc extends doc.Dartdoc { |
| </div> <!-- #comments --> |
| '''; |
| + htmlAttributes = 'manifest="appcache.manifest"'; |
|
Bob Nystrom
2012/04/24 16:30:33
Is there any reason we wouldn't want dartdoc itsel
sethladd
2012/04/25 21:13:46
moved to dartdoc
|
| + |
| searchEngineId = '011220921317074318178:i4mscbaxtru'; |
| searchResultsUrl = 'http://www.dartlang.org/search.html'; |
| } |
| @@ -495,4 +500,22 @@ class Apidoc extends doc.Dartdoc { |
| return ''; |
| } |
| + |
| + generateAppCacheManifest() { |
| + var manifestFile = new File('docs/appcache.manifest'); |
|
Bob Nystrom
2012/04/24 16:30:33
The Dartdoc class has a more pleasant API for writ
sethladd
2012/04/25 21:13:46
current way works, will leave for now.
|
| + var writer = manifestFile.openOutputStream(FileMode.WRITE); |
| + writer.writeString("CACHE MANIFEST\n\n"); |
| + writer.writeString("# VERSION: ${new Date.now()}\n\n"); |
| + writer.writeString("NETWORK:\n*\n\n"); |
| + writer.writeString("CACHE:\n"); |
| + var toCache = new Directory(outputDir); |
| + var pathPrefix = new File(outputDir).fullPathSync(); |
| + var pathPrefixLength = pathPrefix.length; |
| + toCache.list(recursive: true); |
| + toCache.onFile = (filename) { |
| + var relativePath = filename.substring(pathPrefixLength+1); |
|
Bob Nystrom
2012/04/24 16:30:33
Spaces around +
sethladd
2012/04/25 21:13:46
Done.
|
| + writer.writeString("$relativePath\n"); |
| + }; |
| + toCache.onDone = (done) => writer.close(); |
|
Bob Nystrom
2012/04/24 16:30:33
Ugh, async. I wonder if at some point, Dartdoc wil
sethladd
2012/04/25 21:13:46
See the added Futures.
|
| + } |
| } |