more correct syntax and AI instructions

This commit is contained in:
2026-02-09 11:00:23 -06:00
parent d0c68d7a7d
commit 872cd6ab51
28 changed files with 998 additions and 453 deletions

View File

@@ -4,7 +4,7 @@ title: "ƿit"
```javascript
// hello.ce — a simple actor
log.console("Hello, ƿit!")
print("Hello, ƿit!")
$stop()
```

View File

@@ -34,7 +34,7 @@ Create a file called `hello.ce`:
```javascript
// hello.ce
log.console("Hello, ƿit!")
print("Hello, ƿit!")
$stop()
```
@@ -58,7 +58,7 @@ var count = 0
$clock(function(dt) {
count = count + 1
log.console(`tick ${count}`)
print(`tick ${count}`)
if (count >= 5) {
$stop()
}
@@ -86,7 +86,7 @@ $receiver(function(msg, reply) {
// main.ce
$start(function(greeter) {
$send(greeter, {name: "world"}, function(response) {
log.console(response.greeting)
print(response.greeting)
$stop()
})
}, "greeter")
@@ -104,11 +104,11 @@ Modules (`.cm` files) return a value that is cached and frozen. Create a module:
```javascript
// math_helpers.cm
function square(x) {
var square = function(x) {
return x * x
}
function distance(x1, y1, x2, y2) {
var distance = function(x1, y1, x2, y2) {
var math = use('math/radians')
var dx = x2 - x1
var dy = y2 - y1
@@ -127,8 +127,8 @@ Use it from an actor:
// calc.ce
var helpers = use('math_helpers')
log.console(helpers.square(5)) // 25
log.console(helpers.distance(0, 0, 3, 4)) // 5
print(helpers.square(5)) // 25
print(helpers.distance(0, 0, 3, 4)) // 5
$stop()
```

View File

@@ -5,22 +5,14 @@ sections:
url: "/docs/language/"
- title: "Actors and Modules"
url: "/docs/actors/"
- title: "Requestors"
url: "/docs/requestors/"
- title: "Packages"
url: "/docs/packages/"
- title: "Tools"
pages:
- title: "CLI"
url: "/docs/cli/"
- title: "C Modules"
url: "/docs/c-modules/"
- title: "Reference"
pages:
- title: "Built-in Functions"
url: "/docs/functions/"
- title: "Standard Library"
pages:
- title: "Overview"
url: "/docs/library/"
- title: "text"
url: "/docs/library/text/"
- title: "number"
@@ -29,6 +21,10 @@ sections:
url: "/docs/library/array/"
- title: "object"
url: "/docs/library/object/"
- title: "Standard Library"
pages:
- title: "Overview"
url: "/docs/library/"
- title: "blob"
url: "/docs/library/blob/"
- title: "time"
@@ -39,3 +35,9 @@ sections:
url: "/docs/library/json/"
- title: "random"
url: "/docs/library/random/"
- title: "Tools"
pages:
- title: "CLI"
url: "/docs/cli/"
- title: "C Modules"
url: "/docs/c-modules/"

View File

@@ -2,57 +2,64 @@ sections:
- title: "Language Syntax"
page: "/docs/language/"
id: "language"
group: "Language"
- title: "Actors and Modules"
page: "/docs/actors/"
id: "actors"
group: "Language"
- title: "Requestors"
page: "/docs/requestors/"
id: "requestors"
group: "Language"
- title: "Packages"
page: "/docs/packages/"
id: "packages"
group: "Language"
- title: "Built-in Functions"
page: "/docs/functions/"
id: "functions"
group: "Reference"
- title: "text"
page: "/docs/library/text/"
id: "intrinsic-text"
group: "Reference"
- title: "number"
page: "/docs/library/number/"
id: "intrinsic-number"
group: "Reference"
- title: "array"
page: "/docs/library/array/"
id: "intrinsic-array"
group: "Reference"
- title: "object"
page: "/docs/library/object/"
id: "intrinsic-object"
group: "Reference"
- title: "Standard Library"
page: "/docs/library/"
id: "library"
- title: "text"
page: "/docs/library/text/"
id: "library-text"
- title: "number"
page: "/docs/library/number/"
id: "library-number"
- title: "array"
page: "/docs/library/array/"
id: "library-array"
- title: "object"
page: "/docs/library/object/"
id: "library-object"
group: "Standard Library"
- title: "blob"
page: "/docs/library/blob/"
id: "library-blob"
group: "Standard Library"
- title: "time"
page: "/docs/library/time/"
id: "library-time"
group: "Standard Library"
- title: "math"
page: "/docs/library/math/"
id: "library-math"
group: "Standard Library"
- title: "json"
page: "/docs/library/json/"
id: "library-json"
group: "Standard Library"
- title: "random"
page: "/docs/library/random/"
id: "library-random"
group: "Standard Library"
- title: "Writing C Modules"
page: "/docs/c-modules/"
id: "c-modules"
- title: "Kim Encoding"
page: "/docs/kim/"
id: "kim"
- title: "Nota Format"
page: "/docs/nota/"
id: "nota"
- title: "Wota Format"
page: "/docs/wota/"
id: "wota"
group: "Tools"

View File

@@ -14,12 +14,18 @@ sections:
- title: "Garbage Collection"
page: "/docs/spec/gc/"
id: "gc"
- title: "Bytecode VM"
page: "/docs/spec/bytecode/"
id: "bytecode"
- title: "Register VM"
page: "/docs/spec/mach/"
id: "mach"
- title: "Mcode IR"
page: "/docs/spec/mcode/"
id: "mcode"
- title: "Kim Encoding"
page: "/docs/kim/"
id: "kim"
- title: "Nota Format"
page: "/docs/nota/"
id: "nota"
- title: "Wota Format"
page: "/docs/wota/"
id: "wota"

View File

@@ -7,7 +7,7 @@
<article class="longform-content" id="longform-content">
<h1>{{ .Title }}</h1>
{{ range .Site.Data.manual_sections.sections }}
<section id="{{ .id }}" data-toc-title="{{ .title }}">
<section id="{{ .id }}" data-toc-title="{{ .title }}" data-toc-group="{{ .group }}">
{{ with $.Site.GetPage .page }}
{{ .Content }}
{{ end }}

View File

@@ -50,6 +50,7 @@ body, h1, h2, h3, h4, p, ul, ol, figure, blockquote {
--font-wynn: 'Junicode', 'Charter', Georgia, serif;
--content-width: 720px;
--sidebar-width: 180px;
--header-height: 3rem;
}
html {
@@ -199,6 +200,15 @@ th {
.site-header {
border-bottom: 1px solid var(--border);
background: var(--bg);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
}
body {
padding-top: var(--header-height);
}
.site-nav {
@@ -332,8 +342,8 @@ th {
flex-shrink: 0;
padding-top: 2rem;
position: sticky;
top: 0;
max-height: 100vh;
top: var(--header-height);
max-height: calc(100vh - var(--header-height));
overflow-y: auto;
}
@@ -473,8 +483,8 @@ th {
flex-shrink: 0;
padding-top: 2rem;
position: sticky;
top: 0;
max-height: 100vh;
top: var(--header-height);
max-height: calc(100vh - var(--header-height));
overflow-y: auto;
}
@@ -492,6 +502,20 @@ th {
margin: 0;
}
.toc-group-header {
font-size: 0.65rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-secondary);
margin-top: 0.8rem;
margin-bottom: 0.15rem;
list-style: none;
}
.toc-group-header:first-child {
margin-top: 0;
}
.toc-nav li.toc-section {
margin: 0;
}

View File

@@ -8,7 +8,18 @@
if (sections.length > 0) {
// composite page (manual, spec): section-level ToC with disclosure
var lastGroup = null;
sections.forEach(function(sec) {
// Insert group header when group changes
var group = sec.dataset.tocGroup;
if (group && group !== lastGroup) {
var gh = document.createElement('li');
gh.className = 'toc-group-header';
gh.textContent = group;
tocList.appendChild(gh);
lastGroup = group;
}
var li = document.createElement('li');
li.className = 'toc-section';
var a = document.createElement('a');