File tree Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ import (
1515 "strings"
1616
1717 "code.gitea.io/gitea/modules/log"
18- "code.gitea.io/gitea/modules/markup/external"
1918 "code.gitea.io/gitea/modules/setting"
2019 "code.gitea.io/gitea/routers"
2120 "code.gitea.io/gitea/routers/routes"
@@ -111,8 +110,6 @@ func runWeb(ctx *cli.Context) error {
111110
112111 routers .GlobalInit ()
113112
114- external .RegisterParsers ()
115-
116113 m := routes .NewMacaron ()
117114 routes .RegisterRoutes (m )
118115
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
2020 "strconv"
2121 "time"
2222
23+ "code.gitea.io/gitea/modules/markup"
2324 "code.gitea.io/gitea/modules/markup/external"
2425 "code.gitea.io/gitea/routers"
2526 "code.gitea.io/gitea/routers/routes"
@@ -113,6 +114,7 @@ func runPR() {
113114 log .Printf ("[PR] Setting up router\n " )
114115 //routers.GlobalInit()
115116 external .RegisterParsers ()
117+ markup .Init ()
116118 m := routes .NewMacaron ()
117119 routes .RegisterRoutes (m )
118120
Original file line number Diff line number Diff line change @@ -15,6 +15,14 @@ import (
1515func Init () {
1616 getIssueFullPattern ()
1717 NewSanitizer ()
18+
19+ // since setting maybe changed extensions, this will reload all parser extensions mapping
20+ extParsers = make (map [string ]Parser )
21+ for _ , parser := range parsers {
22+ for _ , ext := range parser .Extensions () {
23+ extParsers [strings .ToLower (ext )] = parser
24+ }
25+ }
1826}
1927
2028// Parser defines an interface for parsering markup file to HTML
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
2020 "code.gitea.io/gitea/modules/log"
2121 "code.gitea.io/gitea/modules/mailer"
2222 "code.gitea.io/gitea/modules/markup"
23+ "code.gitea.io/gitea/modules/markup/external"
2324 "code.gitea.io/gitea/modules/setting"
2425 "code.gitea.io/gitea/modules/ssh"
2526
@@ -76,6 +77,7 @@ func GlobalInit() {
7677
7778 if setting .InstallLock {
7879 highlight .NewContext ()
80+ external .RegisterParsers ()
7981 markup .Init ()
8082 if err := initDBEngine (); err == nil {
8183 log .Info ("ORM engine initialization successful!" )
You can’t perform that action at this time.
0 commit comments