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

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

Issue 21999002: Fixed [:foo:]-style markdown links and added lookup within the library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed [:...:] style markdown to <code> and not <a> Created 7 years, 5 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 | 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 271684dd0729eca6b767f1bde97e676279e40497..d065698374a04fe626280838e4d6bc69d06043cf 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -47,6 +47,10 @@ ClassMirror _currentClass;
/// Current member being documented to be used for comment links.
MemberMirror _currentMember;
+/// Add support for [:foo:]-style code to the markdown parser.
Emily Fortuna 2013/08/02 23:26:55 nit: can we make this comment slightly clearer: su
Tate Mandel 2013/08/02 23:54:36 Done.
+List<markdown.InlineSyntax> markdownSyntaxes =
+ [new markdown.CodeSyntax(r'\[:\s?((?:.|\n)*?)\s?:\]')];
+
/// Resolves reference links in doc comments.
markdown.Resolver linkResolver;
@@ -323,7 +327,8 @@ String _commentToHtml(DeclarationMirror mirror) {
});
commentText = commentText == null ? '' :
- markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver);
+ markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver,
+ inlineSyntaxes: markdownSyntaxes);
return commentText;
}
@@ -339,7 +344,12 @@ markdown.Node fixReference(String name, LibraryMirror currentLibrary,
else {
var classScope = currentClass == null ?
null : currentClass.lookupInScope(name);
- reference = classScope != null ? classScope.qualifiedName : name;
+ if (classScope != null) reference = classScope.qualifiedName;
Emily Fortuna 2013/08/02 23:26:55 if you have an else branch, go ahead and put the i
Tate Mandel 2013/08/02 23:54:36 Done.
+ else {
+ var libraryScope = currentLibrary == null ?
+ null : currentLibrary.lookupInScope(name);
+ reference = libraryScope != null ? libraryScope.qualifiedName : name;
+ }
}
return new markdown.Element.text('a', reference);
}
@@ -620,7 +630,7 @@ class Class extends Indexable {
*/
void makeValid() {
var library = entityMap[owner];
- if (!library.classes.containsKey(name)) {
+ if (library != null && !library.classes.containsKey(name)) {
this.isPrivate = true;
// Since we are now making the mixin a private class, make all elements
// with the mixin as an owner private too.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698