--- a/cmd/version.go Sat May 13 11:56:52 2017 +0200
+++ b/cmd/version.go Sat May 13 12:36:38 2017 +0200
@@ -23,7 +23,7 @@
}
// VERSION of the madonctl application
-var VERSION = "1.1.0"
+var VERSION = "1.1.1-dev"
var versionCmd = &cobra.Command{
Use: "version",
--- a/printer/html2text/html2text.go Sat May 13 11:56:52 2017 +0200
+++ b/printer/html2text/html2text.go Sat May 13 12:36:38 2017 +0200
@@ -116,6 +116,11 @@
last = b.Bytes()[bl-1]
}
+ // Add heading space if needed
+ if last != ' ' && last != '\n' && last != '#' && last != '@' {
+ b.WriteString(" ")
+ }
+
var tmpbuf bytes.Buffer
for c := n.FirstChild; c != nil; c = c.NextSibling {
process(c, &tmpbuf, class)
@@ -126,11 +131,6 @@
return
}
- // Add heading space if needed
- if last != ' ' && last != '\n' {
- b.WriteString(" ")
- }
-
s := tmpbuf.String()
if strings.HasPrefix(s, "#") || strings.HasPrefix(s, "@") {
b.WriteString(s) // Tag or mention: display content
--- a/printer/html2text/html2text_test.go Sat May 13 11:56:52 2017 +0200
+++ b/printer/html2text/html2text_test.go Sat May 13 12:36:38 2017 +0200
@@ -146,6 +146,16 @@
assert.Equal(t, expected, r)
}
+func TestTextifyMastodonMention(t *testing.T) {
+ expected := "La tête à @Toto \\o/"
+
+ body := `<p>La tête à <span class="h-card"><a href="https://example.com/@Toto">@<span>Toto</span></a></span> \o/</p>`
+
+ r, e := Textify(body)
+ assert.Nil(t, e)
+ assert.Equal(t, expected, r)
+}
+
func TestTextifyMastodonMentionAndTag(t *testing.T) {
expected := "@ACh Mais heu ! Moi aussi je fais du #TootRadio de gens morts il y a 5 siècles. Gesulado, Charpentier, Mireille Mathieu..."