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

Side by Side Diff: utils/markdown/lib.dart

Issue 8879004: Fix broken dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/markdown/ast.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /// Parses text in markdown format. Use this entrypoint if you want to parse 5 /// Parses text in markdown format. Use this entrypoint if you want to parse
6 /// markdown from your own Dart code. To parse markdown by running the script 6 /// markdown from your own Dart code. To parse markdown by running the script
7 /// directly from the command line, see markdown.dart. 7 /// directly from the command line, see markdown.dart.
8 #library('markdown'); 8 #library('markdown');
9 9
10 #source('ast.dart'); 10 #source('ast.dart');
(...skipping 22 matching lines...) Expand all
33 33
34 Node setImplicitLinkResolver(Node resolver(String text)) { 34 Node setImplicitLinkResolver(Node resolver(String text)) {
35 _implicitLinkResolver = resolver; 35 _implicitLinkResolver = resolver;
36 } 36 }
37 37
38 /// Maintains the context needed to parse a markdown document. 38 /// Maintains the context needed to parse a markdown document.
39 class Document { 39 class Document {
40 final Map<String, Link> refLinks; 40 final Map<String, Link> refLinks;
41 41
42 Document() 42 Document()
43 : refLinks = <String, Link>{}; 43 : refLinks = <Link>{};
44 44
45 parseRefLinks(List<String> lines) { 45 parseRefLinks(List<String> lines) {
46 // This is a hideous regex. It matches: 46 // This is a hideous regex. It matches:
47 // [id]: http:foo.com "some title" 47 // [id]: http:foo.com "some title"
48 // Where there may whitespace in there, and where the title may be in 48 // Where there may whitespace in there, and where the title may be in
49 // single quotes, double quotes, or parentheses. 49 // single quotes, double quotes, or parentheses.
50 final indent = @'^[ ]{0,3}'; // Leading indentation. 50 final indent = @'^[ ]{0,3}'; // Leading indentation.
51 final id = @'\[([^\]]+)\]'; // Reference id in [brackets]. 51 final id = @'\[([^\]]+)\]'; // Reference id in [brackets].
52 final quote = @'"[^"]+"'; // Title in "double quotes". 52 final quote = @'"[^"]+"'; // Title in "double quotes".
53 final apos = @"'[^']+'"; // Title in 'single quotes'. 53 final apos = @"'[^']+'"; // Title in 'single quotes'.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /// `<em>this <strong>is</strong> a</em> <code>markdown</code>`. 104 /// `<em>this <strong>is</strong> a</em> <code>markdown</code>`.
105 List<Node> parseInline(String text) => new InlineParser(text, this).parse(); 105 List<Node> parseInline(String text) => new InlineParser(text, this).parse();
106 } 106 }
107 107
108 class Link { 108 class Link {
109 final String id; 109 final String id;
110 final String url; 110 final String url;
111 final String title; 111 final String title;
112 Link(this.id, this.url, this.title); 112 Link(this.id, this.url, this.title);
113 } 113 }
OLDNEW
« no previous file with comments | « utils/markdown/ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698