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

Unified Diff: lib/src/inline_parser.dart

Issue 1274753003: Allow resolving links that contain inline syntax. (Closed) Base URL: https://github.com/dart-lang/markdown.git@master
Patch Set: Created 5 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 | « lib/src/html_renderer.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/inline_parser.dart
diff --git a/lib/src/inline_parser.dart b/lib/src/inline_parser.dart
index 7638cdd2f33e946e4d35dc82f9f1deb6c299f7c0..c9cf98a94aed9b7e96e7f808b38bdb25ecb811fb 100644
--- a/lib/src/inline_parser.dart
+++ b/lib/src/inline_parser.dart
@@ -280,13 +280,10 @@ class LinkSyntax extends TagSyntax {
if (isNullOrEmpty(match[1])) {
if (linkResolver == null) return null;
- // Only allow implicit links if the content is just text.
- // TODO(rnystrom): Do we want to relax this?
- if (state.children.any((child) => child is! Text)) return null;
- // If there are multiple children, but they are all text, send the
- // combined text to linkResolver.
- var textToResolve =
- state.children.fold('', (oldVal, child) => oldVal + child.text);
+ // Treat the contents as unparsed text even if they happen to match. This
+ // way, we can handle things like [LINK_WITH_UNDERSCORES] as a link and
+ // not get confused by the emphasis.
+ var textToResolve = parser.source.substring(state.endPos, parser.pos);
// See if we have a resolver that will generate a link for us.
resolved = true;
« no previous file with comments | « lib/src/html_renderer.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698