vendor: update all dependencies to latest versions
This commit is contained in:
+128
-9
@@ -15,9 +15,8 @@ package blackfriday
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func runMarkdownInline(input string, opts Options, htmlFlags int, params HtmlRendererParameters) string {
|
||||
@@ -60,13 +59,11 @@ func doTestsInlineParam(t *testing.T, tests []string, opts Options, htmlFlags in
|
||||
params HtmlRendererParameters) {
|
||||
// catch and report panics
|
||||
var candidate string
|
||||
/*
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
t.Errorf("\npanic while processing [%#v] (%v)\n", candidate, err)
|
||||
}
|
||||
}()
|
||||
*/
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
t.Errorf("\npanic while processing [%#v]: %s\n", candidate, err)
|
||||
}
|
||||
}()
|
||||
|
||||
for i := 0; i+1 < len(tests); i += 2 {
|
||||
input := tests[i]
|
||||
@@ -156,10 +153,35 @@ func TestEmphasis(t *testing.T) {
|
||||
|
||||
"*What is A\\* algorithm?*\n",
|
||||
"<p><em>What is A* algorithm?</em></p>\n",
|
||||
|
||||
"some para_graph with _emphasised_ text.\n",
|
||||
"<p>some para_graph with <em>emphasised</em> text.</p>\n",
|
||||
|
||||
"some paragraph with _emphasised_ te_xt.\n",
|
||||
"<p>some paragraph with <em>emphasised</em> te_xt.</p>\n",
|
||||
|
||||
"some paragraph with t_wo bi_ts of _emphasised_ text.\n",
|
||||
"<p>some paragraph with t<em>wo bi</em>ts of <em>emphasised</em> text.</p>\n",
|
||||
|
||||
"un*frigging*believable\n",
|
||||
"<p>un<em>frigging</em>believable</p>\n",
|
||||
}
|
||||
doTestsInline(t, tests)
|
||||
}
|
||||
|
||||
func TestNoIntraEmphasis(t *testing.T) {
|
||||
tests := []string{
|
||||
"some para_graph with _emphasised_ text.\n",
|
||||
"<p>some para_graph with <em>emphasised</em> text.</p>\n",
|
||||
|
||||
"un*frigging*believable\n",
|
||||
"<p>un*frigging*believable</p>\n",
|
||||
}
|
||||
doTestsInlineParam(t, tests, Options{
|
||||
Extensions: EXTENSION_NO_INTRA_EMPHASIS},
|
||||
0, HtmlRendererParameters{})
|
||||
}
|
||||
|
||||
func TestReferenceOverride(t *testing.T) {
|
||||
var tests = []string{
|
||||
"test [ref1][]\n",
|
||||
@@ -541,6 +563,20 @@ func TestInlineLink(t *testing.T) {
|
||||
|
||||
"[link](<../>)\n",
|
||||
"<p><a href=\"../\">link</a></p>\n",
|
||||
|
||||
// Issue 116 in blackfriday
|
||||
".jpg)",
|
||||
"<p><img src=\"http://www.broadgate.co.uk/Content/Upload/DetailImages/Cyclus700(1).jpg\" alt=\"\" /></p>\n",
|
||||
|
||||
// no closing ), autolinking detects the url next
|
||||
"[disambiguation](http://en.wikipedia.org/wiki/Disambiguation_(disambiguation) is the",
|
||||
"<p>[disambiguation](<a href=\"http://en.wikipedia.org/wiki/Disambiguation_(disambiguation\">http://en.wikipedia.org/wiki/Disambiguation_(disambiguation</a>) is the</p>\n",
|
||||
|
||||
"[disambiguation](http://en.wikipedia.org/wiki/Disambiguation_(disambiguation)) is the",
|
||||
"<p><a href=\"http://en.wikipedia.org/wiki/Disambiguation_(disambiguation)\">disambiguation</a> is the</p>\n",
|
||||
|
||||
"[disambiguation](http://en.wikipedia.org/wiki/Disambiguation_(disambiguation))",
|
||||
"<p><a href=\"http://en.wikipedia.org/wiki/Disambiguation_(disambiguation)\">disambiguation</a></p>\n",
|
||||
}
|
||||
doLinkTestsInline(t, tests)
|
||||
|
||||
@@ -681,6 +717,9 @@ func TestReferenceLink(t *testing.T) {
|
||||
|
||||
"[ref]\n [ref]: ../url/ \"title\"\n",
|
||||
"<p><a href=\"../url/\" title=\"title\">ref</a></p>\n",
|
||||
|
||||
"[link][ref]\n [ref]: /url/",
|
||||
"<p><a href=\"/url/\">link</a></p>\n",
|
||||
}
|
||||
doLinkTestsInline(t, tests)
|
||||
}
|
||||
@@ -984,6 +1023,28 @@ what happens here
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
`,
|
||||
`testing footnotes.[^a]
|
||||
|
||||
test footnotes the second.[^b]
|
||||
|
||||
[^a]: This is the first note[^a].
|
||||
[^b]: this is the second note.[^a]
|
||||
`,
|
||||
`<p>testing footnotes.<sup class="footnote-ref" id="fnref:a"><a rel="footnote" href="#fn:a">1</a></sup></p>
|
||||
|
||||
<p>test footnotes the second.<sup class="footnote-ref" id="fnref:b"><a rel="footnote" href="#fn:b">2</a></sup></p>
|
||||
<div class="footnotes">
|
||||
|
||||
<hr />
|
||||
|
||||
<ol>
|
||||
<li id="fn:a">This is the first note<sup class="footnote-ref" id="fnref:a"><a rel="footnote" href="#fn:a">1</a></sup>.
|
||||
</li>
|
||||
<li id="fn:b">this is the second note.<sup class="footnote-ref" id="fnref:a"><a rel="footnote" href="#fn:a">1</a></sup>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
`,
|
||||
}
|
||||
|
||||
@@ -1037,6 +1098,34 @@ func TestNestedFootnotes(t *testing.T) {
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
`,
|
||||
`This uses footnote A.[^A]
|
||||
|
||||
This uses footnote C.[^C]
|
||||
|
||||
[^A]:
|
||||
A note. use itself.[^A]
|
||||
[^B]:
|
||||
B note, uses A to test duplicate.[^A]
|
||||
[^C]:
|
||||
C note, uses B.[^B]
|
||||
`,
|
||||
`<p>This uses footnote A.<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup></p>
|
||||
|
||||
<p>This uses footnote C.<sup class="footnote-ref" id="fnref:C"><a rel="footnote" href="#fn:C">2</a></sup></p>
|
||||
<div class="footnotes">
|
||||
|
||||
<hr />
|
||||
|
||||
<ol>
|
||||
<li id="fn:A">A note. use itself.<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>
|
||||
</li>
|
||||
<li id="fn:C">C note, uses B.<sup class="footnote-ref" id="fnref:B"><a rel="footnote" href="#fn:B">3</a></sup>
|
||||
</li>
|
||||
<li id="fn:B">B note, uses A to test duplicate.<sup class="footnote-ref" id="fnref:A"><a rel="footnote" href="#fn:A">1</a></sup>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
`,
|
||||
}
|
||||
doTestsInlineParam(t, tests, Options{Extensions: EXTENSION_FOOTNOTES}, 0,
|
||||
@@ -1084,6 +1173,18 @@ func TestSmartDoubleQuotes(t *testing.T) {
|
||||
doTestsInlineParam(t, tests, Options{}, HTML_USE_SMARTYPANTS, HtmlRendererParameters{})
|
||||
}
|
||||
|
||||
func TestSmartDoubleQuotesNbsp(t *testing.T) {
|
||||
var tests = []string{
|
||||
"this should be normal \"quoted\" text.\n",
|
||||
"<p>this should be normal “ quoted ” text.</p>\n",
|
||||
"this \" single double\n",
|
||||
"<p>this “ single double</p>\n",
|
||||
"two pair of \"some\" quoted \"text\".\n",
|
||||
"<p>two pair of “ some ” quoted “ text ”.</p>\n"}
|
||||
|
||||
doTestsInlineParam(t, tests, Options{}, HTML_USE_SMARTYPANTS|HTML_SMARTYPANTS_QUOTES_NBSP, HtmlRendererParameters{})
|
||||
}
|
||||
|
||||
func TestSmartAngledDoubleQuotes(t *testing.T) {
|
||||
var tests = []string{
|
||||
"this should be angled \"quoted\" text.\n",
|
||||
@@ -1096,6 +1197,18 @@ func TestSmartAngledDoubleQuotes(t *testing.T) {
|
||||
doTestsInlineParam(t, tests, Options{}, HTML_USE_SMARTYPANTS|HTML_SMARTYPANTS_ANGLED_QUOTES, HtmlRendererParameters{})
|
||||
}
|
||||
|
||||
func TestSmartAngledDoubleQuotesNbsp(t *testing.T) {
|
||||
var tests = []string{
|
||||
"this should be angled \"quoted\" text.\n",
|
||||
"<p>this should be angled « quoted » text.</p>\n",
|
||||
"this \" single double\n",
|
||||
"<p>this « single double</p>\n",
|
||||
"two pair of \"some\" quoted \"text\".\n",
|
||||
"<p>two pair of « some » quoted « text ».</p>\n"}
|
||||
|
||||
doTestsInlineParam(t, tests, Options{}, HTML_USE_SMARTYPANTS|HTML_SMARTYPANTS_ANGLED_QUOTES|HTML_SMARTYPANTS_QUOTES_NBSP, HtmlRendererParameters{})
|
||||
}
|
||||
|
||||
func TestSmartFractions(t *testing.T) {
|
||||
var tests = []string{
|
||||
"1/2, 1/4 and 3/4; 1/4th and 3/4ths\n",
|
||||
@@ -1151,3 +1264,9 @@ func TestDisableSmartDashes(t *testing.T) {
|
||||
HTML_USE_SMARTYPANTS|HTML_SMARTYPANTS_LATEX_DASHES,
|
||||
HtmlRendererParameters{})
|
||||
}
|
||||
|
||||
func BenchmarkSmartDoubleQuotes(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
runMarkdownInline("this should be normal \"quoted\" text.\n", Options{}, HTML_USE_SMARTYPANTS, HtmlRendererParameters{})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user