Šķîþ ţö ḿàîñ çöñţéñţ

Ļéàŕñ ķàþî › Start here: your writing

Edit through the engine

Read a revision, change one block, and keep every other byte.

kapi apply is the one write verb: a change set names a block by its ref and the revision it read, and the format's writer lands the new text with everything around it unchanged. This lab edits the landing page's heading, compares the page before and after, and sees what happens when the same change set is sent twice.

  1. Read before you writekapi inspect landing/index.html | head -42Each block prints its ref and the rev of its text. An edit names both, so the engine can tell whether the text moved since you read it.
  2. Keep a copycat landing/index.html > index.before.htmlKeep the page as it is, to compare against afterwards.
  3. One change set, one blockkapi apply edit.jsonlA change set is one operation per line. set_content gives the heading new text, at its ref, if the revision still matches. kapi apply lands it through the HTML writer.
  4. What changed, and what did notkdiff index.before.html landing/index.htmlkdiff compares the text inside the format, block by block: one block changed. The markup, the whitespace and the styles around it are byte for byte what they were. Exit 1 says the two differ.
  5. Sent twicekapi apply edit.jsonlSend the same change set again and it is refused: the heading moved since the revision it names. The refusal carries the current revision and text, so a writer, or an agent, reads again and resends rather than overwriting what it has not seen.
  6. Search the text, not the tagskgrep 'port day' landing/index.htmlkgrep searches the text a reader sees, across the format, so a match in the title and one in the heading come back as two blocks with no markup in the way.