diff --git a/public/style.css b/public/style.css
index 4a0eada..6a1df6c 100644
--- a/public/style.css
+++ b/public/style.css
@@ -6353,7 +6353,7 @@ input[type=submit]:not(.button-small), .notice {
.f3 {
font-size: 1.5rem; }
-.f4 {
+.f4, .edu-article .resource-title {
font-size: 1.25rem; }
.f5 {
@@ -8301,6 +8301,9 @@ nav.timecodes {
text-align: center;
margin: 10px 0; }
+.edu-article .resource-title {
+ font-weight: bold; }
+
.edu-article .note {
color: red; }
diff --git a/src/hmnurl/hmnurl_test.go b/src/hmnurl/hmnurl_test.go
index 16d4aed..3340c58 100644
--- a/src/hmnurl/hmnurl_test.go
+++ b/src/hmnurl/hmnurl_test.go
@@ -211,6 +211,10 @@ func TestEducationArticleDelete(t *testing.T) {
AssertRegexMatch(t, BuildEducationArticleDelete("foo"), RegexEducationArticleDelete, map[string]string{"slug": "foo"})
}
+func TestEducationRerender(t *testing.T) {
+ AssertRegexMatch(t, BuildEducationRerender(), RegexEducationRerender, nil)
+}
+
func TestForum(t *testing.T) {
AssertRegexMatch(t, hmn.BuildForum(nil, 1), RegexForum, nil)
AssertRegexMatch(t, hmn.BuildForum([]string{"wip"}, 2), RegexForum, map[string]string{"subforums": "wip", "page": "2"})
diff --git a/src/hmnurl/urls.go b/src/hmnurl/urls.go
index 9f56672..8708468 100644
--- a/src/hmnurl/urls.go
+++ b/src/hmnurl/urls.go
@@ -481,6 +481,12 @@ func BuildEducationArticleDelete(slug string) string {
return Url(fmt.Sprintf("/education/%s/delete", slug), nil)
}
+var RegexEducationRerender = regexp.MustCompile(`^/education/rerender$`)
+
+func BuildEducationRerender() string {
+ return Url("/education/rerender", nil)
+}
+
/*
* Forums
*/
diff --git a/src/parsing/ggcode.go b/src/parsing/ggcode.go
index e974909..50a83ba 100644
--- a/src/parsing/ggcode.go
+++ b/src/parsing/ggcode.go
@@ -60,7 +60,7 @@ var ggcodeTags = map[string]ggcodeTag{
Renderer: func(c ggcodeRendererContext, n *ggcodeNode, entering bool) error {
if entering {
c.W.WriteString(`
`)
- c.W.WriteString(fmt.Sprintf(`
%s
`, n.Args["url"], utils.OrDefault(n.Args["name"], "[missing `name`]")))
+ c.W.WriteString(fmt.Sprintf(`
%s`, n.Args["url"], utils.OrDefault(n.Args["name"], "[missing `name`]")))
} else {
c.W.WriteString("
")
}
@@ -212,17 +212,14 @@ type ggcodeDelimiterParser struct {
}
func (p ggcodeDelimiterParser) IsDelimiter(b byte) bool {
- fmt.Println("delmit", string(b))
return b == '(' || b == ')'
}
func (p ggcodeDelimiterParser) CanOpenCloser(opener, closer *parser.Delimiter) bool {
- fmt.Println("oopen")
return opener.Char == '(' && closer.Char == ')'
}
func (p ggcodeDelimiterParser) OnMatch(consumes int) gast.Node {
- fmt.Println("out!")
return p.Node
}
diff --git a/src/rawdata/scss/_education.scss b/src/rawdata/scss/_education.scss
index f3c7d71..fd6ac17 100644
--- a/src/rawdata/scss/_education.scss
+++ b/src/rawdata/scss/_education.scss
@@ -3,6 +3,11 @@
@extend .pa3, .bg--dim, .br3;
}
+ .resource-title {
+ @extend .f4;
+ font-weight: bold;
+ }
+
.note {
color: red;
}
diff --git a/src/templates/src/education_index.html b/src/templates/src/education_index.html
index fd47052..a57aa34 100644
--- a/src/templates/src/education_index.html
+++ b/src/templates/src/education_index.html
@@ -40,4 +40,10 @@
+ {{ if and .User .User.IsEduAuthor }}
+
+ {{ end }}
{{ end }}
diff --git a/src/website/education.go b/src/website/education.go
index 9eb9b86..dba231a 100644
--- a/src/website/education.go
+++ b/src/website/education.go
@@ -25,6 +25,7 @@ func EducationIndex(c *RequestContext) ResponseData {
templates.BaseData
Articles []templates.EduArticle
NewArticleUrl string
+ RerenderUrl string
}
articles, err := fetchEduArticles(c, c.Conn, models.EduArticleTypeArticle, c.CurrentUser)
@@ -41,6 +42,7 @@ func EducationIndex(c *RequestContext) ResponseData {
BaseData: getBaseData(c, "Handmade Education", nil),
Articles: tmplArticles,
NewArticleUrl: hmnurl.BuildEducationArticleNew(),
+ RerenderUrl: hmnurl.BuildEducationRerender(),
}
var res ResponseData
@@ -232,6 +234,26 @@ func EducationArticleDeleteSubmit(c *RequestContext) ResponseData {
return res
}
+func EducationRerender(c *RequestContext) ResponseData {
+ everything := utils.Must1(fetchEduArticles(c, c.Conn, 0, c.CurrentUser))
+ for _, thing := range everything {
+ newHTML := parsing.ParseMarkdown(thing.CurrentVersion.ContentRaw, parsing.EducationRealMarkdown)
+ utils.Must1(c.Conn.Exec(c,
+ `
+ UPDATE education_article_version
+ SET content_html = $2
+ WHERE id = $1
+ `,
+ thing.CurrentVersionID,
+ newHTML,
+ ))
+ }
+
+ res := c.Redirect(hmnurl.BuildEducationIndex(), http.StatusSeeOther)
+ res.AddFutureNotice("success", "Rerendered all education content.")
+ return res
+}
+
func fetchEduArticles(
ctx context.Context,
dbConn db.ConnOrTx,
diff --git a/src/website/routes.go b/src/website/routes.go
index 4f225ae..5c7a3e6 100644
--- a/src/website/routes.go
+++ b/src/website/routes.go
@@ -123,6 +123,7 @@ func NewWebsiteRoutes(conn *pgxpool.Pool) http.Handler {
educationPrerelease.GET(hmnurl.RegexEducationGlossary, EducationGlossary)
educationPrerelease.GET(hmnurl.RegexEducationArticleNew, educationAuthorsOnly(EducationArticleNew))
educationPrerelease.POST(hmnurl.RegexEducationArticleNew, educationAuthorsOnly(EducationArticleNewSubmit))
+ educationPrerelease.GET(hmnurl.RegexEducationRerender, educationAuthorsOnly(EducationRerender))
educationPrerelease.GET(hmnurl.RegexEducationArticle, EducationArticle) // Article stuff must be last so `/glossary` and others do not match as an article slug
educationPrerelease.GET(hmnurl.RegexEducationArticleEdit, educationAuthorsOnly(EducationArticleEdit))
educationPrerelease.POST(hmnurl.RegexEducationArticleEdit, educationAuthorsOnly(EducationArticleEditSubmit))