Files
aego/tools/gendocs/site/model.go
sanspie 50be5c04bc
ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Stage 12.5: Art Workspace and asset authoring
Add dockable Art tools, animation and previews, guarded asset workflows,
and the Web Asset Studio built on the shared Art Core. Expand English and
Russian documentation, interactive Try scenes, examples and editor icons.

Add audio waveform navigation, source analysis, guarded previews and a
browser Worker mixer. Preserve source changes and recovery with bounded
checks, and strengthen native, browser and interoperability CI.

Prepare version 0.12.5 and manually built native artifact candidates.
Fix the production site image demo build dependency.
Reuse immutable scene indices when capturing keyframes.
Wait for real Persist save/load completion in component tests.
Stabilize browser Game View captures outside pointer hover.
Aseprite interchange and persistent Audio EDL recovery remain limited;
the artifact workflow does not publish releases or change stable.
2026-11-15 10:37:50 +03:00

247 lines
4.7 KiB
Go

package site
import (
"encoding/json"
"os"
"strings"
)
const (
KindPage = "page"
KindModule = "module"
KindFunction = "function"
KindType = "type"
KindField = "field"
KindMethod = "method"
KindSignal = "signal"
KindCode = "code"
KindConst = "const"
KindEnum = "enum"
ScriptsPrefix = "scripts/"
)
type Param struct {
Name string
Type string
}
type Location struct {
Path string
Line int
Stub string
Symbol string
Source string
}
type Snippet struct {
Lang string
Code string
Run bool
Check bool
Line int
}
// DemoText is the user-facing part of the existing component demo contract.
// The behavioral gate remains in the engine; the site only presents its hints.
type DemoText struct {
Title string `json:"title"`
Description string `json:"description"`
Input string `json:"input"`
}
type DemoInfo struct {
DemoID string `json:"demoID"`
Languages map[string]DemoText `json:"languages"`
}
type TrySource struct {
EntryScene string
Files map[string][]byte
Modules []string
AssetRefs []string
}
type Entry struct {
ID string
Parent string
Kind string
Owner string
Group string
Title string
Summary string
Body string
Signature string
Params []Param
Example string
Location Location
Links []string
Keys []string
SearchNames []string
Requires []string
Snippets []Snippet
Order int
Field *FieldInfo
Component *ComponentInfo
ValueType bool
Demo *DemoInfo
Related []string
Try string
TrySelect string
TryScript string
TryCode string
Input bool
TryKeys []string
TryPrefabs map[string]string
TryArtifacts []byte
TrySource *TrySource
Icon string
EditorOnly bool
Diag *DiagInfo
// Translations are the entry in other languages, by language.
Translations map[string]Translation
}
type DiagFile struct {
Path string
Bad string
Good string
}
type DiagInfo struct {
Phase string
Fix string
File string
Bad string
Good string
Files []DiagFile
Why string
Severity string
At string
Line int
Col int
EndLine int
EndCol int
Message string
Example string
ExampleFile string
ExampleScript string
}
type FieldInfo struct {
Label string
Type string
Default string
Range string
Notes []string
Index int
Runtime bool
}
type ComponentInfo struct {
Category string
Module string
Space string
Unique bool
Requires []string
Create string
Events []string
}
type Node struct {
ID string `json:"id"`
Children []Node `json:"children,omitempty"`
}
type Group struct {
ID string `json:"id"`
Title string `json:"title"`
Section string `json:"section"`
Order int `json:"order"`
Icon string `json:"icon,omitempty"`
Titles map[string]string `json:"titles,omitempty"`
}
type GroupNav struct {
Group
Nav []Node `json:"nav"`
}
type Problem struct {
ID string
Error bool
Message string
}
type Export struct {
Version int `json:"version"`
Title string `json:"title"`
Entries []Entry `json:"entries"`
Nav []Node `json:"nav"`
Groups []GroupNav `json:"groups"`
Problems []Problem `json:"problems"`
Aliases map[string]string `json:"aliases"`
}
func Load(path string) (*Export, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
var exp Export
if err := json.Unmarshal(data, &exp); err != nil {
return nil, err
}
if exp.Title == "" {
exp.Title = "Aego"
}
return &exp, nil
}
func titled(md string) bool {
for _, l := range strings.Split(md, "\n") {
if strings.TrimSpace(l) == "" {
continue
}
return strings.HasPrefix(l, "# ")
}
return false
}
func stripTitle(md string) string {
lines := strings.Split(md, "\n")
for i, l := range lines {
if strings.TrimSpace(l) == "" {
continue
}
if strings.HasPrefix(l, "# ") {
return strings.TrimLeft(strings.Join(lines[i+1:], "\n"), "\n")
}
break
}
return md
}
func cleanPath(id string) string {
var b strings.Builder
for _, c := range id {
switch {
case c >= 'a' && c <= 'z', c >= 'A' && c <= 'Z', c >= '0' && c <= '9', c == '.', c == '_', c == '-', c == '/':
b.WriteRune(c)
default:
b.WriteByte('-')
}
}
return strings.Trim(b.String(), "/")
}
// Translation is an entry in another language (D348).
type Translation struct {
Title string
Summary string
Body string
Fix string
Why string
Source string
Line int
}