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>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
||||
5
|
||||
//- - - - - - - - -//
|
||||
[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
|
||||
5: contractions
|
||||
//- - - - - - - - -//
|
||||
Alice's, I'm ,Don't, You'd
|
||||
|
||||
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>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"".
|
||||
//- - - - - - - - -//
|
||||
<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,11 +233,15 @@ func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser
|
|||
block.Advance(1)
|
||||
return node
|
||||
}
|
||||
if s.Substitutions[RightSingleQuote] != nil && d.CanClose && !d.CanOpen {
|
||||
node := gast.NewString(s.Substitutions[RightSingleQuote])
|
||||
node.SetCode(true)
|
||||
block.Advance(1)
|
||||
return node
|
||||
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.SetCode(true)
|
||||
block.Advance(1)
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
if c == '"' {
|
||||
|
|
@ -253,11 +257,15 @@ func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser
|
|||
block.Advance(1)
|
||||
return node
|
||||
}
|
||||
if s.Substitutions[RightDoubleQuote] != nil && d.CanClose && !d.CanOpen {
|
||||
node := gast.NewString(s.Substitutions[RightDoubleQuote])
|
||||
node.SetCode(true)
|
||||
block.Advance(1)
|
||||
return node
|
||||
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.SetCode(true)
|
||||
block.Advance(1)
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue