on master help sign in
Merge pull request #1221 from tinnus-napbus/fix-eyre-examples-html-tags

eyre: replace gals in html with entities to fix rendering (hacky)

commit03c73bde2da50b39edcfad7214c6ab13b0accdae authortinnus-napbus <77721746+tinnus-napbus@users.noreply.github.com> dateWed 20 Oct 2021, 20:27 (5 years ago) parent2af9266cab4bd7
1 file changed+10−10
content/docs/arvo/eyre/examples.md+10−10
content/docs/arvo/eyre/examples.md+10−10
@@ -198,7 +198,7 @@ Server: urbit/vere-1.5
198198set-cookie: urbauth-~zod=0v1.1pseu.tq7hs.hps2t.ltaf1.tmqjm; Path=/; Max-Age=604800
199199content-type: text/html
200200
201−<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>There was an error while handling the request for /foo/bar/baz.json.</p><code>no scry result</code></body></html>
201+&lt;html>&lt;head>&lt;title>404 Not Found&lt;/title>&lt;/head>&lt;body>&lt;h1>Not Found&lt;/h1>&lt;p>There was an error while handling the request for /foo/bar/baz.json.&lt;/p>&lt;code>no scry result&lt;/code>&lt;/body>&lt;/html>
202202```
203203
204204## Direct HTTP Handling With Gall Agents
@@ -244,7 +244,7 @@ Note that this example does a lot of things manually for demonstrative purposes.
244244 ~& [mark req]
245245 ?+ method.request.q.req
246246 =/ data=octs
247− (as-octs:mimes:html '<h1>405 Method Not Allowed</h1>')
247+ (as-octs:mimes:html '&lt;h1>405 Method Not Allowed&lt;/h1>')
248248 =/ content-length=@t
249249 (crip ((d-co:co 1) p.data))
250250 =/ =response-header:http
@@ -262,7 +262,7 @@ Note that this example does a lot of things manually for demonstrative purposes.
262262 ::
263263 %'GET'
264264 =/ data=octs
265− (as-octs:mimes:html '<h1>Hello, World!</h1>')
265+ (as-octs:mimes:html '&lt;h1>Hello, World!&lt;/h1>')
266266 =/ content-length=@t
267267 (crip ((d-co:co 1) p.data))
268268 =/ =response-header:http
@@ -309,9 +309,9 @@ Note that this example does a lot of things manually for demonstrative purposes.
309309Save the above to `/app/eyre-agent.hoon`. Commit it:
310310
311311```
312−> |commit %base
312+> |commit %home
313313>=
314−+ /~zod/base/2/app/eyre-agent/hoon
314++ /~zod/home/2/app/eyre-agent/hoon
315315```
316316
317317...and start it:
@@ -320,7 +320,7 @@ Save the above to `/app/eyre-agent.hoon`. Commit it:
320320> |start %eyre-agent
321321>=
322322gall: loading %eyre-agent
323−activated app base/eyre-agent
323+activated app home/eyre-agent
324324[unlinked from [p=~zod q=%eyre-agent]]
325325```
326326
@@ -368,7 +368,7 @@ Content-Type: text/html
368368Content-Length: 22
369369transfer-encoding: chunked
370370
371−<h1>Hello, World!</h1>%
371+&lt;h1>Hello, World!&lt;/h1>%
372372```
373373
374374...which has succeed! This is because the `+on-poke` arm tests for http GET requests and responds with `Hello, World!` when it sees one:
@@ -376,7 +376,7 @@ transfer-encoding: chunked
376376```hoon
377377 %'GET'
378378=/ data=octs
379− (as-octs:mimes:html '<h1>Hello, World!</h1>')
379+ (as-octs:mimes:html '&lt;h1>Hello, World!&lt;/h1>')
380380=/ content-length=@t
381381 (crip ((d-co:co 1) p.data))
382382=/ =response-header:http
@@ -430,7 +430,7 @@ Here we'll look at running a generator via Eyre. Eyre doesn't have a mediated JS
430430
431431You can refer to the [%serve](/docs/arvo/eyre/tasks#serve) section of the [Internal API Reference](/docs/arvo/eyre/tasks) document for relevant details.
432432
433−Here's a very simple generator that will just echo back the body of the request (if available) along with the current datetime. You can save it in the `/gen` directory and `|commit %base`.
433+Here's a very simple generator that will just echo back the body of the request (if available) along with the current datetime. You can save it in the `/gen` directory and `|commit %home`.
434434
435435Note that this example does some things manually for demonstrative purposes. In practice you'd likely want to use a library like `/lib/server.hoon` to cut down on boilerplate code.
436436
@@ -478,7 +478,7 @@ The [$binding](/docs/arvo/eyre/data-types#binding) specifies the site and URL pa
478478Let's bind our generator to the `/mygen` URL path with the `|pass` command in the dojo:
479479
480480```
481−|pass [%e [%serve `/mygen %base /gen/eyre-gen/hoon ~]]
481+|pass [%e [%serve `/mygen %home /gen/eyre-gen/hoon ~]]
482482```
483483
484484Note that Eyre responds with a `%bound` `gift` to indicate whether the binding succeeded but `|pass` doesn't take such responses so it's not shown.