Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

Commit

Permalink
上一个改动不小心去除了 iframe 属性的附加功能
Browse files Browse the repository at this point in the history
  • Loading branch information
2234839 committed Aug 18, 2021
1 parent 0ed3e1a commit 5092c03
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/render/ocean_press_render.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,19 @@ func (r *OceanPressRender) renderAudio(node *ast.Node, entering bool) ast.WalkSt
return ast.WalkContinue
}

func (r *OceanPressRender) renderIFrame(node *ast.Node, entering bool) ast.WalkStatus {
if entering {
r.Tag("div", [][]string{{"class", "iframe"}}, false)
tokens := node.Tokens
if r.Options.Sanitize {
tokens = sanitize(tokens)
}
tokens = r.tagSrcPath(tokens)
r.Write(tokens)
r.Tag("/div", nil, false)
}
return ast.WalkContinue
}
// func (r *OceanPressRender) renderIFrame(node *ast.Node, entering bool) ast.WalkStatus {
// if entering {
// r.Tag("div", [][]string{{"class", "iframe"}}, false)
// tokens := node.Tokens
// if r.Options.Sanitize {
// tokens = sanitize(tokens)
// }
// tokens = r.tagSrcPath(tokens)
// r.Write(tokens)
// r.Tag("/div", nil, false)
// }
// return ast.WalkContinue
// }

// func (r *OceanPressRender) Render() (output []byte) {
// output = r.BaseRenderer.Render()
Expand Down
17 changes: 16 additions & 1 deletion src/render/ocean_press_render_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,22 @@ func (r *OceanPressRender) Render() (html string, xml string) {

return html, xml
}

func (r *OceanPressRender) renderIFrame(node *ast.Node, entering bool) ast.WalkStatus {
if entering {
attr := [][]string{{"class", "iframe"}}
// 添加自定义属性
attr = append(attr, node.KramdownIAL...)
r.Tag("div", attr, false)
tokens := node.Tokens
if r.Options.Sanitize {
tokens = sanitize(tokens)
}
tokens = r.tagSrcPath(tokens)
r.Write(tokens)
r.Tag("/div", nil, false)
}
return ast.WalkContinue
}
// renderImage 为了实现居中效果
func (r *OceanPressRender) renderImage(node *ast.Node, entering bool) ast.WalkStatus {
if entering {
Expand Down

0 comments on commit 5092c03

Please sign in to comment.