Fix: UTF-8 support (part 2)

main
Leonid Maslakov 5 months ago
parent 2005fdb3bf
commit 8468839182
  1. 4
      highlight_dockerfile_test.go
  2. 4
      highlight_share_openclose.go
  3. 4
      highlight_share_word.go

@ -58,10 +58,14 @@ FROMalpine
Input: `
# Комментарий.
# Ещё один комментарий.
CMD [ "python", "./main.py" ]
`,
ExpectResult: `
<span class='` + StyleComment + `'># Комментарий.</span>
<span class='` + StyleComment + `'># Ещё один комментарий.</span>
<span class='` + StyleKeyword + `'>CMD</span> [ <span class='` + StyleBrackets + `'>"python"</span>, <span class='` + StyleBrackets + `'>"./main.py"</span> ]
`,
},
{

@ -58,14 +58,14 @@ func formatOpenClose(text string, openStr string, closeStr string, styleClass st
// Find <span
if textLen > i+5 {
if text[i:i+5] == "<span" {
if string(textRune[i:i+5]) == "<span" {
otherSpanTagOpen = otherSpanTagOpen + 1
}
}
// Find </span>
if textLen > i+7 {
if text[i:i+7] == "</span>" {
if string(textRune[i:i+7]) == "</span>" {
otherSpanTagOpen = otherSpanTagOpen - 1
}
}

@ -85,14 +85,14 @@ func formatWord(line string, command string, cmdStartChars []string, cmdEndChars
// Find <span
if lineLen > i+5 {
if line[i:i+5] == "<span" {
if string(lineRune[i:i+5]) == "<span" {
otherSpanTagOpen = otherSpanTagOpen + 1
}
}
// Find </span>
if lineLen > i+7 {
if line[i:i+7] == "</span>" {
if string(lineRune[i:i+7]) == "</span>" {
otherSpanTagOpen = otherSpanTagOpen - 1
}
}

Loading…
Cancel
Save