]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
markup: Fix typo in function and struct names
authorOleksandr Redko <Oleksandr_Redko@epam.com>
Tue, 23 May 2023 13:31:36 +0000 (16:31 +0300)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 1 Jun 2023 15:59:44 +0000 (17:59 +0200)
markup/highlight/config.go
markup/highlight/highlight.go
markup/internal/attributes/attributes.go
tpl/transform/transform.go

index ca065fd2dd03cb86abbfc71187d58b57f6c7fc1a..62db6b237eebba866425be801c9d5134349e0417 100644 (file)
@@ -136,7 +136,7 @@ func applyOptions(opts any, cfg *Config) error {
 }
 
 func applyOptionsFromString(opts string, cfg *Config) error {
-       optsm, err := parseHightlightOptions(opts)
+       optsm, err := parseHighlightOptions(opts)
        if err != nil {
                return err
        }
@@ -188,7 +188,7 @@ func ApplyLegacyConfig(cfg config.Provider, conf *Config) error {
        return nil
 }
 
-func parseHightlightOptions(in string) (map[string]any, error) {
+func parseHighlightOptions(in string) (map[string]any, error) {
        in = strings.Trim(in, " ")
        opts := make(map[string]any)
 
index e2a4ccdb9f4871ac832f30fa798bc38d2bef4458..c70659a09a38cfae9241891e315aa358cc17c32a 100644 (file)
@@ -33,8 +33,8 @@ import (
        "github.com/gohugoio/hugo/markup/internal/attributes"
 )
 
-// Markdown attributes used by the Chroma hightlighter.
-var chromaHightlightProcessingAttributes = map[string]bool{
+// Markdown attributes used by the Chroma highlighter.
+var chromaHighlightProcessingAttributes = map[string]bool{
        "anchorLineNos":      true,
        "guessSyntax":        true,
        "hl_Lines":           true,
@@ -48,8 +48,8 @@ var chromaHightlightProcessingAttributes = map[string]bool{
 }
 
 func init() {
-       for k, v := range chromaHightlightProcessingAttributes {
-               chromaHightlightProcessingAttributes[strings.ToLower(k)] = v
+       for k, v := range chromaHighlightProcessingAttributes {
+               chromaHighlightProcessingAttributes[strings.ToLower(k)] = v
        }
 }
 
@@ -61,7 +61,7 @@ func New(cfg Config) Highlighter {
 
 type Highlighter interface {
        Highlight(code, lang string, opts any) (string, error)
-       HighlightCodeBlock(ctx hooks.CodeblockContext, opts any) (HightlightResult, error)
+       HighlightCodeBlock(ctx hooks.CodeblockContext, opts any) (HighlightResult, error)
        hooks.CodeBlockRenderer
        hooks.IsDefaultCodeBlockRendererProvider
 }
@@ -84,7 +84,7 @@ func (h chromaHighlighter) Highlight(code, lang string, opts any) (string, error
        return b.String(), nil
 }
 
-func (h chromaHighlighter) HighlightCodeBlock(ctx hooks.CodeblockContext, opts any) (HightlightResult, error) {
+func (h chromaHighlighter) HighlightCodeBlock(ctx hooks.CodeblockContext, opts any) (HighlightResult, error) {
        cfg := h.cfg
 
        var b strings.Builder
@@ -94,21 +94,21 @@ func (h chromaHighlighter) HighlightCodeBlock(ctx hooks.CodeblockContext, opts a
        options := ctx.Options()
 
        if err := applyOptionsFromMap(options, &cfg); err != nil {
-               return HightlightResult{}, err
+               return HighlightResult{}, err
        }
 
        // Apply these last so the user can override them.
        if err := applyOptions(opts, &cfg); err != nil {
-               return HightlightResult{}, err
+               return HighlightResult{}, err
        }
 
        if err := applyOptionsFromCodeBlockContext(ctx, &cfg); err != nil {
-               return HightlightResult{}, err
+               return HighlightResult{}, err
        }
 
        low, high, err := highlight(&b, ctx.Inner(), ctx.Type(), attributes, cfg)
        if err != nil {
-               return HightlightResult{}, err
+               return HighlightResult{}, err
        }
 
        highlighted := b.String()
@@ -116,7 +116,7 @@ func (h chromaHighlighter) HighlightCodeBlock(ctx hooks.CodeblockContext, opts a
                high = len(highlighted)
        }
 
-       return HightlightResult{
+       return HighlightResult{
                highlighted: template.HTML(highlighted),
                innerLow:    low,
                innerHigh:   high,
@@ -153,20 +153,20 @@ func (h chromaHighlighter) GetIdentity() identity.Identity {
        return id
 }
 
-// HightlightResult holds the result of an highlighting operation.
-type HightlightResult struct {
+// HighlightResult holds the result of an highlighting operation.
+type HighlightResult struct {
        innerLow    int
        innerHigh   int
        highlighted template.HTML
 }
 
 // Wrapped returns the highlighted code wrapped in a <div>, <pre> and <code> tag.
-func (h HightlightResult) Wrapped() template.HTML {
+func (h HighlightResult) Wrapped() template.HTML {
        return h.highlighted
 }
 
 // Inner returns the highlighted code without the wrapping <div>, <pre> and <code> tag, suitable for inline use.
-func (h HightlightResult) Inner() template.HTML {
+func (h HighlightResult) Inner() template.HTML {
        return h.highlighted[h.innerLow:h.innerHigh]
 }
 
index d2c8a860f613ce2a7aded78d212dc6551323e565..91181c78c32a582a62a9c5743b9c60bd3333ff36 100644 (file)
@@ -26,7 +26,7 @@ import (
 )
 
 // Markdown attributes used as options by the Chroma highlighter.
-var chromaHightlightProcessingAttributes = map[string]bool{
+var chromaHighlightProcessingAttributes = map[string]bool{
        "anchorLineNos":      true,
        "guessSyntax":        true,
        "hl_Lines":           true,
@@ -42,8 +42,8 @@ var chromaHightlightProcessingAttributes = map[string]bool{
 }
 
 func init() {
-       for k, v := range chromaHightlightProcessingAttributes {
-               chromaHightlightProcessingAttributes[strings.ToLower(k)] = v
+       for k, v := range chromaHighlightProcessingAttributes {
+               chromaHighlightProcessingAttributes[strings.ToLower(k)] = v
        }
 }
 
@@ -101,7 +101,7 @@ func New(astAttributes []ast.Attribute, ownerType AttributesOwnerType) *Attribut
                        panic(fmt.Sprintf("not implemented: %T", vvv))
                }
 
-               if ownerType == AttributesOwnerCodeBlockChroma && chromaHightlightProcessingAttributes[nameLower] {
+               if ownerType == AttributesOwnerCodeBlockChroma && chromaHighlightProcessingAttributes[nameLower] {
                        attr := Attribute{Name: string(v.Name), Value: vv}
                        opts = append(opts, attr)
                } else {
index 0f9ad61d4962ef6eb51de35317d93ee3da268e7a..d943b0b5752beea996a23b70392faafef6ecf6bb 100644 (file)
@@ -81,7 +81,7 @@ func (ns *Namespace) Highlight(s any, lang string, opts ...any) (template.HTML,
 }
 
 // HighlightCodeBlock highlights a code block on the form received in the codeblock render hooks.
-func (ns *Namespace) HighlightCodeBlock(ctx hooks.CodeblockContext, opts ...any) (highlight.HightlightResult, error) {
+func (ns *Namespace) HighlightCodeBlock(ctx hooks.CodeblockContext, opts ...any) (highlight.HighlightResult, error) {
        var optsv any
        if len(opts) > 0 {
                optsv = opts[0]