1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-05 13:05:18 +02:00

Simplify configuration of HTML call.

This commit is contained in:
Alec Thomas 2019-11-28 11:20:45 +11:00
parent 3b4f493cc3
commit 2d34ebacdb
2 changed files with 7 additions and 19 deletions

View File

@ -169,24 +169,12 @@ func configureHTMLFormatter(ctx *kong.Context) {
options := []html.Option{
html.TabWidth(cli.HTMLTabWidth),
html.BaseLineNumber(cli.HTMLBaseLine),
}
if cli.HTMLPrefix != "" {
options = append(options, html.ClassPrefix(cli.HTMLPrefix))
}
if !cli.HTMLInlineStyles {
options = append(options, html.WithClasses(true))
}
if !cli.HTMLOnly {
options = append(options, html.Standalone(true))
}
if cli.HTMLLines {
options = append(options, html.WithLineNumbers(true))
}
if cli.HTMLLinesTable {
options = append(options, html.LineNumbersInTable(true))
}
if cli.HTMLPreventSurroundingPre {
options = append(options, html.PreventSurroundingPre(true))
html.ClassPrefix(cli.HTMLPrefix),
html.WithClasses(!cli.HTMLInlineStyles),
html.Standalone(!cli.HTMLOnly),
html.WithLineNumbers(cli.HTMLLines),
html.LineNumbersInTable(cli.HTMLLinesTable),
html.PreventSurroundingPre(cli.HTMLPreventSurroundingPre),
}
if len(cli.HTMLHighlight) > 0 {
ranges := [][2]int{}

View File

@ -153,7 +153,7 @@ func main() {
}
ctx := kong.Parse(&cli, kong.Configuration(konghcl.Loader))
log.Println("Starting")
log.Printf("Starting on http://%s\n", cli.Bind)
router := mux.NewRouter()
router.Handle("/", http.HandlerFunc(index)).Methods("GET")