summaryrefslogtreecommitdiff
path: root/cmd/rchive.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/rchive.go')
-rw-r--r--cmd/rchive.go84
1 files changed, 3 insertions, 81 deletions
diff --git a/cmd/rchive.go b/cmd/rchive.go
index af3db22..c17385a 100644
--- a/cmd/rchive.go
+++ b/cmd/rchive.go
@@ -2325,35 +2325,7 @@ func prepareQuery(str string) string {
str = "stdin " + str
}
- // cleanup string
- if eutils.IsNotASCII(str) {
- str = eutils.DoAccentTransform(str)
- if eutils.HasUnicodeMarkup(str) {
- str = eutils.RepairUnicodeMarkup(str, eutils.SPACE)
- }
- }
-
- if eutils.HasBadSpace(str) {
- str = eutils.CleanupBadSpaces(str)
- }
- if eutils.HasAngleBracket(str) {
- str = eutils.RepairEncodedMarkup(str)
- str = eutils.RepairScriptMarkup(str, eutils.SPACE)
- str = eutils.RepairMathMLMarkup(str, eutils.SPACE)
- str = eutils.RemoveEmbeddedMarkup(str)
- }
-
- if eutils.HasAmpOrNotASCII(str) {
- str = html.UnescapeString(str)
- }
-
- if eutils.IsNotASCII(str) {
- if eutils.HasGreek(str) {
- str = eutils.SpellGreek(str)
- str = eutils.CompressRunsOfSpaces(str)
- }
- str = eutils.UnicodeToASCII(str)
- }
+ str = eutils.CleanupQuery(str, false, true)
str = strings.Replace(str, "~ ~", "~~", -1)
str = strings.Replace(str, "~ ~", "~~", -1)
@@ -2475,38 +2447,7 @@ func prepareExact(str string) string {
return ""
}
- str = html.EscapeString(str)
-
- if eutils.IsNotASCII(str) {
- str = eutils.DoAccentTransform(str)
- if eutils.HasUnicodeMarkup(str) {
- str = eutils.RepairUnicodeMarkup(str, eutils.SPACE)
- }
- }
-
- str = strings.ToLower(str)
-
- if eutils.HasBadSpace(str) {
- str = eutils.CleanupBadSpaces(str)
- }
- if eutils.HasAngleBracket(str) {
- str = eutils.RepairEncodedMarkup(str)
- str = eutils.RepairScriptMarkup(str, eutils.SPACE)
- str = eutils.RepairMathMLMarkup(str, eutils.SPACE)
- // RemoveEmbeddedMarkup must be called before UnescapeString, which was suppressed in ExploreElements
- str = eutils.RemoveEmbeddedMarkup(str)
- }
-
- if eutils.HasAmpOrNotASCII(str) {
- str = html.UnescapeString(str)
- }
-
- if eutils.IsNotASCII(str) {
- if eutils.HasGreek(str) {
- str = eutils.SpellGreek(str)
- str = eutils.CompressRunsOfSpaces(str)
- }
- }
+ str = eutils.CleanupQuery(str, true, true)
str = strings.Replace(str, "(", " ", -1)
str = strings.Replace(str, ")", " ", -1)
@@ -5009,26 +4950,7 @@ func createMatchers(phrs string, exclude bool, inp <-chan eutils.XMLRecord) <-ch
// split at punctuation, but leave < and > in to delimit content strings
cleanupRecord := func(str string) string {
- if eutils.IsNotASCII(str) {
- str = eutils.DoAccentTransform(str)
- if eutils.HasUnicodeMarkup(str) {
- str = eutils.RepairUnicodeMarkup(str, eutils.SPACE)
- }
- }
-
- if eutils.HasBadSpace(str) {
- str = eutils.CleanupBadSpaces(str)
- }
-
- if eutils.HasAmpOrNotASCII(str) {
- str = html.UnescapeString(str)
- }
-
- if eutils.IsNotASCII(str) {
- if eutils.HasGreek(str) {
- str = eutils.SpellGreek(str)
- }
- }
+ str = eutils.CleanupQuery(str, false, false)
if eutils.HasHyphenOrApostrophe(str) {
str = eutils.FixSpecialCases(str)