Compare commits

...

5 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen be2c634751 Fix tests for Go 1.21.1
Fixes #11450
2023-09-14 12:35:55 +02:00
Joe Mooring 75c0f88289 commands/gen: Remove default highlight style
Fixes #11445
2023-09-14 12:08:52 +02:00
Bjørn Erik Pedersen 18ce854626 Fix recently broken benchmark 2023-09-12 11:50:31 +02:00
Bjørn Erik Pedersen 69f5bad40f Adjust baseline benchmarks 2023-09-12 10:48:04 +02:00
ilmari-lauhakangas 525bed9919 commands: Print language code after web server address info 2023-09-11 11:38:24 +02:00
5 changed files with 36 additions and 11 deletions
+2 -2
View File
@@ -76,7 +76,7 @@ See https://xyproto.github.io/splash/docs/all.html for a preview of the availabl
},
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.PersistentFlags().StringVar(&style, "style", "friendly", "highlighter style (see https://xyproto.github.io/splash/docs/)")
cmd.PersistentFlags().StringVar(&highlightStyle, "highlightStyle", "bg:#ffffcc", "style used for highlighting lines (see https://github.com/alecthomas/chroma)")
cmd.PersistentFlags().StringVar(&highlightStyle, "highlightStyle", "", "style used for highlighting lines (see https://github.com/alecthomas/chroma)")
cmd.PersistentFlags().StringVar(&linesStyle, "linesStyle", "", "style used for line numbers (see https://github.com/alecthomas/chroma)")
},
}
@@ -136,7 +136,7 @@ url: %s
long: `Generate Markdown documentation for the Hugo CLI.
This command is, mostly, used to create up-to-date documentation
of Hugo's command-line interface for https://gohugo.io/.
It creates one Markdown file per command with front matter suitable
for rendering in Hugo.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
+2 -2
View File
@@ -927,7 +927,7 @@ func (c *serverCommand) serve() error {
for i := range baseURLs {
mu, listener, serverURL, endpoint, err := srv.createEndpoint(i)
var srv *http.Server
var srv *http.Server
if c.tlsCertFile != "" && c.tlsKeyFile != "" {
srv = &http.Server{
Addr: endpoint,
@@ -954,7 +954,7 @@ func (c *serverCommand) serve() error {
mu.HandleFunc(u.Path+"/livereload.js", livereload.ServeJS)
mu.HandleFunc(u.Path+"/livereload", livereload.Handler)
}
c.r.Printf("Web Server is available at %s (bind address %s)\n", serverURL, c.serverInterface)
c.r.Printf("Web Server is available at %s (bind address %s) %s\n", serverURL, c.serverInterface, roots[i])
wg1.Go(func() error {
if c.tlsCertFile != "" && c.tlsKeyFile != "" {
err = srv.ServeTLS(listener, c.tlsCertFile, c.tlsKeyFile)
+30 -5
View File
@@ -330,7 +330,7 @@ The content.
func TestBenchmarkBaseline(t *testing.T) {
cfg := IntegrationTestConfig{
T: t,
TxtarString: benchmarkBaselineFiles(),
TxtarString: benchmarkBaselineFiles(true),
}
b := NewIntegrationTestBuilder(cfg).Build()
@@ -346,7 +346,7 @@ func BenchmarkBaseline(b *testing.B) {
b.Run("withrender", func(b *testing.B) {
cfg := IntegrationTestConfig{
T: b,
TxtarString: benchmarkBaselineFiles(),
TxtarString: benchmarkBaselineFiles(false),
}
builders := make([]*IntegrationTestBuilder, b.N)
@@ -363,7 +363,27 @@ func BenchmarkBaseline(b *testing.B) {
b.Run("skiprender", func(b *testing.B) {
cfg := IntegrationTestConfig{
T: b,
TxtarString: benchmarkBaselineFiles(),
TxtarString: benchmarkBaselineFiles(false),
BuildCfg: BuildCfg{
SkipRender: true,
},
}
builders := make([]*IntegrationTestBuilder, b.N)
for i := range builders {
builders[i] = NewIntegrationTestBuilder(cfg)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
builders[i].Build()
}
})
b.Run("skiprender leaf", func(b *testing.B) {
cfg := IntegrationTestConfig{
T: b,
TxtarString: benchmarkBaselineFiles(false),
BuildCfg: BuildCfg{
SkipRender: true,
},
@@ -381,7 +401,7 @@ func BenchmarkBaseline(b *testing.B) {
})
}
func benchmarkBaselineFiles() string {
func benchmarkBaselineFiles(leafBundles bool) string {
rnd := rand.New(rand.NewSource(32))
@@ -466,7 +486,12 @@ Aliqua labore enim et sint anim amet excepteur ea dolore.
files += fmt.Sprintf("\n-- content/%s/%s/%s/_index.md --\n"+contentTemplate, lang, root, section, n, n, n)
for k := 1; k < rnd.Intn(30)+1; k++ {
n := n + k
files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, n, n, n)
ns := fmt.Sprintf("%d", n)
if leafBundles {
ns = fmt.Sprintf("%d/index", n)
}
file := fmt.Sprintf("\n-- content/%s/%s/%s/p%s.md --\n"+contentTemplate, lang, root, section, ns, n, n)
files += file
}
}
}
+1 -1
View File
@@ -398,7 +398,7 @@ func testSetupFunc() func(env *testscript.Env) error {
goVersion := runtime.Version()
goVersion = strings.TrimPrefix(goVersion, "go")
if !strings.HasSuffix(goVersion, ".0") {
if strings.HasPrefix(goVersion, "1.20") {
// Strip patch version.
goVersion = goVersion[:strings.LastIndex(goVersion, ".")]
}
+1 -1
View File
@@ -16,4 +16,4 @@ checkfilecount $NUM_COMMANDS manpages
hugo gen chromastyles -h
stdout 'Generate CSS stylesheet for the Chroma code highlighter'
hugo gen chromastyles --style monokai
stdout 'color: #f8f8f2'
stdout '/\* LineHighlight \*/ \.chroma \.hl \{ background-color: #3c3d38 \}'