Skip to content
This repository

allow numbers as well as alpha between underscores #60

Closed
wants to merge 1 commit into from

2 participants

Trevor Wennblom Thomas Leitner
Trevor Wennblom
trevor commented

No description provided.

Thomas Leitner
Owner

Thanks for the pull request!

Thomas Leitner gettalong closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jun 06, 2013
Trevor Wennblom trevor allow numbers as well as alpha between underscores 08ca0c5
This page is out of date. Refresh to see the latest.
4 lib/kramdown/parser/kramdown/emphasis.rb
@@ -20,7 +20,7 @@ def parse_emphasis
20 20 type = result[0..0]
21 21 reset_pos = @src.pos
22 22
23   - if (type == '_' && @src.pre_match =~ /[[:alpha:]]\z/ && @src.check(/[[:alpha:]]/)) || @src.check(/\s/) ||
  23 + if (type == '_' && @src.pre_match =~ /[[:alnum:]]\z/ && @src.check(/[[:alnum:]]/)) || @src.check(/\s/) ||
24 24 @tree.type == element || @stack.any? {|el, _| el.type == element}
25 25 add_text(result)
26 26 return
@@ -32,7 +32,7 @@ def parse_emphasis
32 32 found = parse_spans(el, stop_re) do
33 33 (@src.pre_match[-1, 1] !~ /\s/) &&
34 34 (elem != :em || !@src.match?(/#{Regexp.escape(delim*2)}(?!#{Regexp.escape(delim)})/)) &&
35   - (type != '_' || !@src.match?(/#{Regexp.escape(delim)}[[:alpha:]]/)) && el.children.size > 0
  35 + (type != '_' || !@src.match?(/#{Regexp.escape(delim)}[[:alnum:]]/)) && el.children.size > 0
36 36 end
37 37 [found, el, stop_re]
38 38 end
3  test/testcases/span/02_emphasis/nesting.html
@@ -31,6 +31,9 @@
31 31 <li>__a__b</li>
32 32 <li>a__b__</li>
33 33 <li>a__b__c</li>
  34 + <li>a__2__c</li>
  35 + <li>a__2__3</li>
  36 + <li>1__2__3</li>
34 37 </ul>
35 38 <ul>
36 39 <li><em>a _b_ c</em></li>
5 test/testcases/span/02_emphasis/nesting.text
@@ -21,13 +21,16 @@
21 21 - **a**b
22 22 - a**b**
23 23 - a**b**c
24   -^
  24 +^
25 25 - _a_b
26 26 - a_b_
27 27 - a_b_c
28 28 - __a__b
29 29 - a__b__
30 30 - a__b__c
  31 +- a__2__c
  32 +- a__2__3
  33 +- 1__2__3
31 34 ^
32 35 - *a _b_ c*
33 36 - **a __b__ c**

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.