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

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: Fixed comment and if statements. 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..337a8ab056e42f480f7d0f365d14844608bf0308 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;
+/// Support for [:foo:]-style code comments to the markdown parser.
+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;
}
@@ -335,11 +340,18 @@ markdown.Node fixReference(String name, LibraryMirror currentLibrary,
var reference;
var memberScope = currentMember == null ?
null : currentMember.lookupInScope(name);
- if (memberScope != null) reference = memberScope.qualifiedName;
- else {
+ if (memberScope != null) {
+ reference = memberScope.qualifiedName;
+ } else {
var classScope = currentClass == null ?
null : currentClass.lookupInScope(name);
- reference = classScope != null ? classScope.qualifiedName : name;
+ if (classScope != null) {
+ reference = classScope.qualifiedName;
+ } else {
+ var libraryScope = currentLibrary == null ?
+ null : currentLibrary.lookupInScope(name);
+ reference = libraryScope != null ? libraryScope.qualifiedName : name;
+ }
}
return new markdown.Element.text('a', reference);
}
@@ -620,7 +632,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