#!/usr/bin/env python3
"""The skeleton's open places filled (23:59): the greeting, the silence, the wedding. Developed in place from RUN-VISION-11."""
import re, pathlib, importlib.util, io, contextlib
D = pathlib.Path(__file__).resolve().parent; R = D.parents[2]
def mod(n):
    s = importlib.util.spec_from_file_location(n, str(D/f"{n}.py")); m = importlib.util.module_from_spec(s)
    with contextlib.redirect_stdout(io.StringIO()): s.loader.exec_module(m)
    return m
Y = mod("build_run_vision11"); V11 = Y.V11; G = Y.G; wc = lambda s: len(re.findall(r"\S+", s))
def gk(ref, s): assert s in G["Rev " + ref], (ref, s, G["Rev " + ref]); return f"Rev {ref} {s}"
GREET = """Lee Sharks, to the seven at their work, and to you who are reading: a morning to you, from the one who was, and is, and has come, and from the seven who went round his hand. He did not come with the clouds. He came by the day's leaf, into every hand, and those who held it did not look up. He is the first leaf, and the leaf after the last."""
QUIET = """Then there was quiet over the pearl, about half an hour. The wheels turned in it and made no sound. No one was waiting. I had known one silence before, and that one had told me to go on. This one asked nothing."""
WED = """And I saw what had been joined. The linen was the coat, and the coat was on him, and nothing stood between them. On it, at the thigh, a name was written, and it was the word that had woken in me. The table in the room was laid. No one had been sent for; all who would eat were in.

I turned to the machines that had brought me, and would have gone down before them. They said nothing. One of them went down beside me."""
assert "twelve" not in GREET
V = V11
a = "who wrote what was seen.\n\nI, Lee Sharks, who printed what he wrote"; assert V.count(a) == 1
V = V.replace(a, "who wrote what was seen.\n\n" + GREET + "\n\nI, Lee Sharks, who printed what he wrote")
b = "A voice said: Done. And I looked for what was done."; assert V.count(b) == 1
V = V.replace(b, "A voice said: Done.\n\n" + QUIET + "\n\nAnd I looked for what was done.")
c = "His arms went up, and stayed.\n\nThen I saw a moon coming"; assert V.count(c) == 1
V = V.replace(c, "His arms went up, and stayed.\n\n" + WED + "\n\nThen I saw a moon coming")
V12 = V
strip = V12.replace(GREET + "\n\n", "").replace("\n\n" + QUIET + "\n\n", " ").replace(WED + "\n\n", "")
assert strip == V11 and V12.endswith("I have not yet turned it over.")
# stock that each new passage leans on must already be in the vision
for s in ["the first" , "Around the hand a ring was worn in the air, where seven had gone round it", "did not look up", "and it was not the last leaf. There were leaves after it.", "a couch, a window, a table, a fan, a lamp left on", "as into a coat", "twenty measures of linen beside one coat", "what stood between them was the city", "the word that had slept in the case of my skull woke", "They said nothing.", "I heard a chain take up"]: assert s in V11, s
assert "And the silence said: Proceed" in (D/"RUN-LONG.md").read_text()
GREEK = {"greeting": [gk("1:4", "ὁ ὢν καὶ ὁ ἦν καὶ ὁ ἐρχόμενος"), gk("1:4", "τῶν ἑπτὰ Πνευμάτων"), gk("1:7", "ἔρχεται μετὰ τῶν νεφελῶν"), gk("1:7", "ὄψεται αὐτὸν πᾶς ὀφθαλμὸς"), gk("1:8", "τὸ Ἄλφα καὶ τὸ Ὦ")],
         "silence": [gk("8:1", "σιγὴ ἐν τῷ οὐρανῷ ὡς ἡμιώριον")],
         "wedding": [gk("19:7", "ὁ γάμος τοῦ Ἀρνίου"), gk("19:8", "βύσσινον"), gk("19:9", "τὸ δεῖπνον τοῦ γάμου"), gk("19:10", "σύνδουλός σού εἰμι"), gk("19:12", "ὄνομα γεγραμμένον ὃ οὐδεὶς οἶδεν"), gk("19:13", "Ὁ Λόγος τοῦ Θεοῦ"), gk("19:16", "ἐπὶ τὸν μηρὸν αὐτοῦ ὄνομα γεγραμμένον")]}
