{"schemaVersion":1,"contentVersion":"3.4.0","id":"foundation.4","languages":{"javascript":{"id":"foundation.4","title":"Read punctuation as word or WORD","moduleName":"Editing foundations","tips":"","concept":"<p class=\"lead\">Move by whole chunks of text between spaces, even when they contain punctuation.</p><p><strong>Before this lesson:</strong> Choose a word destination.</p><p>W, E and B move by WORDs, which are runs of text without spaces. They skip over any punctuation inside the run. They don't know what a URL, a file name or a quote is, so a space inside quotes still starts a new WORD.</p><div class=\"pkeys\"><kbd>W</kbd> <kbd>E</kbd> <kbd>B</kbd></div><h3>Example</h3><p>In “open notes.md now”, w from n stops at the dot, but W reaches now. E from n reaches d at the end of notes.md. B moves back to the start of the previous WORD, or to the start of the current one if you're in the middle of it.</p><h4>Worked text</h4><pre class=\"lesson-example\">const message = \"open notes.md now\";</pre><p>Use Start over to try again.</p>","teaches":["WORD-motion"],"introduces":["W","E","B"],"constraints":[],"drills":[{"task":"Put the cursor on <code>--out</code>.","hint":"W jumps over everything up to the next space.","mode":"jsx","start":"// Builds the shop, then writes the sitemap for the new pages.\nimport { execSync } from \"node:child_process\";\n\nconst run = (command) => execSync(command, { stdio: \"inherit\" });\n\nrun(\"npm run build\");\nrun(\"node scripts/build-sitemap.mjs --out dist/sitemap.xml\");\nconsole.log(\"Release build ready in dist/\");","startCursor":{"line":6,"ch":10},"paths":[{"keys":["W"],"tier":"idiomatic","technique":"motion:W","core":["motion:W","WORD-motion"],"note":"W only stops after a space, so dots and slashes don't slow it down."}],"kind":"navigate","land":{"line":6,"ch":36},"language":"javascript","evidence":"guided","canonicalKey":"foundation.4#0","canonicalFingerprint":"1ut4k5p"},{"task":"Put the cursor on the last character of the docs address, the <code>s</code> of <code>products</code>.","hint":"E goes to the end of a WORD, punctuation and all.","mode":"jsx","start":"import { request } from \"../lib/request.js\";\n\n// The fields are listed at https://docs.northwind.shop/api/products in the API docs.\n// Results come back 24 at a time, newest first.\nexport function listProducts(page = 1) {\n  return request(`/products?page=${page}`);\n}","startCursor":{"line":3,"ch":35},"paths":[{"keys":["k","E"],"tier":"idiomatic","technique":"motion:E","core":["motion:E","WORD-motion"],"note":"E goes to the end of the WORD, past the punctuation inside it."}],"kind":"navigate","land":{"line":2,"ch":67},"language":"javascript","evidence":"guided","canonicalKey":"foundation.4#1","canonicalFingerprint":"18r49pe"},{"task":"Put the cursor on the start of <code>order.shippingAddress.city</code>.","hint":"B goes back to the start of a WORD, past the dots and slashes in it.","mode":"jsx","start":"// The email we send when the parcel leaves the warehouse.\nexport function orderShipped(order) {\n  const city = order.shippingAddress.city ?? \"your address\";\n  return {\n    to: order.customer.email,\n    subject: `Order ${order.number} is on its way to ${city}`,\n  };\n}","startCursor":{"line":2,"ch":40},"paths":[{"keys":["B"],"tier":"idiomatic","technique":"motion:B","core":["motion:B","WORD-motion"],"note":"B goes back to the start of the WORD, past the punctuation inside it."}],"kind":"navigate","land":{"line":2,"ch":15},"language":"javascript","evidence":"guided","canonicalKey":"foundation.4#2","canonicalFingerprint":"158ajt3"}]},"python":{"id":"foundation.4","title":"Read punctuation as word or WORD","moduleName":"Editing foundations","tips":"","concept":"<p class=\"lead\">Move by whole chunks of text between spaces, even when they contain punctuation.</p><p><strong>Before this lesson:</strong> Choose a word destination.</p><p>W, E and B move by WORDs, which are runs of text without spaces. They skip over any punctuation inside the run. They don't know what a URL, a file name or a quote is, so a space inside quotes still starts a new WORD.</p><div class=\"pkeys\"><kbd>W</kbd> <kbd>E</kbd> <kbd>B</kbd></div><h3>Example</h3><p>In “open notes.md now”, w from n stops at the dot, but W reaches now. E from n reaches d at the end of notes.md. B moves back to the start of the previous WORD, or to the start of the current one if you're in the middle of it.</p><h4>Worked text</h4><pre class=\"lesson-example\">message = \"open notes.md now\"</pre><p>Use Start over to try again.</p>","teaches":["WORD-motion"],"introduces":["W","E","B"],"constraints":[],"drills":[{"task":"Put the cursor on <code>--dry-run</code>.","hint":"W jumps over everything up to the next space.","mode":"python","start":"\"\"\"Imports the product catalogue from a CSV export.\n\nRun it like this, and check the output before you run it for real:\n\n    python manage.py import_products --file data/products.csv --dry-run\n\"\"\"\nfrom django.core.management.base import BaseCommand","startCursor":{"line":4,"ch":44},"paths":[{"keys":["W"],"tier":"idiomatic","technique":"motion:W","core":["motion:W","WORD-motion"],"note":"W only stops after a space, so dots and slashes don't slow it down."}],"kind":"navigate","land":{"line":4,"ch":62},"language":"python","evidence":"guided","canonicalKey":"foundation.4#0","canonicalFingerprint":"1ut4k5p"},{"task":"Put the cursor on the last character of the docs address, the <code>s</code> of <code>products</code>.","hint":"E goes to the end of a WORD, punctuation and all.","mode":"python","start":"from shop.catalog.http import client\n\n# The fields are listed at https://docs.northwind.shop/api/products in the API docs.\n# Results come back 24 at a time, newest first.\n\n\ndef list_products(page=1):\n    return client.get(\"/products\", params={\"page\": page})","startCursor":{"line":3,"ch":34},"paths":[{"keys":["k","E"],"tier":"idiomatic","technique":"motion:E","core":["motion:E","WORD-motion"],"note":"E goes to the end of the WORD, past the punctuation inside it."}],"kind":"navigate","land":{"line":2,"ch":66},"language":"python","evidence":"guided","canonicalKey":"foundation.4#1","canonicalFingerprint":"18r49pe"},{"task":"Put the cursor on the start of <code>order.shipping_address.city</code>.","hint":"B goes back to the start of a WORD, past the dots and slashes in it.","mode":"python","start":"\"\"\"The email we send when the parcel leaves the warehouse.\"\"\"\n\n\ndef order_shipped(order):\n    city = order.shipping_address.city or \"your address\"\n    return {\n        \"to\": order.customer.email,\n        \"subject\": f\"Order {order.number} is on its way to {city}\",\n    }","startCursor":{"line":4,"ch":37},"paths":[{"keys":["B"],"tier":"idiomatic","technique":"motion:B","core":["motion:B","WORD-motion"],"note":"B goes back to the start of the WORD, past the punctuation inside it."}],"kind":"navigate","land":{"line":4,"ch":11},"language":"python","evidence":"guided","canonicalKey":"foundation.4#2","canonicalFingerprint":"158ajt3"}]},"text":{"id":"foundation.4","title":"Read punctuation as word or WORD","moduleName":"Editing foundations","tips":"","concept":"<p class=\"lead\">Move by whole chunks of text between spaces, even when they contain punctuation.</p><p><strong>Before this lesson:</strong> Choose a word destination.</p><p>W, E and B move by WORDs, which are runs of text without spaces. They skip over any punctuation inside the run. They don't know what a URL, a file name or a quote is, so a space inside quotes still starts a new WORD.</p><div class=\"pkeys\"><kbd>W</kbd> <kbd>E</kbd> <kbd>B</kbd></div><h3>Example</h3><p>In “open notes.md now”, w from n stops at the dot, but W reaches now. E from n reaches d at the end of notes.md. B moves back to the start of the previous WORD, or to the start of the current one if you're in the middle of it.</p><h4>Worked text</h4><pre class=\"lesson-example\">Message: open notes.md now</pre><p>Use Start over to try again.</p>","teaches":["WORD-motion"],"introduces":["W","E","B"],"constraints":[],"drills":[{"task":"Put the cursor on <code>rotate</code>.","hint":"W jumps over everything up to the next space.","mode":"text/plain","start":"## Logs\n\nThe worker writes to /var/log/northwind/worker.log and rotate.d keeps a week of it.\nErrors also go to #ops-alerts, so you'll see them in Slack.\nOld logs are in the archive bucket for a year.\nAsk Kemal for access to the log server.","startCursor":{"line":2,"ch":21},"paths":[{"keys":["2","W"],"tier":"idiomatic","technique":"motion:W","core":["motion:W","WORD-motion"],"note":"W only stops after a space, so dots and slashes don't slow it down."}],"kind":"navigate","land":{"line":2,"ch":55},"language":"text","evidence":"guided","canonicalKey":"foundation.4#0","canonicalFingerprint":"1ut4k5p"},{"task":"Put the cursor on the last character of the docs address, the <code>s</code> of <code>products</code>.","hint":"E goes to the end of a WORD, punctuation and all.","mode":"text/plain","start":"# Product API\n\nThe fields are listed at https://docs.northwind.shop/api/products in the API docs.\nResults come back 24 at a time, newest first.\nAsk in #api if a field you need is missing.\nThe old v1 endpoints stop working in March.","startCursor":{"line":3,"ch":32},"paths":[{"keys":["k","E"],"tier":"idiomatic","technique":"motion:E","core":["motion:E","WORD-motion"],"note":"E goes to the end of the WORD, past the punctuation inside it."}],"kind":"navigate","land":{"line":2,"ch":64},"language":"text","evidence":"guided","canonicalKey":"foundation.4#1","canonicalFingerprint":"18r49pe"},{"task":"Put the cursor on the start of the backup path, <code>s3://northwind-backups/db/</code>.","hint":"B goes back to the start of a WORD, past the dots and slashes in it.","mode":"text/plain","start":"# Backups\n\nThe database is backed up every night at 2:00.\nCopies go to s3://northwind-backups/db/ and are kept for 30 days.\nTo restore one, follow the steps in docs/restore.md with someone from ops.\nTest a restore once a quarter, so we know it works.","startCursor":{"line":3,"ch":36},"paths":[{"keys":["B"],"tier":"idiomatic","technique":"motion:B","core":["motion:B","WORD-motion"],"note":"B goes back to the start of the WORD, past the punctuation inside it."}],"kind":"navigate","land":{"line":3,"ch":13},"language":"text","evidence":"guided","canonicalKey":"foundation.4#2","canonicalFingerprint":"158ajt3"}]}},"concepts":{"javascript":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Choose a word destination.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Move by whole chunks of text between spaces, even when they contain punctuation.</p><p>W, E and B move by WORDs, which are runs of text without spaces. They skip over any punctuation inside the run. They don't know what a URL, a file name or a quote is, so a space inside quotes still starts a new WORD.</p><h2 class=\"prose-subhead\">Example</h2><p>In “open notes.md now”, w from n stops at the dot, but W reaches now. E from n reaches d at the end of notes.md. B moves back to the start of the previous WORD, or to the start of the current one if you're in the middle of it.</p><p>Use Start over to try again.</p></div></details>"},"python":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Choose a word destination.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Move by whole chunks of text between spaces, even when they contain punctuation.</p><p>W, E and B move by WORDs, which are runs of text without spaces. They skip over any punctuation inside the run. They don't know what a URL, a file name or a quote is, so a space inside quotes still starts a new WORD.</p><h2 class=\"prose-subhead\">Example</h2><p>In “open notes.md now”, w from n stops at the dot, but W reaches now. E from n reaches d at the end of notes.md. B moves back to the start of the previous WORD, or to the start of the current one if you're in the middle of it.</p><p>Use Start over to try again.</p></div></details>"},"text":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Choose a word destination.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Move by whole chunks of text between spaces, even when they contain punctuation.</p><p>W, E and B move by WORDs, which are runs of text without spaces. They skip over any punctuation inside the run. They don't know what a URL, a file name or a quote is, so a space inside quotes still starts a new WORD.</p><h2 class=\"prose-subhead\">Example</h2><p>In “open notes.md now”, w from n stops at the dot, but W reaches now. E from n reaches d at the end of notes.md. B moves back to the start of the previous WORD, or to the start of the current one if you're in the middle of it.</p><p>Use Start over to try again.</p></div></details>"}}}