mirror of
https://github.com/makew0rld/amfora.git
synced 2024-11-03 02:37:23 -05:00
parent
a033731cd8
commit
5098f125a1
@ -15,18 +15,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Display gemtext from stdin (#205, #242)
|
||||
- Specifying `default` in the theme config uses the terminal's default background color, including transparency (#244, #245)
|
||||
- Redirects occur automatically if it only adds a trailing slash (#271)
|
||||
- Non-gemini links are underlined by default to help color blind users (#189)
|
||||
|
||||
### Changed
|
||||
- Favicon support removed (#199)
|
||||
- Bookmarks are stored using XML in the XBEL format, old bookmarks are transferred (#68)
|
||||
- Text no longer disappears under the left margin when scrolling (regression from v1.8.0) (#197)
|
||||
- Text no longer disappears under the left margin when scrolling (regression in v1.8.0) (#197)
|
||||
- Default search engine changed to geminispace.info from gus.guru
|
||||
|
||||
## Removed
|
||||
- Favicon support removed (#199)
|
||||
|
||||
### Fixed
|
||||
- Help text is now the same color as `regular_text` in the theme config
|
||||
- Non-ASCII (multibyte) characters can now be used as keybindings (#198, #200)
|
||||
- Possible subscription update race condition on startup
|
||||
- Plaintext documents are escaped properly (regression from v1.8.0)
|
||||
- Plaintext documents are escaped properly (regression in v1.8.0)
|
||||
- Help page scrollbar color matches what's in the theme config
|
||||
- Regression where lists would not appear if `bullets = false` (#234, #235)
|
||||
- Support multiple bookmarks with the same name
|
||||
|
@ -204,6 +204,7 @@ func Init() error {
|
||||
viper.SetDefault("a-general.page_max_size", 2097152)
|
||||
viper.SetDefault("a-general.page_max_time", 10)
|
||||
viper.SetDefault("a-general.scrollbar", "auto")
|
||||
viper.SetDefault("a-general.underline", true)
|
||||
viper.SetDefault("keybindings.bind_reload", []string{"R", "Ctrl-R"})
|
||||
viper.SetDefault("keybindings.bind_home", "Backspace")
|
||||
viper.SetDefault("keybindings.bind_bookmarks", "Ctrl-B")
|
||||
|
@ -3,6 +3,17 @@ package config
|
||||
//go:generate ./default.sh
|
||||
var defaultConf = []byte(`# This is the default config file.
|
||||
# It also shows all the default values, if you don't create the file.
|
||||
# You can edit this file to set your own configuration for Amfora.
|
||||
|
||||
# When Amfora updates, defaults may change, but this file on your drive will not.
|
||||
# You can always get the latest defaults on GitHub.
|
||||
# https://github.com/makeworld-the-better-one/amfora/blob/master/default-config.toml
|
||||
|
||||
# Please also check out the Amfora Wiki for more help
|
||||
# https://github.com/makeworld-the-better-one/amfora/wiki
|
||||
# gemini://makeworld.space/amfora-wiki/
|
||||
|
||||
|
||||
|
||||
# All URL values may omit the scheme and/or port, as well as the beginning double slash
|
||||
# Valid URL examples:
|
||||
@ -74,6 +85,10 @@ page_max_time = 10
|
||||
# "auto" means the scrollbar only appears when the page is longer than the window.
|
||||
scrollbar = "auto"
|
||||
|
||||
# Underline non-gemini URLs
|
||||
# This is done to help color blind users
|
||||
underline = true
|
||||
|
||||
|
||||
[auth]
|
||||
# Authentication settings
|
||||
|
@ -1,5 +1,16 @@
|
||||
# This is the default config file.
|
||||
# It also shows all the default values, if you don't create the file.
|
||||
# You can edit this file to set your own configuration for Amfora.
|
||||
|
||||
# When Amfora updates, defaults may change, but this file on your drive will not.
|
||||
# You can always get the latest defaults on GitHub.
|
||||
# https://github.com/makeworld-the-better-one/amfora/blob/master/default-config.toml
|
||||
|
||||
# Please also check out the Amfora Wiki for more help
|
||||
# https://github.com/makeworld-the-better-one/amfora/wiki
|
||||
# gemini://makeworld.space/amfora-wiki/
|
||||
|
||||
|
||||
|
||||
# All URL values may omit the scheme and/or port, as well as the beginning double slash
|
||||
# Valid URL examples:
|
||||
@ -71,6 +82,10 @@ page_max_time = 10
|
||||
# "auto" means the scrollbar only appears when the page is longer than the window.
|
||||
scrollbar = "auto"
|
||||
|
||||
# Underline non-gemini URLs
|
||||
# This is done to help color blind users
|
||||
underline = true
|
||||
|
||||
|
||||
[auth]
|
||||
# Authentication settings
|
||||
|
@ -27,4 +27,5 @@ Thank you to the following contributors, who have helped make Amfora great. FOSS
|
||||
* Anas Mohamed (@amohamed11)
|
||||
* David Jimenez (@dvejmz)
|
||||
* Michael McDonagh (@m-mcdonagh)
|
||||
* mooff (@awfulcooking)
|
||||
`)
|
||||
|
@ -159,6 +159,12 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string,
|
||||
spacing = " "
|
||||
}
|
||||
|
||||
// Underline non-gemini links if enabled
|
||||
var linkTag string
|
||||
if viper.GetBool("a-general.underline") {
|
||||
linkTag = "::u"
|
||||
}
|
||||
|
||||
// Wrap and add link text
|
||||
// Wrap the link text, but add some spaces to indent the wrapped lines past the link number
|
||||
// Set the style tags
|
||||
@ -166,11 +172,12 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string,
|
||||
|
||||
var wrappedLink []string
|
||||
|
||||
if viper.GetBool("a-general.color") {
|
||||
pU, err := urlPkg.Parse(url)
|
||||
if !proxied && err == nil &&
|
||||
(pU.Scheme == "" || pU.Scheme == "gemini" || pU.Scheme == "about") {
|
||||
// A gemini link
|
||||
pU, err := urlPkg.Parse(url)
|
||||
if !proxied && err == nil &&
|
||||
(pU.Scheme == "" || pU.Scheme == "gemini" || pU.Scheme == "about") {
|
||||
// A gemini link
|
||||
|
||||
if viper.GetBool("a-general.color") {
|
||||
// Add the link text in blue (in a region), and a gray link number to the left of it
|
||||
// Those are the default colors, anyway
|
||||
|
||||
@ -187,33 +194,50 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string,
|
||||
`["` + strconv.Itoa(num-1) + `"][` + config.GetColorString("amfora_link") + `]` +
|
||||
wrappedLink[0] + `[-][""]`
|
||||
} else {
|
||||
// Not a gemini link
|
||||
// No color
|
||||
|
||||
wrappedLink = wrapLine(linkText, width,
|
||||
strings.Repeat(" ", len(strconv.Itoa(num))+4)+ // +4 for spaces and brackets
|
||||
`["`+strconv.Itoa(num-1)+`"]`,
|
||||
`[""]`,
|
||||
false, // Don't indent the first line, it's the one with link number
|
||||
)
|
||||
|
||||
wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-] " +
|
||||
`["` + strconv.Itoa(num-1) + `"]` +
|
||||
wrappedLink[0] + `[""]`
|
||||
}
|
||||
} else {
|
||||
// Not a gemini link
|
||||
|
||||
if viper.GetBool("a-general.color") {
|
||||
// Color
|
||||
|
||||
wrappedLink = wrapLine(linkText, width,
|
||||
strings.Repeat(" ", indent)+
|
||||
`["`+strconv.Itoa(num-1)+`"][`+config.GetColorString("foreign_link")+`]`,
|
||||
`[-][""]`,
|
||||
`["`+strconv.Itoa(num-1)+`"][`+config.GetColorString("foreign_link")+linkTag+`]`,
|
||||
`[-::-][""]`,
|
||||
false, // Don't indent the first line, it's the one with link number
|
||||
)
|
||||
|
||||
wrappedLink[0] = fmt.Sprintf(`[%s::b][`, config.GetColorString("link_number")) +
|
||||
strconv.Itoa(num) + "[]" + "[-::-]" + spacing +
|
||||
`["` + strconv.Itoa(num-1) + `"][` + config.GetColorString("foreign_link") + `]` +
|
||||
wrappedLink[0] + `[-][""]`
|
||||
`["` + strconv.Itoa(num-1) + `"][` + config.GetColorString("foreign_link") + linkTag + `]` +
|
||||
wrappedLink[0] + `[-::-][""]`
|
||||
} else {
|
||||
// No color
|
||||
|
||||
wrappedLink = wrapLine(linkText, width,
|
||||
strings.Repeat(" ", len(strconv.Itoa(num))+4)+ // +4 for spaces and brackets
|
||||
`["`+strconv.Itoa(num-1)+`"][`+linkTag+`]`,
|
||||
`[::-][""]`,
|
||||
false, // Don't indent the first line, it's the one with link number
|
||||
)
|
||||
|
||||
wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-] " +
|
||||
`["` + strconv.Itoa(num-1) + `"][` + linkTag + `]` +
|
||||
wrappedLink[0] + `[::-][""]`
|
||||
}
|
||||
} else {
|
||||
// No colors allowed
|
||||
|
||||
wrappedLink = wrapLine(linkText, width,
|
||||
strings.Repeat(" ", len(strconv.Itoa(num))+4)+ // +4 for spaces and brackets
|
||||
`["`+strconv.Itoa(num-1)+`"]`,
|
||||
`[""]`,
|
||||
false, // Don't indent the first line, it's the one with link number
|
||||
)
|
||||
|
||||
wrappedLink[0] = `[::b][` + strconv.Itoa(num) + "[][::-] " +
|
||||
`["` + strconv.Itoa(num-1) + `"]` +
|
||||
wrappedLink[0] + `[""]`
|
||||
}
|
||||
|
||||
wrappedLines = append(wrappedLines, wrappedLink...)
|
||||
|
Loading…
Reference in New Issue
Block a user