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

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

Issue 183333003: Adding 'preview' to typedef (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « no previous file | pkg/docgen/pubspec.yaml » ('j') | 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 cd7c7973214e8592b4314958b83481f31faa91a5..6bbabdea17d07ab0c3922cad51529aafd988ab23 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -717,36 +717,36 @@ class _Viewer {
/// Serve up our generated documentation for viewing in a browser.
static void _clone() {
- // If the viewer code is already there, then don't clone again.
- if (_dartdocViewerDir.existsSync()) {
- _moveDirectoryAndServe();
- }
- else {
- var processResult = Process.runSync('git', ['clone', '-b', 'master',
- 'git://github.com/dart-lang/dartdoc-viewer.git'],
- runInShell: true);
-
- if (processResult.exitCode == 0) {
- /// Move the generated json/yaml docs directory to the dartdoc-viewer
- /// directory, to run as a webpage.
- var processResult = Process.runSync(_Generator._pubScript,
- ['upgrade'], runInShell: true,
- workingDirectory: viewerCodePath);
- print('process output: ${processResult.stdout}');
- print('process stderr: ${processResult.stderr}');
-
- var dir = new Directory(_Generator._outputDirectory == null? 'docs' :
- _Generator._outputDirectory);
- _webDocsDir = new Directory(path.join(viewerCodePath, 'web', 'docs'));
- if (dir.existsSync()) {
- // Move the docs folder to dartdoc-viewer/client/web/docs
- dir.renameSync(_webDocsDir.path);
- }
- } else {
- print('Error cloning git repository:');
- print('process output: ${processResult.stdout}');
- print('process stderr: ${processResult.stderr}');
+ // TODO(16959) _moveDirectoryAndServe was removed in 32639 without cleaning
+ // up this call.
+ // if (_dartdocViewerDir.existsSync()) {
+ // _moveDirectoryAndServe();
Emily Fortuna 2014/03/05 01:35:30 I thought you were going to add back in the functi
+ // }
+
+ var processResult = Process.runSync('git', ['clone', '-b', 'master',
+ 'git://github.com/dart-lang/dartdoc-viewer.git'],
+ runInShell: true);
+
+ if (processResult.exitCode == 0) {
+ /// Move the generated json/yaml docs directory to the dartdoc-viewer
+ /// directory, to run as a webpage.
+ var processResult = Process.runSync(_Generator._pubScript,
+ ['upgrade'], runInShell: true,
+ workingDirectory: viewerCodePath);
+ print('process output: ${processResult.stdout}');
+ print('process stderr: ${processResult.stderr}');
+
+ var dir = new Directory(_Generator._outputDirectory == null? 'docs' :
+ _Generator._outputDirectory);
+ _webDocsDir = new Directory(path.join(viewerCodePath, 'web', 'docs'));
+ if (dir.existsSync()) {
+ // Move the docs folder to dartdoc-viewer/client/web/docs
+ dir.renameSync(_webDocsDir.path);
}
+ } else {
+ print('Error cloning git repository:');
Emily Fortuna 2014/03/05 01:35:30 no please add back in moveDirectoryAndServe!
+ print('process output: ${processResult.stdout}');
+ print('process stderr: ${processResult.stderr}');
}
}
@@ -989,13 +989,19 @@ abstract class Indexable extends MirrorBased {
/// Creates a [Map] with this [Indexable]'s name and a preview comment.
Map get previewMap {
var finalMap = { 'name' : name, 'qualifiedName' : qualifiedName };
+ var preview = _preview;
+ if(preview != null) finalMap['preview'] = preview;
+ return finalMap;
+ }
+
+ String get _preview {
if (comment != '') {
var index = comment.indexOf('</p>');
- finalMap['preview'] = index > 0 ?
+ return index > 0 ?
'${comment.substring(0, index)}</p>' :
'<p><i>Comment preview not available</i></p>';
}
- return finalMap;
+ return null;
}
/// Accessor to obtain the raw comment text for a given item, _without_ any
@@ -1918,15 +1924,24 @@ class Typedef extends OwnedIndexable {
annotations = MirrorBased._createAnnotations(mirror, owningLibrary);
}
- Map toMap() => {
- 'name': name,
- 'qualifiedName': qualifiedName,
- 'comment': comment,
- 'return': returnType,
- 'parameters': recurseMap(parameters),
- 'annotations': annotations.map((a) => a.toMap()).toList(),
- 'generics': recurseMap(generics)
- };
+ Map toMap() {
+ var map = {
+ 'name': name,
+ 'qualifiedName': qualifiedName,
+ 'comment': comment,
+ 'return': returnType,
+ 'parameters': recurseMap(parameters),
+ 'annotations': annotations.map((a) => a.toMap()).toList(),
+ 'generics': recurseMap(generics)
+ };
+
+ // Typedef is displayed on the library page as a class, so a preview is
+ // added manually
+ var preview = _preview;
+ if(preview != null) map['preview'] = preview;
+
+ return map;
+ }
markdown.Node fixReference(String name) => null;
« no previous file with comments | « no previous file | pkg/docgen/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698