mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-08-17 02:30:39 +03:00
🐛 Fix heading and link styling when color is disabled
This commit is contained in:
parent
5056bd303d
commit
bd6daa5a3c
@ -37,6 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Bottom bar is not in focus after clicking Enter
|
||||
- Badly formed links on pages can no longer crash the browser
|
||||
- Disabling color in config affects UI elements (#16)
|
||||
- Keep bold for headings even with color disabled
|
||||
- Don't make whole link text bold when color is disabled
|
||||
|
||||
|
||||
## [1.0.0] - 2020-06-18
|
||||
|
@ -29,17 +29,29 @@ func convertRegularGemini(s string, numLinks int, width int) (string, []string)
|
||||
for i := range lines {
|
||||
lines[i] = strings.TrimRight(lines[i], " \r\t\n")
|
||||
|
||||
if strings.HasPrefix(lines[i], "#") && viper.GetBool("a-general.color") {
|
||||
|
||||
if strings.HasPrefix(lines[i], "#") {
|
||||
// Headings
|
||||
if strings.HasPrefix(lines[i], "###") {
|
||||
lines[i] = "[fuchsia::b]" + lines[i] + "[-::-]"
|
||||
}
|
||||
if strings.HasPrefix(lines[i], "##") {
|
||||
lines[i] = "[lime::b]" + lines[i] + "[-::-]"
|
||||
}
|
||||
if strings.HasPrefix(lines[i], "#") {
|
||||
lines[i] = "[red::b]" + lines[i] + "[-::-]"
|
||||
if viper.GetBool("a-general.color") {
|
||||
if strings.HasPrefix(lines[i], "###") {
|
||||
lines[i] = "[fuchsia::b]" + lines[i] + "[-::-]"
|
||||
}
|
||||
if strings.HasPrefix(lines[i], "##") {
|
||||
lines[i] = "[lime::b]" + lines[i] + "[-::-]"
|
||||
}
|
||||
if strings.HasPrefix(lines[i], "#") {
|
||||
lines[i] = "[red::b]" + lines[i] + "[-::-]"
|
||||
}
|
||||
} else {
|
||||
// Just bold, no colors
|
||||
if strings.HasPrefix(lines[i], "###") {
|
||||
lines[i] = "[::b]" + lines[i] + "[::-]"
|
||||
}
|
||||
if strings.HasPrefix(lines[i], "##") {
|
||||
lines[i] = "[::b]" + lines[i] + "[::-]"
|
||||
}
|
||||
if strings.HasPrefix(lines[i], "#") {
|
||||
lines[i] = "[::b]" + lines[i] + "[::-]"
|
||||
}
|
||||
}
|
||||
|
||||
// Links
|
||||
@ -84,8 +96,8 @@ func convertRegularGemini(s string, numLinks int, width int) (string, []string)
|
||||
}
|
||||
} else {
|
||||
// No colours allowed
|
||||
lines[i] = `[::b][` + strconv.Itoa(numLinks+len(links)) + "[] " +
|
||||
`["` + strconv.Itoa(numLinks+len(links)-1) + `"]` + linkText + `[""][-]`
|
||||
lines[i] = `[::b][` + strconv.Itoa(numLinks+len(links)) + "[][::-] " +
|
||||
`["` + strconv.Itoa(numLinks+len(links)-1) + `"]` + linkText + `[""]`
|
||||
}
|
||||
|
||||
// Lists
|
||||
|
Loading…
Reference in New Issue
Block a user