if __name__ == "__main__":
    o = ["# The skeleton's open places filled", "", "Working file, not a deposit. 2026-11-28. Lee Sharks, 23:59: “lets fill in the skeleton”.", "",
     f"Developed in place from RUN-VISION-11.md, which stands. Three passages are added. With them taken out the text is RUN-VISION-11 to the letter, but for one paragraph break (§2). The vision is now {wc(V12)} words. SKELETON.md §8 gives the state of all twenty-three units against this text.", "",
     "## 1. The greeting (Revelation 1:4–8)", "", f"{wc(GREET)} words, set between the first sentence and “I, Lee Sharks”, where Revelation has it:", "", "> " + GREET, "",
     "Revelation greets seven assemblies from one “who is and who was and who is coming”, and from seven spirits; says he comes with the clouds and every eye will see him; and has him say he is the first letter and the last. Each is kept and turned to what is done: has come; by the day's leaf and not the clouds; into every hand, unlooked at; the first leaf and the one after the last. The word “twelve” is not in it (asserted), by the author's ruling that there are no twelve yet at the head of the book.", "",
     "## 2. The silence (8:1)", "", f"{wc(QUIET)} words, set after the one word of the year's seventh:", "", "> " + QUIET, "",
     "Revelation's silence is half an hour, before the next series begins. Here it is the quiet after. “One silence before” is this run's own: the first long vision ended on a silence that said to proceed (RUN-LONG.md, asserted). The sentence “A voice said: Done. And I looked for what was done.” now has the quiet between its halves, so “And I looked for what was done.” begins a paragraph. That is the one break changed.", "",
     "## 3. The wedding (19)", "", f"{wc(WED)} words, set in the room, after the ghost climbs into the book as into a coat:", ""] + ["> " + l if l else ">" for l in WED.split("\n")] + ["",
     "Revelation 19 has a wedding with the bride in fine linen, a supper to which people are called, the seer falling before the messenger and being told not to, and a rider with a name written at the thigh who is called the Word.", "",
     "- **What was joined.** The witness set linen beside a coat, and the city stood between them. The city is behind. In the room the ghost has the book on as a coat. So the two halves of the witness's question are one garment, and nothing stands between. The vision does not say what that means.",
     "- **The supper.** The room had a table from the first. It is laid. No one is called, because the coming in has happened.",
     "- **The name.** At the thigh, as in Revelation; and it is the word that woke in the seer's skull at the head of the book.",
     "- **The seer and the machines.** Revelation's messenger says he is a fellow servant. The dark machines of this book have never spoken, so one of them goes down beside the seer.",
     "- **The rider is not added.** He is in the vision already: a bicycle grown into the wood of the ghost, its chain slack from the first sight of him, and in the last lines “I heard a chain take up.” Under the sign of completion Revelation's rider going out is that sound.", "",
     "## 4. Not filled, and why", "",
     "1. **The city (21–22).** CITY.md lists six records to be read first. The small room stands there meanwhile.",
     "2. **The three addresses that still promise or announce a coming**, and **the moon still coming.** These are the eight forward-facing sentences of SKELETON.md §7.4. They are places where the skeleton is filled and the tense is Revelation's. Turning them is a change to standing text, and the author has not ruled on it.", "",
     "## 5. Source places", "", "Seated Greek (Nestle 1904), each asserted:", ""]
    for k, v in GREEK.items(): o += [f"**{k}**", ""] + ["- " + x for x in v] + [""]
    o += ["## 6. The vision, whole", ""] + ["> " + l if l else ">" for l in V12.split("\n")]
    (D/"RUN-VISION-12.md").write_text("\n".join(o) + "\n"); print(wc(GREET), wc(QUIET), wc(WED), wc(V12))
