mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-25 16:08:46 +09:00
Fix various bugs (#37096)
* Fix #36001 * Fix #35498 * Fix #35395 * Fix #35160 * Fix #35058 * Fix #35445
This commit is contained in:
@@ -583,3 +583,20 @@ func TestMarkdownLink(t *testing.T) {
|
||||
assert.Equal(t, `<p><a href="https://example.com/__init__.py" rel="nofollow">https://example.com/__init__.py</a></p>
|
||||
`, string(result))
|
||||
}
|
||||
|
||||
func TestMarkdownUlDir(t *testing.T) {
|
||||
defer test.MockVariableValue(&markup.RenderBehaviorForTesting.DisableAdditionalAttributes, false)()
|
||||
result, err := markdown.RenderString(markup.NewTestRenderContext(), `
|
||||
* a
|
||||
* b
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, `<ul dir="auto">
|
||||
<li>a
|
||||
<ul>
|
||||
<li>b</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
`, string(result))
|
||||
}
|
||||
|
||||
@@ -81,5 +81,16 @@ func (g *ASTTransformer) transformList(_ *markup.RenderContext, v *ast.List, rc
|
||||
v.AppendChild(v, newChild)
|
||||
}
|
||||
}
|
||||
g.applyElementDir(v)
|
||||
|
||||
nestedList := false
|
||||
for p := v.Parent(); p != nil; p = p.Parent() {
|
||||
if _, ok := p.(*ast.List); ok {
|
||||
nestedList = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !nestedList {
|
||||
// "dir=auto" should be only added to top-level "ul". https://github.com/go-gitea/gitea/issues/35058
|
||||
g.applyElementDir(v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user