1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

show links (#133)

Co-authored-by: pigpig <pigpig@pig.pig>
This commit is contained in:
p1gp1g 2020-12-01 20:00:01 +01:00 committed by GitHub
parent e5891a52e7
commit cafbb5c4c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 0 deletions

View File

@ -199,6 +199,7 @@ func Init() error {
viper.SetDefault("a-general.color", true)
viper.SetDefault("a-general.ansi", true)
viper.SetDefault("a-general.bullets", true)
viper.SetDefault("a-general.show_link", false)
viper.SetDefault("a-general.left_margin", 0.15)
viper.SetDefault("a-general.max_width", 100)
viper.SetDefault("a-general.downloads", "")

View File

@ -50,6 +50,9 @@ ansi = true
# Whether to replace list asterisks with unicode bullets
bullets = true
# Whether to show link after link text
show_link = false
# A number from 0 to 1, indicating what percentage of the terminal width the left margin should take up.
left_margin = 0.15

View File

@ -47,6 +47,9 @@ ansi = true
# Whether to replace list asterisks with unicode bullets
bullets = true
# Whether to show link after link text
show_link = false
# A number from 0 to 1, indicating what percentage of the terminal width the left margin should take up.
left_margin = 0.15

View File

@ -134,6 +134,9 @@ func convertRegularGemini(s string, numLinks, width int, proxied bool) (string,
// There is link text
url = lines[i][:delim]
linkText = strings.Trim(lines[i][delim:], " \t")
if viper.GetBool("a-general.show_link") {
linkText += " (" + url + ")"
}
}
if strings.TrimSpace(lines[i]) == "" || strings.TrimSpace(url) == "" {