Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1048)

Unified Diff: pkg/docgen/lib/docgen.dart

Issue 22831008: Added an introduction option by passing in a file with markdown. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/docgen/bin/sdk-introduction.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/docgen.dart
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index 61c8e2fa8811ad3d22e0da7531099b37fbee37c1..75fb5ef1b80a20a1fed1ebb984c6cdc0af20aba6 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -65,6 +65,8 @@ Map<String, Indexable> entityMap = new Map<String, Indexable>();
/// This is set from the command line arguments flag --include-private
bool _includePrivate = false;
+// TODO(janicejl): Make MDN content generic or pluggable. Maybe move
+// MDN-specific code to its own library that is imported into the default impl?
/// Map of all the comments for dom elements from MDN.
Map _mdn;
@@ -82,7 +84,7 @@ Map _mdn;
*/
Future<bool> docgen(List<String> files, {String packageRoot,
bool outputToYaml: true, bool includePrivate: false, bool includeSdk: false,
- bool parseSdk: false, bool append: false}) {
+ bool parseSdk: false, bool append: false, String introduction: ''}) {
_includePrivate = includePrivate;
if (!append) {
var dir = new Directory('docs');
@@ -108,7 +110,8 @@ Future<bool> docgen(List<String> files, {String packageRoot,
throw new StateError('No library mirrors were created.');
}
_documentLibraries(mirrorSystem.libraries.values,includeSdk: includeSdk,
- outputToYaml: outputToYaml, append: append, parseSdk: parseSdk);
+ outputToYaml: outputToYaml, append: append, parseSdk: parseSdk,
+ introduction: introduction);
return true;
});
@@ -224,7 +227,8 @@ Future<MirrorSystem> _analyzeLibraries(List<String> libraries,
* Creates documentation for filtered libraries.
*/
void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false,
- bool outputToYaml: true, bool append: false, bool parseSdk: false}) {
+ bool outputToYaml: true, bool append: false, bool parseSdk: false,
+ String introduction: ''}) {
libs.forEach((lib) {
// Files belonging to the SDK have a uri that begins with 'dart:'.
if (includeSdk || !lib.uri.toString().startsWith('dart:')) {
@@ -247,8 +251,13 @@ void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false,
// Outputs a yaml file with all libraries and their preview comments after
// creating all libraries. This will help the viewer know what libraries are
// available to read in.
- var libraryMap = {'libraries' : filteredEntities.where((e) =>
- e is Library).map((e) => e.previewMap).toList()};
+ var libraryMap = {
+ 'libraries' : filteredEntities.where((e) =>
+ e is Library).map((e) => e.previewMap).toList(),
+ 'introduction' : introduction == '' ?
+ '' : markdown.markdownToHtml(new File(introduction).readAsStringSync(),
+ linkResolver: linkResolver, inlineSyntaxes: markdownSyntaxes)
+ };
_writeToFile(getYamlString(libraryMap), 'library_list.yaml', append: append);
// Outputs all the qualified names documented with their type.
// This will help generate search results.
« no previous file with comments | « pkg/docgen/bin/sdk-introduction.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698