Fixed double dash in tweets
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
7f14289760
commit
cfd9c7292c
1
chars.go
1
chars.go
@ -77,6 +77,7 @@ var charWidths = map[string]float64{
|
|||||||
"(": 7.8,
|
"(": 7.8,
|
||||||
")": 7.8,
|
")": 7.8,
|
||||||
"-": 10.300003051757812,
|
"-": 10.300003051757812,
|
||||||
|
"—": 10.300003051757812,
|
||||||
"_": 9.73333740234375,
|
"_": 9.73333740234375,
|
||||||
"=": 14.333328247070312,
|
"=": 14.333328247070312,
|
||||||
"+": 14.333328247070312,
|
"+": 14.333328247070312,
|
||||||
|
2
main.go
2
main.go
@ -208,8 +208,10 @@ func calculateHeight(tweet anaconda.Tweet) int64 {
|
|||||||
lineHeight := 28.0
|
lineHeight := 28.0
|
||||||
tweetText := strings.ReplaceAll(tweet.FullText, "<br />", " \n")
|
tweetText := strings.ReplaceAll(tweet.FullText, "<br />", " \n")
|
||||||
tweetText = strip.StripTags(tweetText)
|
tweetText = strip.StripTags(tweetText)
|
||||||
|
tweetText = strings.ReplaceAll(tweetText, "--", "——")
|
||||||
words := regexp.MustCompile(`[ |-]`).Split(tweetText, -1)
|
words := regexp.MustCompile(`[ |-]`).Split(tweetText, -1)
|
||||||
for _, word := range words {
|
for _, word := range words {
|
||||||
|
word = strings.ReplaceAll(word, "——", "--")
|
||||||
if len(emoji.FindAll(word)) > 0 {
|
if len(emoji.FindAll(word)) > 0 {
|
||||||
lineHeight = 32.0
|
lineHeight = 32.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user