fuck goldmark
This commit is contained in:
parent
98b9ef6589
commit
5b1bf5951a
Binary file not shown.
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"git.handmade.network/hmn/hmn/src/hmnurl"
|
"git.handmade.network/hmn/hmn/src/hmnurl"
|
||||||
"git.handmade.network/hmn/hmn/src/oops"
|
"git.handmade.network/hmn/hmn/src/oops"
|
||||||
|
"git.handmade.network/hmn/hmn/src/utils"
|
||||||
"github.com/alecthomas/chroma"
|
"github.com/alecthomas/chroma"
|
||||||
chromahtml "github.com/alecthomas/chroma/formatters/html"
|
chromahtml "github.com/alecthomas/chroma/formatters/html"
|
||||||
"github.com/alecthomas/chroma/lexers"
|
"github.com/alecthomas/chroma/lexers"
|
||||||
|
@ -117,6 +118,15 @@ func init() {
|
||||||
return htm("a", attrs{"href": hmnurl.BuildEducationGlossary(term), "class": "glossary-term", "data-term": term}), true
|
return htm("a", attrs{"href": hmnurl.BuildEducationGlossary(term), "class": "glossary-term", "data-term": term}), true
|
||||||
})
|
})
|
||||||
addSimpleTag(education, "note", "div", false, attrs{"class": "education-note"})
|
addSimpleTag(education, "note", "div", false, attrs{"class": "education-note"})
|
||||||
|
addTag(education, "resource", func(bn *bbcode.BBCodeNode) (*bbcode.HTMLTag, bool) {
|
||||||
|
name, _ := bn.GetOpeningTag().Args["name"]
|
||||||
|
url, _ := bn.GetOpeningTag().Args["url"]
|
||||||
|
|
||||||
|
res := htm("a", attrs{"class": "education-resource", "href": url, "target": "_blank"},
|
||||||
|
htm("h2", nil, bbcode.NewHTMLTag(utils.OrDefault(name, `hey you, do name="Some Resource" url="whatever"`))),
|
||||||
|
)
|
||||||
|
return res, true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type attrs map[string]string
|
type attrs map[string]string
|
||||||
|
|
|
@ -76,6 +76,11 @@ func main() {
|
||||||
assert.Equal(t, 1, strings.Count(html, "<div"))
|
assert.Equal(t, 1, strings.Count(html, "<div"))
|
||||||
assert.Contains(t, html, `class="education-note"`)
|
assert.Contains(t, html, `class="education-note"`)
|
||||||
})
|
})
|
||||||
|
t.Run("[resource]", func(t *testing.T) {
|
||||||
|
html := ParseMarkdown(`[resource name="cool name" url="blep"]Excellent description.[/resource]`, EducationRealMarkdown)
|
||||||
|
t.Log(html)
|
||||||
|
t.Fail()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html{{ if .OpenGraphItems }} prefix="og: http://ogp.me/ns#"{{ end }}>
|
<!DOCTYPE html>
|
||||||
<html lang="en-US">
|
<html lang="en-US" {{ if .OpenGraphItems }} prefix="og: http://ogp.me/ns#"{{ end }}>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
Loading…
Reference in New Issue