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"
@@ -120,8 +119,6 @@ func runWeb(ctx *cli.Context) error {
120119
121120 routers .GlobalInit ()
122121
123- external .RegisterParsers ()
124-
125122 m := routes .NewMacaron ()
126123 routes .RegisterRoutes (m )
127124
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 @@ -19,6 +19,7 @@ import (
1919 "code.gitea.io/gitea/modules/log"
2020 "code.gitea.io/gitea/modules/mailer"
2121 "code.gitea.io/gitea/modules/markup"
22+ "code.gitea.io/gitea/modules/markup/external"
2223 "code.gitea.io/gitea/modules/setting"
2324 "code.gitea.io/gitea/modules/ssh"
2425
@@ -75,6 +76,7 @@ func GlobalInit() {
7576
7677 if setting .InstallLock {
7778 highlight .NewContext ()
79+ external .RegisterParsers ()
7880 markup .Init ()
7981 if err := initDBEngine (); err == nil {
8082 log .Info ("ORM engine initialization successful!" )
You can’t perform that action at this time.
0 commit comments