Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package mestionora
|
|
|
|
import (
|
|
"path"
|
|
"strings"
|
|
)
|
|
|
|
// A display projection only: names, boundaries and manual titles remain stored
|
|
// unchanged. Legacy generated Spots have no nested Spot semantics.
|
|
func IsUnclassifiedCitySpot(name, boundary string) bool {
|
|
return strings.HasSuffix(name, "-undefined") || strings.HasSuffix(boundary, "/_undefined")
|
|
}
|
|
|
|
func CitySpotDisplayTitle(name, title, boundary, parentTitle string) string {
|
|
if !IsUnclassifiedCitySpot(name, boundary) {
|
|
if title != "" {
|
|
return title
|
|
}
|
|
return name
|
|
}
|
|
switch strings.ToLower(strings.TrimSpace(title)) {
|
|
case "", "undefined", "未定義", "未分類のpage", "unclassified pages", strings.ToLower(name):
|
|
if parentTitle != "" {
|
|
return parentTitle
|
|
}
|
|
if parent := path.Base(path.Dir(boundary)); parent != "/" && parent != "." {
|
|
return parent
|
|
}
|
|
return "Spot"
|
|
default:
|
|
return title // A manual display title takes precedence.
|
|
}
|
|
}
|
|
|
|
func (r CitySearchResult) DisplayTitle() string {
|
|
if r.Kind == "spot" {
|
|
return CitySpotDisplayTitle(r.Name, r.Title, r.PathPrefix, r.StreetTitle)
|
|
}
|
|
if r.Title != "" {
|
|
return r.Title
|
|
}
|
|
return r.Name
|
|
}
|
|
|
|
func (r CitySearchResult) ContentPath() string {
|
|
if r.NavigationPath != "" {
|
|
return r.NavigationPath
|
|
}
|
|
return r.PathPrefix
|
|
}
|