diff options
Diffstat (limited to 'pkg/handler/git/handler.go')
-rw-r--r-- | pkg/handler/git/handler.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index 6fae146..5739c8e 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -27,18 +27,19 @@ import ( type ( GitHandler struct { gitService *service.GitService - readmePath string + config configurationRepository } configurationRepository interface { GetRootReadme() string + GetSyntaxHighlight() string } ) func NewGitHandler(gitService *service.GitService, confRepo configurationRepository) *GitHandler { return &GitHandler{ gitService: gitService, - readmePath: confRepo.GetRootReadme(), + config: confRepo, } } @@ -48,7 +49,7 @@ func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) error { return err } - f, err := os.Open(g.readmePath) + f, err := os.Open(g.config.GetRootReadme()) if err != nil { return err } @@ -280,7 +281,8 @@ func (g *GitHandler) Blob(w http.ResponseWriter, r *http.Request) error { filename := filepath.Base(rest) lexer := GetLexers(filename) - style := styles.Get("xcode") + style := styles.Get(g.config.GetSyntaxHighlight()) + formatter := html.New( html.WithLineNumbers(true), html.WithLinkableLineNumbers(true, "L"), |