Skip to content

Commit b6e9b75

Browse files
committed
more test fixes
1 parent 63989e1 commit b6e9b75

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

modules/markup/markdown/markdown_test.go

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ func TestRender_StandardLinks(t *testing.T) {
6868
assert.Equal(t, strings.TrimSpace(expectedUncyclo), strings.TrimSpace(buffer))
6969
}
7070

71-
googleRendered := `<p><a href="https://google.com/" rel="nofollow">https://google.com/</a></p>`
71+
googleRendered := `<p dir="auto"><a href="https://google.com/" rel="nofollow">https://google.com/</a></p>`
7272
test("<https://google.com/>", googleRendered, googleRendered)
7373

7474
lnk := util.URLJoin(AppSubURL, "UncycloPage")
7575
lnkUncyclo := util.URLJoin(AppSubURL, "wiki", "UncycloPage")
7676
test("[UncycloPage](UncycloPage)",
77-
`<p><a href="`+lnk+`" rel="nofollow">UncycloPage</a></p>`,
78-
`<p><a href="`+lnkUncyclo+`" rel="nofollow">UncycloPage</a></p>`)
77+
`<p dir="auto"><a href="`+lnk+`" rel="nofollow">UncycloPage</a></p>`,
78+
`<p dir="auto"><a href="`+lnkUncyclo+`" rel="nofollow">UncycloPage</a></p>`)
7979
}
8080

8181
func TestRender_Images(t *testing.T) {
@@ -99,49 +99,49 @@ func TestRender_Images(t *testing.T) {
9999

100100
test(
101101
"!["+title+"]("+url+")",
102-
`<p><a href="`+result+`" target="_blank" rel="nofollow noopener"><img src="`+result+`" alt="`+title+`"/></a></p>`)
102+
`<p dir="auto"><a href="`+result+`" target="_blank" rel="nofollow noopener"><img src="`+result+`" alt="`+title+`"/></a></p>`)
103103

104104
test(
105105
"[["+title+"|"+url+"]]",
106-
`<p><a href="`+result+`" rel="nofollow"><img src="`+result+`" title="`+title+`" alt="`+title+`"/></a></p>`)
106+
`<p dir="auto"><a href="`+result+`" rel="nofollow"><img src="`+result+`" title="`+title+`" alt="`+title+`"/></a></p>`)
107107
test(
108108
"[!["+title+"]("+url+")]("+href+")",
109-
`<p><a href="`+href+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
109+
`<p dir="auto"><a href="`+href+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
110110

111111
url = "/../../.images/src/02/train.jpg"
112112
test(
113113
"!["+title+"]("+url+")",
114-
`<p><a href="`+result+`" target="_blank" rel="nofollow noopener"><img src="`+result+`" alt="`+title+`"/></a></p>`)
114+
`<p dir="auto"><a href="`+result+`" target="_blank" rel="nofollow noopener"><img src="`+result+`" alt="`+title+`"/></a></p>`)
115115

116116
test(
117117
"[["+title+"|"+url+"]]",
118-
`<p><a href="`+result+`" rel="nofollow"><img src="`+result+`" title="`+title+`" alt="`+title+`"/></a></p>`)
118+
`<p dir="auto"><a href="`+result+`" rel="nofollow"><img src="`+result+`" title="`+title+`" alt="`+title+`"/></a></p>`)
119119
test(
120120
"[!["+title+"]("+url+")]("+href+")",
121-
`<p><a href="`+href+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
121+
`<p dir="auto"><a href="`+href+`" rel="nofollow"><img src="`+result+`" alt="`+title+`"/></a></p>`)
122122
}
123123

