aboutsummaryrefslogtreecommitdiffstats
path: root/spec/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/scripts')
-rw-r--r--spec/scripts/gen_abnf.py4
-rw-r--r--spec/scripts/gen_ebnf.py4
-rw-r--r--spec/scripts/gen_spec.py94
3 files changed, 51 insertions, 51 deletions
diff --git a/spec/scripts/gen_abnf.py b/spec/scripts/gen_abnf.py
index 9569195..88354ea 100644
--- a/spec/scripts/gen_abnf.py
+++ b/spec/scripts/gen_abnf.py
@@ -53,7 +53,7 @@ def main():
fields = reg["fields"]
lines = []
- lines.append("; UGI Grammar v0 — RFC 5234 ABNF")
+ lines.append("; UGI Grammar v0: RFC 5234 ABNF")
lines.append("; Generated from ugi_registry_v0.json")
lines.append(";")
lines.append("; Compatible with abnf.dev/abnf2svg")
@@ -119,7 +119,7 @@ def main():
has_alt = mods.get("alternative", False)
hex_code = hex_char(code)
- lines.append(f"; {code} — {f['name']} ({ftype})")
+ lines.append(f"; {code}: {f['name']} ({ftype})")
if ftype == "direct":
# Build modifier part
diff --git a/spec/scripts/gen_ebnf.py b/spec/scripts/gen_ebnf.py
index 65824bd..990ae07 100644
--- a/spec/scripts/gen_ebnf.py
+++ b/spec/scripts/gen_ebnf.py
@@ -21,7 +21,7 @@ def main():
fields = reg["fields"]
lines = []
- lines.append("/* UGI Grammar v0 — W3C EBNF */")
+ lines.append("/* UGI Grammar v0: W3C EBNF */")
lines.append("/* Generated from ugi_registry_v0.json */")
lines.append("/* Compatible with bottlecaps.de/rr/ui */")
lines.append("")
@@ -82,7 +82,7 @@ def main():
has_aspire = mods.get("aspire", False)
has_alt = mods.get("alternative", False)
- lines.append(f"/* {code} — {f['name']} ({ftype}) */")
+ lines.append(f"/* {code}: {f['name']} ({ftype}) */")
if ftype == "direct":
mod_parts = []
diff --git a/spec/scripts/gen_spec.py b/spec/scripts/gen_spec.py
index 4ab8a20..bf4739b 100644
--- a/spec/scripts/gen_spec.py
+++ b/spec/scripts/gen_spec.py
@@ -13,7 +13,7 @@ def load_registry(path):
def gen_title(spec):
lines = []
- lines.append(f"# {spec['name']} — {spec['full_name']}")
+ lines.append(f"# {spec['name']}: {spec['full_name']}")
lines.append("")
lines.append(
f"**Version: {spec['version']} ({spec['status'].title()}) · "
@@ -47,10 +47,10 @@ def gen_overview(spec):
lines.append("")
lines.append("### Design goals")
lines.append("")
- lines.append("1. Single-letter field codes — 24 active, 2 reserved")
- lines.append("2. Octal (0–7) rating scale")
- lines.append("3. URI-safe characters only — no percent-encoding needed")
- lines.append("4. Dual format — URI for machines, block for humans")
+ lines.append("1. Single-letter field codes: 24 active, 2 reserved")
+ lines.append("2. Octal (0-7) rating scale")
+ lines.append("3. URI-safe characters only, no percent-encoding needed")
+ lines.append("4. Dual format: URI for machines, block for humans")
lines.append("5. Case-insensitive")
lines.append("6. Extensible via `~` custom sub-IDs")
lines.append("")
@@ -97,7 +97,7 @@ def gen_formats(fmt):
)
lines.append("")
lines.append(
- "No modifier or character changes are needed — both formats use identical symbols."
+ "No modifier or character changes are needed; both formats use identical symbols."
)
lines.append("")
lines.append("### Mandatory fields")
@@ -120,16 +120,16 @@ def gen_grammar(fields):
lines.append("<field_code><sub_id><digit>[<modifier>]...")
lines.append("```")
lines.append("")
- lines.append("- **Field codes** — single letter (a–z), case-insensitive")
- lines.append("- **Sub-IDs** — 1–4 lowercase alpha chars")
- lines.append("- **Ratings** — single octal digit (0–7), required on every sub-ID")
- lines.append("- **Custom sub-IDs** — `~` prefix: `~fermenting5`")
- lines.append("- **Modifiers** — after the digit:")
- lines.append(" - `$` — paid")
- lines.append(" - `+` followed by digit — aspiring toward that level")
- lines.append(" - `$+` combined — paid and aspiring")
+ lines.append("- **Field codes**: single letter (a-z), case-insensitive")
+ lines.append("- **Sub-IDs**: 1-4 lowercase alpha chars")
+ lines.append("- **Ratings**: single octal digit (0-7), required on every sub-ID")
+ lines.append("- **Custom sub-IDs**: `~` prefix: `~fermenting5`")
+ lines.append("- **Modifiers**: after the digit:")
+ lines.append(" - `$`: paid")
+ lines.append(" - `+` followed by digit: aspiring toward that level")
+ lines.append(" - `$+` combined: paid and aspiring")
lines.append(
- '- **Alternatives** — `/` between two digits on direct-value fields: `c3/6`'
+ '- **Alternatives**: `/` between two digits on direct-value fields: `c3/6`'
)
lines.append("")
lines.append("### Special formats")
@@ -241,7 +241,7 @@ def gen_field_list(fields, fmt):
for code in all_codes:
if code in reserved:
- lines.append(f"| `{code}` | *(reserved)* | — | — |")
+ lines.append(f"| `{code}` | *(reserved)* | - | - |")
continue
f = fields[code]
ftype = f["type"]
@@ -285,10 +285,10 @@ def gen_field_def_direct(code, f):
if vals:
for i in range(8):
v = vals.get(str(i), {})
- label = v.get("label", "—")
+ label = v.get("label", "")
humor = v.get("humor")
if humor:
- lines.append(f"{i}. **{label}** — {humor}")
+ lines.append(f"{i}. **{label}**: {humor}")
else:
lines.append(f"{i}. **{label}**")
lines.append("")
@@ -310,8 +310,8 @@ def gen_field_def_special_b(f):
parts = [f"{k} = {v}" for k, v in sorted(vals.items(), key=lambda x: int(x[0]))]
lines[-1] += " · ".join(parts)
lines.append("")
- lines.append("> `b6/3` — tall and slim.")
- lines.append("> `b4/4` — average. Chairs were designed for you.")
+ lines.append("> `b6/3`: tall and slim.")
+ lines.append("> `b4/4`: average. Chairs were designed for you.")
lines.append("")
return "\n".join(lines)
@@ -328,8 +328,8 @@ def gen_field_def_special_v(f):
high = vals.get("7", "")
lines.append(f"**{dim_name.title()}:** 0 = {low} · 4 = {mid} · 7 = {high}")
lines.append("")
- lines.append("> `v5/3` — socially center-left, economically center-right.")
- lines.append("> `v4/4` — centrist. You annoy both sides equally.")
+ lines.append("> `v5/3`: socially center-left, economically center-right.")
+ lines.append("> `v4/4`: centrist. You annoy both sides equally.")
lines.append("")
return "\n".join(lines)
@@ -385,10 +385,10 @@ def gen_field_def_special_g(f):
lines.append("#### Custom")
lines.append("")
lines.append(
- "`~fermenting` `~beekeeping` `~lockpicking` `~origami` — anything goes."
+ "`~fermenting` `~beekeeping` `~lockpicking` `~origami`. Anything goes."
)
lines.append("")
- lines.append("> `gcs$/ai/wr~fermenting` — paid CS geek, also into AI, writing, and fermenting.")
+ lines.append("> `gcs$/ai/wr~fermenting`: paid CS geek, also into AI, writing, and fermenting.")
lines.append("")
return "\n".join(lines)
@@ -410,20 +410,20 @@ def gen_sub_id_table(sub_ids):
for i in range(0, len(items), 2):
c1, v1 = items[i]
if isinstance(v1, dict):
- long1 = f"`({v1['long']})`" if "long" in v1 else "—"
+ long1 = f"`({v1['long']})`" if "long" in v1 else "-"
name1 = v1.get("name", c1)
else:
- long1 = "—"
+ long1 = "-"
name1 = v1
row = f"| `{c1}` | {long1} | {name1}"
if i + 1 < len(items):
c2, v2 = items[i + 1]
if isinstance(v2, dict):
- long2 = f"`({v2['long']})`" if "long" in v2 else "—"
+ long2 = f"`({v2['long']})`" if "long" in v2 else "-"
name2 = v2.get("name", c2)
else:
- long2 = "—"
+ long2 = "-"
name2 = v2
row += f" | `{c2}` | {long2} | {name2} |"
else:
@@ -480,19 +480,19 @@ def gen_grouped_sub_ids(groups, inline_threshold=7):
for i in range(0, len(items), 2):
c1, v1 = items[i]
if isinstance(v1, dict):
- long1 = f"`({v1['long']})`" if "long" in v1 else "—"
+ long1 = f"`({v1['long']})`" if "long" in v1 else "-"
name1 = v1.get("name", c1)
else:
- long1 = "—"
+ long1 = "-"
name1 = v1
row = f"| `{c1}` | {long1} | {name1}"
if i + 1 < len(items):
c2, v2 = items[i + 1]
if isinstance(v2, dict):
- long2 = f"`({v2['long']})`" if "long" in v2 else "—"
+ long2 = f"`({v2['long']})`" if "long" in v2 else "-"
name2 = v2.get("name", c2)
else:
- long2 = "—"
+ long2 = "-"
name2 = v2
row += f" | `{c2}` | {long2} | {name2} |"
else:
@@ -532,10 +532,10 @@ def gen_field_def_multi(code, f, scale):
if "scale_labels" in f:
humor = f.get("humor_scale", {}) or {}
for i in range(8):
- label = f["scale_labels"].get(str(i), "—")
+ label = f["scale_labels"].get(str(i), "")
h = humor.get(str(i))
if h:
- lines.append(f"{i}. **{label}** — {h}")
+ lines.append(f"{i}. **{label}**: {h}")
else:
lines.append(f"{i}. **{label}**")
lines.append("")
@@ -552,7 +552,7 @@ def gen_field_def_multi(code, f, scale):
def gen_field_def_single(code, f):
"""Generate a single-type field definition."""
lines = []
- lines.append("**Single value only** — one tradition + devoutness rating. Parser rejects multiple sub-IDs.")
+ lines.append("**Single value only**: one tradition + devoutness rating. Parser rejects multiple sub-IDs.")
lines.append("")
if "sub_ids" in f:
@@ -565,7 +565,7 @@ def gen_field_def_single(code, f):
# Example
if code == "r":
- lines.append("> `ris6` — devout Muslim. `rath4` — culturally atheist.")
+ lines.append("> `ris6`: devout Muslim. `rath4`: culturally atheist.")
lines.append("")
return "\n".join(lines)
@@ -580,10 +580,10 @@ def gen_field_def_lang(f):
if "scale_labels" in f:
humor = f.get("humor_scale", {}) or {}
for i in range(8):
- label = f["scale_labels"].get(str(i), "—")
+ label = f["scale_labels"].get(str(i), "")
h = humor.get(str(i))
if h:
- lines.append(f"{i}. **{label}** — {h}")
+ lines.append(f"{i}. **{label}**: {h}")
else:
lines.append(f"{i}. **{label}**")
lines.append("")
@@ -598,7 +598,7 @@ def gen_field_def_lang(f):
lines.append("")
lines.append(
- "> `lar7$en6de3+5` — native Arabic (paid translator), fluent English, "
+ "> `lar7$en6de3+5`: native Arabic (paid translator), fluent English, "
"learning German (beginner, aspiring proficient)."
)
lines.append("")
@@ -614,7 +614,7 @@ def gen_field_definitions(fields, scale):
for code in sorted(fields.keys()):
f = fields[code]
- lines.append(f"### {code} — {f['name']}")
+ lines.append(f"### {code}: {f['name']}")
lines.append("")
ftype = f["type"]
@@ -673,7 +673,7 @@ def gen_examples(examples, fields):
desc = ex["description"]
uri = ex["uri"]
- lines.append(f"### {handle} — {desc}")
+ lines.append(f"### {handle}: {desc}")
lines.append("")
# Generate block format from URI
@@ -905,7 +905,7 @@ def gen_comparison(comparison):
parts.append(f"`{r['ugi']}` {r['note'].lower()}")
lines.append(
", ".join(parts)
- + " — all present in one or both predecessors."
+ + ". All present in one or both predecessors."
)
lines.append("")
@@ -913,7 +913,7 @@ def gen_comparison(comparison):
lines.append("### Fields added")
lines.append("")
for a in comparison["added"]:
- lines.append(f"`{a['ugi']}` — {a['reason']}. ", )
+ lines.append(f"`{a['ugi']}`: {a['reason']}. ")
lines.append("")
# Removed
@@ -921,7 +921,7 @@ def gen_comparison(comparison):
lines.append("")
parts = []
for r in comparison["removed"]:
- parts.append(f"{r['field']} — {r['reason'].lower()}")
+ parts.append(f"{r['field']}: {r['reason'].lower()}")
lines.append(". ".join(parts) + ".")
lines.append("")
lines.append("---")
@@ -992,10 +992,10 @@ def gen_references(spec):
lines.append("## References")
lines.append("")
for p in spec["predecessors"]:
- lines.append(f"- [{p['name']} (v0.1–latest)]({p['url']}) — {p['author']}, {p['years']}")
+ lines.append(f"- [{p['name']}]({p['url']}), {p['author']}, {p['years']}")
if "continuation" in p:
c = p["continuation"]
- lines.append(f"- [{c['name']}]({c['url']}) — {c['author']}, {c['years']}")
+ lines.append(f"- [{c['name']}]({c['url']}), {c['author']}, {c['years']}")
for r in spec.get("references", []):
lines.append(f"- [{r['title']}]({r['url']})")
lines.append("")
@@ -1003,7 +1003,7 @@ def gen_references(spec):
lines.append("")
lines.append("## License")
lines.append("")
- lines.append(f"{spec['license']} — see [LICENSE](./LICENSE).")
+ lines.append(f"{spec['license']}. see [LICENSE](./LICENSE).")
lines.append("")
return "\n".join(lines)