jorge/markup/smartify_test.go
Facundo Olano 924e4629b2
Add smart quotes replacement in output html (#14)
* first basic implementation with gojekyll port

* extract smartify file

* template struct comments

* rename templates package to markup

* move minify file to markup

* move html to markup

* move smartify to markup

* first stab at unit test

* better dash replacement

* do plain replacement of dashes
2024-02-26 12:16:06 -03:00

37 lines
729 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package markup
import (
"io"
"strings"
"testing"
)
func TestSmartify(t *testing.T) {
input := `<html>
<head>
<script type="text/javascript">
const url = 'http://localhost:4001/_events/';
const string = "joe's garage";
</script>
</head>
<body>
<p>the album is "Joe's Garage" --by Frank Zappa...</p>
</body>
</html>`
output, err := Smartify(".html", strings.NewReader(input))
buf := new(strings.Builder)
_, err = io.Copy(buf, output)
assertEqual(t, err, nil)
assertEqual(t, buf.String(), `<html><head>
<script type="text/javascript">
const url = 'http://localhost:4001/_events/';
const string = "joe's garage";
</script>
</head>
<body>
<p>the album is “Joes Garage” by Frank Zappa…</p>
</body></html>`)
}