summaryrefslogtreecommitdiffstats
path: root/utils.go
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2019-06-21 13:16:47 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2019-06-21 13:16:47 -0400
commit84121b3bb4820945eeec3ad6084f24c37b015683 (patch)
treed4aa970ce388eae8e1a41c4d94decedbc4f6f9f3 /utils.go
parent58011496071a49e8f5f916a0416c36806ee94614 (diff)
downloadbibtex-84121b3bb4820945eeec3ad6084f24c37b015683.tar.gz
Improving parser by factoring out a scannerHEADmaster
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils.go b/utils.go
index d4c078f..33c9278 100644
--- a/utils.go
+++ b/utils.go
@@ -158,6 +158,8 @@ func squeezeSpaces(s string) string {
return buf.String()
}
+var replacer = strings.NewReplacer("---", "—", "--", "–", "~", "\u00A0", "``", "“", "''", "”", "'", "’", "\"", "”")
+
func UnTex(s string) string {
r := newReader(s)
var buf bytes.Buffer
@@ -183,8 +185,6 @@ func UnTex(s string) string {
}
s = string(norm.NFC.Bytes(buf.Bytes()))
s = squeezeSpaces(s)
- replacer := strings.NewReplacer("---", "—", "--", "–", "~", "\u00A0",
- "``", "“", "''", "”", "'", "’", "\"", "”")
return replacer.Replace(s)
}