From bc34216afe80a8827e934bf37389ac9ba201592c Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sat, 20 Dec 2025 16:08:27 +1100 Subject: [PATCH] Fixing more spelling --- .../operators/anchor-and-alias-operators.md | 16 ++++++------- pkg/yqlib/encoder_toml.go | 6 ++--- pkg/yqlib/toml_test.go | 24 +++++++++---------- project-words.txt | 1 + 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/pkg/yqlib/doc/operators/anchor-and-alias-operators.md b/pkg/yqlib/doc/operators/anchor-and-alias-operators.md index b5dc62eb..97b4ec13 100644 --- a/pkg/yqlib/doc/operators/anchor-and-alias-operators.md +++ b/pkg/yqlib/doc/operators/anchor-and-alias-operators.md @@ -22,7 +22,7 @@ see https://yaml.org/type/merge.html Given a sample.yml file of: ```yaml -- &CENTER +- &CENTRE x: 1 y: 2 - &LEFT @@ -32,7 +32,7 @@ Given a sample.yml file of: r: 10 - &SMALL r: 1 -- !!merge <<: *CENTER +- !!merge <<: *CENTRE r: 10 ``` then @@ -288,7 +288,7 @@ see https://yaml.org/type/merge.html. This has the correct data, but the wrong k Given a sample.yml file of: ```yaml -- &CENTER +- &CENTRE x: 1 y: 2 - &LEFT @@ -299,7 +299,7 @@ Given a sample.yml file of: - &SMALL r: 1 - !!merge <<: - - *CENTER + - *CENTRE - *BIG ``` then @@ -318,7 +318,7 @@ see https://yaml.org/type/merge.html. This has the correct data, but the wrong k Given a sample.yml file of: ```yaml -- &CENTER +- &CENTRE x: 1 y: 2 - &LEFT @@ -401,7 +401,7 @@ Taken from https://yaml.org/type/merge.html. Same values as legacy, but with the Given a sample.yml file of: ```yaml -- &CENTER +- &CENTRE x: 1 y: 2 - &LEFT @@ -412,7 +412,7 @@ Given a sample.yml file of: - &SMALL r: 1 - !!merge <<: - - *CENTER + - *CENTRE - *BIG ``` then @@ -432,7 +432,7 @@ Taken from https://yaml.org/type/merge.html. Same values as legacy, but with the Given a sample.yml file of: ```yaml -- &CENTER +- &CENTRE x: 1 y: 2 - &LEFT diff --git a/pkg/yqlib/encoder_toml.go b/pkg/yqlib/encoder_toml.go index 3a415ef9..8d04b050 100644 --- a/pkg/yqlib/encoder_toml.go +++ b/pkg/yqlib/encoder_toml.go @@ -45,8 +45,8 @@ func (te *tomlEncoder) Encode(writer io.Writer, node *CandidateNode) error { } if te.prefs.ColorsEnabled { - colorized := te.colorizeToml(buf.Bytes()) - _, err := writer.Write(colorized) + colourised := te.colorizeToml(buf.Bytes()) + _, err := writer.Write(colourised) return err } @@ -547,7 +547,7 @@ func (te *tomlEncoder) colorizeToml(input []byte) []byte { boolColor := color.New(color.FgHiMagenta).SprintFunc() sectionColor := color.New(color.FgYellow, color.Bold).SprintFunc() - // Simple tokenization for TOML coloring + // Simple tokenization for TOML colouring i := 0 for i < len(toml) { ch := toml[i] diff --git a/pkg/yqlib/toml_test.go b/pkg/yqlib/toml_test.go index be478aa4..a7b98767 100644 --- a/pkg/yqlib/toml_test.go +++ b/pkg/yqlib/toml_test.go @@ -695,14 +695,14 @@ func TestTomlColorisationNumberBug(t *testing.T) { encoder := NewTomlEncoder() tomlEncoder := encoder.(*tomlEncoder) - // Test case that exposes the bug: "123-+-45" should NOT be colorized as a single number + // Test case that exposes the bug: "123-+-45" should NOT be colourised as a single number input := "A = 123-+-45\n" result := string(tomlEncoder.colorizeToml([]byte(input))) - // The bug causes "123-+-45" to be colorized as one token + // The bug causes "123-+-45" to be colourised as one token // It should stop at "123" because the next character '-' is not valid in this position if strings.Contains(result, "123-+-45") { - // Check if it's colorized as a single token (no color codes in the middle) + // Check if it's colourised as a single token (no color codes in the middle) idx := strings.Index(result, "123-+-45") // Look backwards for color code beforeIdx := idx - 1 @@ -722,8 +722,8 @@ func TestTomlColorisationNumberBug(t *testing.T) { if beforeIdx >= 0 && hasResetAfter { // The entire "123-+-45" is wrapped in color codes - this is the bug! - t.Errorf("BUG DETECTED: '123-+-45' is incorrectly colorized as a single number") - t.Errorf("Expected only '123' to be colorized as a number, but got the entire '123-+-45'") + t.Errorf("BUG DETECTED: '123-+-45' is incorrectly colourised as a single number") + t.Errorf("Expected only '123' to be colourised as a number, but got the entire '123-+-45'") t.Logf("Full output: %q", result) t.Fail() } @@ -740,13 +740,13 @@ func TestTomlColorisationNumberBug(t *testing.T) { name: "consecutive minuses", input: "A = 123--45\n", invalidSequence: "123--45", - description: "'123--45' should not be colorized as a single number", + description: "'123--45' should not be colourised as a single number", }, { name: "plus in middle", input: "A = 123+45\n", invalidSequence: "123+45", - description: "'123+45' should not be colorized as a single number", + description: "'123+45' should not be colourised as a single number", }, } @@ -791,7 +791,7 @@ func TestTomlColorisationNumberBug(t *testing.T) { t.Run(tt.name, func(t *testing.T) { result := tomlEncoder.colorizeToml([]byte(tt.input)) if len(result) == 0 { - t.Error("Expected non-empty colorized output") + t.Error("Expected non-empty colourised output") } }) } @@ -816,7 +816,7 @@ func TestTomlStringEscapeColourization(t *testing.T) { { name: "escaped quote at end", input: `A = "test\""` + "\n", - description: "String ending with escaped quote should be colorized correctly", + description: "String ending with escaped quote should be colourised correctly", }, { name: "escaped backslash then quote", @@ -826,7 +826,7 @@ func TestTomlStringEscapeColourization(t *testing.T) { { name: "escaped quote in middle", input: `A = "test\"middle"` + "\n", - description: "String with escaped quote in the middle should be colorized correctly", + description: "String with escaped quote in the middle should be colourised correctly", }, { name: "multiple escaped quotes", @@ -836,7 +836,7 @@ func TestTomlStringEscapeColourization(t *testing.T) { { name: "escaped newline", input: `A = "test\n"` + "\n", - description: "String with escaped newline should be colorized correctly", + description: "String with escaped newline should be colourised correctly", }, { name: "single quote with escaped single quote", @@ -850,7 +850,7 @@ func TestTomlStringEscapeColourization(t *testing.T) { // The test should not panic and should return some output result := tomlEncoder.colorizeToml([]byte(tt.input)) if len(result) == 0 { - t.Error("Expected non-empty colorized output") + t.Error("Expected non-empty colourised output") } // Check that the result contains the input string (with color codes) diff --git a/project-words.txt b/project-words.txt index 849331e1..9385bfd8 100644 --- a/project-words.txt +++ b/project-words.txt @@ -277,3 +277,4 @@ nohcl zclconf cty go-cty +Colorisation