mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Fixes #127
This commit is contained in:
parent
3393022ab6
commit
4709d43b81
2 changed files with 34 additions and 35 deletions
|
|
@ -26,43 +26,34 @@ Some say '90s, others say 90's, but I can't say which is best.
|
||||||
<p>Some say ’90s, others say 90’s, but I can’t say which is best.</p>
|
<p>Some say ’90s, others say 90’s, but I can’t say which is best.</p>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
5
|
5: contractions
|
||||||
//- - - - - - - - -//
|
|
||||||
[Cat][]'s Pajamas
|
|
||||||
|
|
||||||
[Cat]: http://example.com
|
|
||||||
//- - - - - - - - -//
|
|
||||||
<p><a href="http://example.com">Cat</a>’s Pajamas</p>
|
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
|
||||||
|
|
||||||
6
|
|
||||||
//- - - - - - - - -//
|
|
||||||
reported "issue 1 (IE-only)"
|
|
||||||
//- - - - - - - - -//
|
|
||||||
<p>reported “issue 1 (IE-only)”</p>
|
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
|
||||||
|
|
||||||
7
|
|
||||||
//- - - - - - - - -//
|
|
||||||
Yahoo!'s
|
|
||||||
//- - - - - - - - -//
|
|
||||||
<p>Yahoo!’s</p>
|
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
|
||||||
|
|
||||||
8
|
|
||||||
//- - - - - - - - -//
|
//- - - - - - - - -//
|
||||||
Alice's, I'm ,Don't, You'd
|
Alice's, I'm ,Don't, You'd
|
||||||
|
|
||||||
I've, I'll, You're
|
I've, I'll, You're
|
||||||
|
|
||||||
|
[Cat][]'s Pajamas
|
||||||
|
|
||||||
|
Yahoo!'s
|
||||||
|
|
||||||
|
[Cat]: http://example.com
|
||||||
//- - - - - - - - -//
|
//- - - - - - - - -//
|
||||||
<p>Alice’s, I’m ,Don’t, You’d</p>
|
<p>Alice’s, I’m ,Don’t, You’d</p>
|
||||||
<p>I’ve, I’ll, You’re</p>
|
<p>I’ve, I’ll, You’re</p>
|
||||||
|
<p><a href="http://example.com">Cat</a>’s Pajamas</p>
|
||||||
|
<p>Yahoo!’s</p>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
9
|
6: "" after digits are an inch
|
||||||
//- - - - - - - - -//
|
//- - - - - - - - -//
|
||||||
My height is 5'6"".
|
My height is 5'6"".
|
||||||
//- - - - - - - - -//
|
//- - - - - - - - -//
|
||||||
<p>My height is 5'6"".</p>
|
<p>My height is 5'6"".</p>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
|
7: quote followed by ,.?! and spaces maybe a closer
|
||||||
|
//- - - - - - - - -//
|
||||||
|
reported "issue 1 (IE-only)", "issue 2", 'issue3 (FF-only)', 'issue4'
|
||||||
|
//- - - - - - - - -//
|
||||||
|
<p>reported “issue 1 (IE-only)”, “issue 2”, ‘issue3 (FF-only)’, ‘issue4’</p>
|
||||||
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
|
||||||
|
|
@ -233,13 +233,17 @@ func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser
|
||||||
block.Advance(1)
|
block.Advance(1)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
if s.Substitutions[RightSingleQuote] != nil && d.CanClose && !d.CanOpen {
|
if s.Substitutions[RightSingleQuote] != nil {
|
||||||
|
isClose := d.CanClose && !d.CanOpen
|
||||||
|
maybeClose := d.CanClose && d.CanOpen && len(line) > 1 && (line[1] == ',' || line[1] == '.' || line[1] == '!' || line[1] == '?') && (len(line) == 2 || (len(line) > 2 && util.IsPunct(line[2]) || util.IsSpace(line[2])))
|
||||||
|
if isClose || maybeClose {
|
||||||
node := gast.NewString(s.Substitutions[RightSingleQuote])
|
node := gast.NewString(s.Substitutions[RightSingleQuote])
|
||||||
node.SetCode(true)
|
node.SetCode(true)
|
||||||
block.Advance(1)
|
block.Advance(1)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if c == '"' {
|
if c == '"' {
|
||||||
// special case: 7'1""
|
// special case: 7'1""
|
||||||
if len(line) > 1 && line[1] == '"' && unicode.IsDigit(before) {
|
if len(line) > 1 && line[1] == '"' && unicode.IsDigit(before) {
|
||||||
|
|
@ -253,7 +257,10 @@ func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser
|
||||||
block.Advance(1)
|
block.Advance(1)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
if s.Substitutions[RightDoubleQuote] != nil && d.CanClose && !d.CanOpen {
|
if s.Substitutions[RightDoubleQuote] != nil {
|
||||||
|
isClose := d.CanClose && !d.CanOpen
|
||||||
|
maybeClose := d.CanClose && d.CanOpen && len(line) > 1 && (line[1] == ',' || line[1] == '.' || line[1] == '!' || line[1] == '?') && (len(line) == 2 || (len(line) > 2 && util.IsPunct(line[2]) || util.IsSpace(line[2])))
|
||||||
|
if isClose || maybeClose {
|
||||||
node := gast.NewString(s.Substitutions[RightDoubleQuote])
|
node := gast.NewString(s.Substitutions[RightDoubleQuote])
|
||||||
node.SetCode(true)
|
node.SetCode(true)
|
||||||
block.Advance(1)
|
block.Advance(1)
|
||||||
|
|
@ -261,6 +268,7 @@ func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue