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

Side by Side Diff: lib/src/inline_parser.dart

Issue 1340143003: Ignore underscores in the middle of words. (Closed) Base URL: https://github.com/dart-lang/markdown.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« CHANGELOG.md ('K') | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library markdown.src.inline_parser; 5 library markdown.src.inline_parser;
6 6
7 import 'ast.dart'; 7 import 'ast.dart';
8 import 'document.dart'; 8 import 'document.dart';
9 import 'util.dart'; 9 import 'util.dart';
10 10
(...skipping 25 matching lines...) Expand all
36 // Leave already-encoded HTML entities alone. Ensures we don't turn 36 // Leave already-encoded HTML entities alone. Ensures we don't turn
37 // "&" into "&" 37 // "&" into "&"
38 new TextSyntax(r'&[#a-zA-Z0-9]*;'), 38 new TextSyntax(r'&[#a-zA-Z0-9]*;'),
39 // Encode "&". 39 // Encode "&".
40 new TextSyntax(r'&', sub: '&'), 40 new TextSyntax(r'&', sub: '&'),
41 // Encode "<". (Why not encode ">" too? Gruber is toying with us.) 41 // Encode "<". (Why not encode ">" too? Gruber is toying with us.)
42 new TextSyntax(r'<', sub: '&lt;'), 42 new TextSyntax(r'<', sub: '&lt;'),
43 // Parse "**strong**" tags. 43 // Parse "**strong**" tags.
44 new TagSyntax(r'\*\*', tag: 'strong'), 44 new TagSyntax(r'\*\*', tag: 'strong'),
45 // Parse "__strong__" tags. 45 // Parse "__strong__" tags.
46 new TagSyntax(r'__', tag: 'strong'), 46 new TagSyntax(r'\b__', tag: 'strong', end: r'__\b'),
nweiz 2015/09/14 21:52:13 Using \b here isn't very non-English-friendly; it'
Bob Nystrom 2015/09/15 00:19:16 Hmm, good point. I think this is sort of a stopgap
47 // Parse "*emphasis*" tags. 47 // Parse "*emphasis*" tags.
48 new TagSyntax(r'\*', tag: 'em'), 48 new TagSyntax(r'\*', tag: 'em'),
49 // Parse "_emphasis_" tags. 49 // Parse "_emphasis_" tags.
50 // TODO(rnystrom): Underscores in the middle of a word should not be 50 new TagSyntax(r'\b_', tag: 'em', end: r'_\b'),
51 // parsed as emphasis like_in_this.
52 new TagSyntax(r'_', tag: 'em'),
53 new CodeSyntax(), 51 new CodeSyntax(),
54 // We will add the LinkSyntax once we know about the specific link resolver. 52 // We will add the LinkSyntax once we know about the specific link resolver.
55 ]; 53 ];
56 54
57 /// The string of markdown being parsed. 55 /// The string of markdown being parsed.
58 final String source; 56 final String source;
59 57
60 /// The markdown document this parser is parsing. 58 /// The markdown document this parser is parsing.
61 final Document document; 59 final Document document;
62 60
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 parser.consume(endMatch[0].length); 472 parser.consume(endMatch[0].length);
475 } else { 473 } else {
476 // Didn't close correctly so revert to text. 474 // Didn't close correctly so revert to text.
477 parser.start = startPos; 475 parser.start = startPos;
478 parser.advanceBy(endMatch[0].length); 476 parser.advanceBy(endMatch[0].length);
479 } 477 }
480 478
481 return null; 479 return null;
482 } 480 }
483 } 481 }
OLDNEW
« CHANGELOG.md ('K') | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698