OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * To generate docs for a library, run this script with the path to an | 6 * To generate docs for a library, run this script with the path to an |
7 * entrypoint .dart file, like: | 7 * entrypoint .dart file, like: |
8 * | 8 * |
9 * $ dart dartdoc.dart foo.dart | 9 * $ dart dartdoc.dart foo.dart |
10 * | 10 * |
(...skipping 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1829 write("CACHE MANIFEST\n\n"); | 1829 write("CACHE MANIFEST\n\n"); |
1830 write("# VERSION: ${new Date.now()}\n\n"); | 1830 write("# VERSION: ${new Date.now()}\n\n"); |
1831 write("NETWORK:\n*\n\n"); | 1831 write("NETWORK:\n*\n\n"); |
1832 write("CACHE:\n"); | 1832 write("CACHE:\n"); |
1833 var toCache = new Directory.fromPath(outputDir); | 1833 var toCache = new Directory.fromPath(outputDir); |
1834 var toCacheLister = toCache.list(recursive: true); | 1834 var toCacheLister = toCache.list(recursive: true); |
1835 toCacheLister.onFile = (filename) { | 1835 toCacheLister.onFile = (filename) { |
1836 if (filename.endsWith('appcache.manifest')) { | 1836 if (filename.endsWith('appcache.manifest')) { |
1837 return; | 1837 return; |
1838 } | 1838 } |
1839 // TODO(johnniwinther): If [outputDir] has trailing slashes, [filename] | 1839 Path relativeFilePath = new Path(filename).relativeTo(outputDir); |
Bill Hesse
2013/01/16 15:30:25
Both the issues identified here have been fixed, s
| |
1840 // contains double (back)slashes for files in the immediate [toCache] | |
1841 // directory. These are not handled by [relativeTo] thus | |
1842 // wrongfully producing the path `/foo.html` for a file `foo.html` in | |
1843 // [toCache]. | |
1844 // | |
1845 // This can be handled in two ways. 1) By ensuring that | |
1846 // [Directory.fromPath] does not receive a path with a trailing slash, or | |
1847 // better, by making [Directory.fromPath] handle such trailing slashes. | |
1848 // 2) By ensuring that [filePath] does not have double slashes before | |
1849 // calling [relativeTo], or better, by making [relativeTo] handle double | |
1850 // slashes correctly. | |
1851 Path filePath = new Path(filename).canonicalize(); | |
1852 Path relativeFilePath = filePath.relativeTo(outputDir); | |
1853 write("$relativeFilePath\n"); | 1840 write("$relativeFilePath\n"); |
1854 }; | 1841 }; |
1855 toCacheLister.onDone = (done) => endFile(); | 1842 toCacheLister.onDone = (done) => endFile(); |
1856 } | 1843 } |
1857 | 1844 |
1858 /** | 1845 /** |
1859 * Returns [:true:] if [type] should be regarded as an exception. | 1846 * Returns [:true:] if [type] should be regarded as an exception. |
1860 */ | 1847 */ |
1861 bool isException(TypeMirror type) { | 1848 bool isException(TypeMirror type) { |
1862 return type.simpleName.endsWith('Exception') || | 1849 return type.simpleName.endsWith('Exception') || |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1905 final ClassMirror inheritedFrom; | 1892 final ClassMirror inheritedFrom; |
1906 | 1893 |
1907 DocComment(this.text, [this.inheritedFrom = null]) { | 1894 DocComment(this.text, [this.inheritedFrom = null]) { |
1908 assert(text != null && !text.trim().isEmpty); | 1895 assert(text != null && !text.trim().isEmpty); |
1909 } | 1896 } |
1910 | 1897 |
1911 String get html => md.markdownToHtml(text); | 1898 String get html => md.markdownToHtml(text); |
1912 | 1899 |
1913 String toString() => text; | 1900 String toString() => text; |
1914 } | 1901 } |
OLD | NEW |