124124
func testAnswers(baseURLContent, baseURLImages string) []string {
125125
return []string{
126-
`<p>Uncyclo! Enjoy :)</p>
127-
<ul>
126+
`<p dir="auto">Uncyclo! Enjoy :)</p>
127+
<ul dir="auto">
128128
<li><a href="` + baseURLContent + `/Links" rel="nofollow">Links, Language bindings, Engine bindings</a></li>
129129
<li><a href="` + baseURLContent + `/Tips" rel="nofollow">Tips</a></li>
130130
</ul>
131-
<p>See commit <a href="http://localhost:3000/gogits/gogs/commit/65f1bf27bc" rel="nofollow"><code>65f1bf27bc</code></a></p>
132-
<p>Ideas and codes</p>
133-
<ul>
131+
<p dir="auto">See commit <a href="http://localhost:3000/gogits/gogs/commit/65f1bf27bc" rel="nofollow"><code>65f1bf27bc</code></a></p>
132+
<p dir="auto">Ideas and codes</p>
133+
<ul dir="auto">
134134
<li>Bezier widget (by <a href="` + AppURL + `r-lyeh" rel="nofollow">@r-lyeh</a>) <a href="http://localhost:3000/ocornut/imgui/issues/786" class="ref-issue" rel="nofollow">ocornut/imgui#786</a></li>
135135
<li>Bezier widget (by <a href="` + AppURL + `r-lyeh" rel="nofollow">@r-lyeh</a>) <a href="http://localhost:3000/gogits/gogs/issues/786" class="ref-issue" rel="nofollow">#786</a></li>
136136
<li>Node graph editors <a href="https://github.com/ocornut/imgui/issues/306" rel="nofollow">https://github.com/ocornut/imgui/issues/306</a></li>
137137
<li><a href="` + baseURLContent + `/memory_editor_example" rel="nofollow">Memory Editor</a></li>
138138
<li><a href="` + baseURLContent + `/plot_var_example" rel="nofollow">Plot var helper</a></li>
139139
</ul>
140140
`,
141-
`<h2 id="user-content-what-is-wine-staging">What is Wine Staging?</h2>
142-
<p><strong>Wine Staging</strong> on website <a href="http://wine-staging.com" rel="nofollow">wine-staging.com</a>.</p>
143-
<h2 id="user-content-quick-links">Quick Links</h2>
144-
<p>Here are some links to the most important topics. You can find the full list of pages at the sidebar.</p>
141+
`<h2 id="user-content-what-is-wine-staging" dir="auto">What is Wine Staging?</h2>
142+
<p dir="auto"><strong>Wine Staging</strong> on website <a href="http://wine-staging.com" rel="nofollow">wine-staging.com</a>.</p>
143+
<h2 id="user-content-quick-links" dir="auto">Quick Links</h2>
144+
<p dir="auto">Here are some links to the most important topics. You can find the full list of pages at the sidebar.</p>
145145
<table>
146146
<thead>
147147
<tr>
@@ -157,50 +157,50 @@ func testAnswers(baseURLContent, baseURLImages string) []string {
157157
</tbody>
158158
</table>
159159
`,
160-
`<p><a href="http://www.excelsiorjet.com/" rel="nofollow">Excelsior JET</a> allows you to create native executables for Windows, Linux and Mac OS X.</p>
161-
<ol>
160+
`<p dir="auto"><a href="http://www.excelsiorjet.com/" rel="nofollow">Excelsior JET</a> allows you to create native executables for Windows, Linux and Mac OS X.</p>
161+
<ol dir="auto">
162162
<li><a href="https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop" rel="nofollow">Package your libGDX application</a><br/>
163163
<a href="` + baseURLImages + `/images/1.png" rel="nofollow"><img src="` + baseURLImages + `/images/1.png" title="1.png" alt="images/1.png"/></a></li>
164164
<li>Perform a test run by hitting the Run! button.<br/>
165165
<a href="` + baseURLImages + `/images/2.png" rel="nofollow"><img src="` + baseURLImages + `/images/2.png" title="2.png" alt="images/2.png"/></a></li>
166166
</ol>
167-
<h2 id="user-content-custom-id">More tests</h2>
168-
<p>(from <a href="https://www.markdownguide.org/extended-syntax/" rel="nofollow">https://www.markdownguide.org/extended-syntax/</a>)</p>
169-
<h3 id="user-content-checkboxes">Checkboxes</h3>
170-
<ul>
167+
<h2 id="user-content-custom-id" dir="auto">More tests</h2>
168+
<p dir="auto">(from <a href="https://www.markdownguide.org/extended-syntax/" rel="nofollow">https://www.markdownguide.org/extended-syntax/</a>)</p>
169+
<h3 id="user-content-checkboxes" dir="auto">Checkboxes</h3>
170+
<ul dir="auto">
171171
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="434"/>unchecked</li>
172172
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="450" checked=""/>checked</li>
173173
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="464"/>still unchecked</li>
174174
</ul>
175-
<h3 id="user-content-definition-list">Definition list</h3>
175+
<h3 id="user-content-definition-list" dir="auto">Definition list</h3>
176176
<dl>
177177
<dt>First Term</dt>
178178
<dd>This is the definition of the first term.</dd>
179179
<dt>Second Term</dt>
180180
<dd>This is one definition of the second term.</dd>
181181
<dd>This is another definition of the second term.</dd>
182182
</dl>
183-
<h3 id="user-content-footnotes">Footnotes</h3>
184-
<p>Here is a simple footnote,<sup id="fnref:user-content-1"><a href="#fn:user-content-1" rel="nofollow">1</a></sup> and here is a longer one.<sup id="fnref:user-content-bignote"><a href="#fn:user-content-bignote" rel="nofollow">2</a></sup></p>
183+
<h3 id="user-content-footnotes" dir="auto">Footnotes</h3>
184+
<p dir="auto">Here is a simple footnote,<sup id="fnref:user-content-1"><a href="#fn:user-content-1" rel="nofollow">1</a></sup> and here is a longer one.<sup id="fnref:user-content-bignote"><a href="#fn:user-content-bignote" rel="nofollow">2</a></sup></p>
185185
<div>
186186
<hr/>
187-
<ol>
187+
<ol dir="auto">
188188
<li id="fn:user-content-1">
189-
<p>This is the first footnote. <a href="#fnref:user-content-1" rel="nofollow">↩︎</a></p>
189+
<p dir="auto">This is the first footnote. <a href="#fnref:user-content-1" rel="nofollow">↩︎</a></p>
190190
</li>
191191
<li id="fn:user-content-bignote">
192-
<p>Here is one with multiple paragraphs and code.</p>
193-
<p>Indent paragraphs to include them in the footnote.</p>
194-
<p><code>{ my code }</code></p>
195-
<p>Add as many paragraphs as you like. <a href="#fnref:user-content-bignote" rel="nofollow">↩︎</a></p>
192+
<p dir="auto">Here is one with multiple paragraphs and code.</p>
193+
<p dir="auto">Indent paragraphs to include them in the footnote.</p>
194+
<p dir="auto"><code>{ my code }</code></p>
195+
<p dir="auto">Add as many paragraphs as you like. <a href="#fnref:user-content-bignote" rel="nofollow">↩︎</a></p>
196196
</li>
197197
</ol>
198198
</div>
199-
`, `<ul>
199+
`, `<ul dir="auto">
200200
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="3"/> If you want to rebase/retry this PR, click this checkbox.</li>
201201
</ul>
202202
<hr/>
203-
<p>This PR has been generated by <a href="https://github.com/renovatebot/renovate" rel="nofollow">Renovate Bot</a>.</p>
203+
<p dir="auto">This PR has been generated by <a href="https://github.com/renovatebot/renovate" rel="nofollow">Renovate Bot</a>.</p>
204204
`,
205205
}
206206
}
@@ -304,12 +304,12 @@ func TestTotal_RenderUncyclo(t *testing.T) {
304304
// Guard wiki sidebar: special syntax
305305
`[[Guardfile-DSL / Configuring-Guard|Guardfile-DSL---Configuring-Guard]]`,
306306
// rendered
307-
`<p><a href="` + AppSubURL + `wiki/Guardfile-DSL---Configuring-Guard" rel="nofollow">Guardfile-DSL / Configuring-Guard</a></p>
307+
`<p dir="auto"><a href="` + AppSubURL + `wiki/Guardfile-DSL---Configuring-Guard" rel="nofollow">Guardfile-DSL / Configuring-Guard</a></p>
308308
`,
309309
// special syntax
310310
`[[Name|Link]]`,
311311
// rendered
312-
`<p><a href="` + AppSubURL + `wiki/Link" rel="nofollow">Name</a></p>
312+
`<p dir="auto"><a href="` + AppSubURL + `wiki/Link" rel="nofollow">Name</a></p>
313313
`,
314314
}
315315

@@ -401,7 +401,7 @@ func TestRenderSiblingImages_Issue12925(t *testing.T) {
401401
testcase := `![image1](/image1)
402402
![image2](/image2)
403403
`
404-
expected := `<p><a href="/image1" target="_blank" rel="nofollow noopener"><img src="/image1" alt="image1"></a><br>
404+
expected := `<p dir="auto"><a href="/image1" target="_blank" rel="nofollow noopener"><img src="/image1" alt="image1"></a><br>
405405
<a href="/image2" target="_blank" rel="nofollow noopener"><img src="/image2" alt="image2"></a></p>
406406
`
407407
res, err := RenderRawString(&markup.RenderContext{Ctx: git.DefaultContext}, testcase)
@@ -411,7 +411,7 @@ func TestRenderSiblingImages_Issue12925(t *testing.T) {
411411

412412
func TestRenderEmojiInLinks_Issue12331(t *testing.T) {
413413
testcase := `[Link with emoji :moon: in text](https://gitea.io)`
414-
expected := `<p><a href="https://gitea.io" rel="nofollow">Link with emoji <span class="emoji" aria-label="waxing gibbous moon">🌔</span> in text</a></p>
414+
expected := `<p dir="auto"><a href="https://gitea.io" rel="nofollow">Link with emoji <span class="emoji" aria-label="waxing gibbous moon">🌔</span> in text</a></p>
415415
`
416416
res, err := RenderString(&markup.RenderContext{Ctx: git.DefaultContext}, testcase)
417417
assert.NoError(t, err)
@@ -426,23 +426,23 @@ func TestColorPreview(t *testing.T) {
426426
}{
427427
{ // hex
428428
"`#FF0000`",
429-
`<p><code>#FF0000<span class="color-preview" style="background-color: #FF0000"></span></code></p>` + nl,
429+
`<p dir="auto"><code>#FF0000<span class="color-preview" style="background-color: #FF0000"></span></code></p>` + nl,
430430
},
431431
{ // rgb
432432
"`rgb(16, 32, 64)`",
433-
`<p><code>rgb(16, 32, 64)<span class="color-preview" style="background-color: rgb(16, 32, 64)"></span></code></p>` + nl,
433+
`<p dir="auto"><code>rgb(16, 32, 64)<span class="color-preview" style="background-color: rgb(16, 32, 64)"></span></code></p>` + nl,
434434
},
435435
{ // short hex
436436
"This is the color white `#000`",
437-
`<p>This is the color white <code>#000<span class="color-preview" style="background-color: #000"></span></code></p>` + nl,
437+
`<p dir="auto">This is the color white <code>#000<span class="color-preview" style="background-color: #000"></span></code></p>` + nl,
438438
},
439439
{ // hsl
440440
"HSL stands for hue, saturation, and lightness. An example: `hsl(0, 100%, 50%)`.",
441-
`<p>HSL stands for hue, saturation, and lightness. An example: <code>hsl(0, 100%, 50%)<span class="color-preview" style="background-color: hsl(0, 100%, 50%)"></span></code>.</p>` + nl,
441+
`<p dir="auto">HSL stands for hue, saturation, and lightness. An example: <code>hsl(0, 100%, 50%)<span class="color-preview" style="background-color: hsl(0, 100%, 50%)"></span></code>.</p>` + nl,
442442
},
443443
{ // uppercase hsl
444444
"HSL stands for hue, saturation, and lightness. An example: `HSL(0, 100%, 50%)`.",
445-
`<p>HSL stands for hue, saturation, and lightness. An example: <code>HSL(0, 100%, 50%)<span class="color-preview" style="background-color: HSL(0, 100%, 50%)"></span></code>.</p>` + nl,
445+
`<p dir="auto">HSL stands for hue, saturation, and lightness. An example: <code>HSL(0, 100%, 50%)<span class="color-preview" style="background-color: HSL(0, 100%, 50%)"></span></code>.</p>` + nl,
446446
},
447447
}
448448

@@ -481,31 +481,31 @@ func TestMathBlock(t *testing.T) {
481481
}{
482482
{
483483
"$a$",
484-
`<p><code class="language-math is-loading">a</code></p>` + nl,
484+
`<p dir="auto"><code class="language-math is-loading">a</code></p>` + nl,
485485
},
486486
{
487487
"$ a $",
488-
`<p><code class="language-math is-loading">a</code></p>` + nl,
488+
`<p dir="auto"><code class="language-math is-loading">a</code></p>` + nl,
489489
},
490490
{
491491
"$a$ $b$",
492-
`<p><code class="language-math is-loading">a</code> <code class="language-math is-loading">b</code></p>` + nl,
492+
`<p dir="auto"><code class="language-math is-loading">a</code> <code class="language-math is-loading">b</code></p>` + nl,
493493
},
494494
{
495495
`\(a\) \(b\)`,
496-
`<p><code class="language-math is-loading">a</code> <code class="language-math is-loading">b</code></p>` + nl,
496+
`<p dir="auto"><code class="language-math is-loading">a</code> <code class="language-math is-loading">b</code></p>` + nl,
497497
},
498498
{
499499
`$a a$b b$`,
500-
`<p><code class="language-math is-loading">a a$b b</code></p>` + nl,
500+
`<p dir="auto"><code class="language-math is-loading">a a$b b</code></p>` + nl,
501501
},
502502
{
503503
`a a$b b`,
504-
`<p>a a$b b</p>` + nl,
504+
`<p dir="auto">a a$b b</p>` + nl,
505505
},
506506
{
507507
`a$b $a a$b b$`,
508-
`<p>a$b <code class="language-math is-loading">a a$b b</code></p>` + nl,
508+
`<p dir="auto">a$b <code class="language-math is-loading">a a$b b</code></p>` + nl,
509509
},
510510
{
511511
"$$a$$",

0 commit comments

Comments
 (0)