chore: release v0.11
This commit is contained in:
+16
-14
@@ -278,36 +278,38 @@ func stripAnnotation(s string, open, close rune, cb func(string)) string {
|
||||
|
||||
// suffixModifiers are non-DXCC-relevant callsign suffixes we strip before
|
||||
// matching. /P /M /QRP /A and single-digit area changes (/5 …) all keep the
|
||||
// operator's home DXCC. NOTE: "MM" and "AM" are NOT here — a TRAILING /MM or
|
||||
// /AM (maritime/aeronautical mobile) means "no DXCC entity", while a LEADING
|
||||
// "MM" is the Scotland operating prefix; both are handled in normalizeCallsign.
|
||||
// operator's home DXCC. A TRAILING /MM or /AM (maritime/aeronautical mobile) is
|
||||
// handled in normalizeCallsign (stripped, home entity kept) so a LEADING "MM"
|
||||
// (the Scotland prefix) isn't mistaken for it.
|
||||
var suffixModifiers = map[string]bool{
|
||||
"P": true, "M": true, "QRP": true, "A": true,
|
||||
"PM": true, "LH": true,
|
||||
}
|
||||
|
||||
// normalizeCallsign uppercases, trims, and resolves the "active" call when
|
||||
// the operator uses slashes (DL/F4NIE → DL; F4NIE/P → F4NIE). Returns "" for
|
||||
// maritime/aeronautical mobile (.../MM, .../AM), which count for no DXCC.
|
||||
// normalizeCallsign uppercases, trims, and resolves the "active" call when the
|
||||
// operator uses slashes (DL/F4NIE → DL; F4NIE/P → F4NIE). A trailing /MM or /AM
|
||||
// (maritime/aeronautical mobile) is stripped so the home entity still resolves
|
||||
// (YB1SCY/AM → YB1SCY → Indonesia) — strict DXCC says no entity, but the log
|
||||
// should still show the operator's country.
|
||||
func normalizeCallsign(s string) string {
|
||||
s = strings.ToUpper(strings.TrimSpace(s))
|
||||
if !strings.ContainsRune(s, '/') {
|
||||
return s
|
||||
}
|
||||
parts := strings.Split(s, "/")
|
||||
// A trailing /MM or /AM is maritime/aeronautical mobile → no DXCC entity.
|
||||
// (A leading "MM" is the Scotland prefix and must NOT trigger this.)
|
||||
for i, p := range parts {
|
||||
if i > 0 && (p == "MM" || p == "AM") {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
keep := parts[:0]
|
||||
var areaDigit byte // a single-digit "/N" re-homes the call to call area N
|
||||
for _, p := range parts {
|
||||
for i, p := range parts {
|
||||
if p == "" {
|
||||
continue
|
||||
}
|
||||
// A TRAILING /MM (maritime) or /AM (aeronautical) mobile is stripped and
|
||||
// the operator's home entity is kept, so the contact still resolves to a
|
||||
// country in the log (e.g. YB1SCY/AM → Indonesia). A LEADING "MM" is the
|
||||
// Scotland operating prefix (MM/F4NIE) and must NOT be stripped.
|
||||
if i > 0 && (p == "MM" || p == "AM") {
|
||||
continue
|
||||
}
|
||||
if suffixModifiers[p] {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user