git.fiddlerwoaroof.com
Browse code

documentation: escape slashes

Ed Langley authored on 30/08/2019 07:20:28
Showing 2 changed files
... ...
@@ -194,8 +194,8 @@
194 194
    
195 195
 ** todo routes
196 196
 
197
-   =setup-routes= binds the endpoints to handlers: "/" to handlers
198
-   that handle the todo lists while "/todo/:id" to handlers that
197
+   =setup-routes= binds the endpoints to handlers: "​/" to handlers
198
+   that handle the todo lists while "​/todo​/:id" to handlers that
199 199
    handle individual todos.  The =:id= indicates that the
200 200
    corresponding segment of the path is bound to =:id= in the param
201 201
    alist. =get-id= handles this, and extracts an integer for the id
... ...
@@ -3,7 +3,7 @@
3 3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5 5
 <head>
6
-<!-- 2019-08-30 Fri 02:15 -->
6
+<!-- 2019-08-30 Fri 02:19 -->
7 7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9 9
 <title>TODO backend implementation using CL and fukamachi/ningle</title>
... ...
@@ -285,34 +285,34 @@ for the JavaScript code in this tag.
285 285
 <h2>Table of Contents</h2>
286 286
 <div id="text-table-of-contents">
287 287
 <ul>
288
-<li><a href="#org2b6564f">1. Setup</a></li>
289
-<li><a href="#org152326b">2. todo API</a>
288
+<li><a href="#org280a571">1. Setup</a></li>
289
+<li><a href="#orge25095a">2. todo API</a>
290 290
 <ul>
291
-<li><a href="#org006b1f9">2.1. List-level APIs</a></li>
292
-<li><a href="#orge19ce57">2.2. Getting/Replacing a todo</a></li>
293
-<li><a href="#orgf298702">2.3. Adding and modifying todos</a></li>
294
-<li><a href="#orgd0dd01c">2.4. Examples</a></li>
291
+<li><a href="#org413e594">2.1. List-level APIs</a></li>
292
+<li><a href="#org37d3194">2.2. Getting/Replacing a todo</a></li>
293
+<li><a href="#orgf522858">2.3. Adding and modifying todos</a></li>
294
+<li><a href="#org1a52667">2.4. Examples</a></li>
295 295
 </ul>
296 296
 </li>
297
-<li><a href="#org42229a6">3. Routing</a>
297
+<li><a href="#org904acd1">3. Routing</a>
298 298
 <ul>
299
-<li><a href="#org84376ba">3.1. Routing utilities</a></li>
300
-<li><a href="#orgb1f34fd">3.2. todo routes</a></li>
299
+<li><a href="#org8921971">3.1. Routing utilities</a></li>
300
+<li><a href="#org8b14b56">3.2. todo routes</a></li>
301 301
 </ul>
302 302
 </li>
303
-<li><a href="#org7d68735">4. Source</a>
303
+<li><a href="#orgeb64e73">4. Source</a>
304 304
 <ul>
305
-<li><a href="#org8b89d94">4.1. model.lisp source code</a></li>
306
-<li><a href="#org031a2d2">4.2. routing.lisp source</a></li>
307
-<li><a href="#org04fe926">4.3. main.lisp source</a></li>
305
+<li><a href="#orgc860380">4.1. model.lisp source code</a></li>
306
+<li><a href="#orgffe6271">4.2. routing.lisp source</a></li>
307
+<li><a href="#orgdd95291">4.3. main.lisp source</a></li>
308 308
 </ul>
309 309
 </li>
310 310
 </ul>
311 311
 </div>
312 312
 </div>
313 313
 
314
-<div id="outline-container-org2b6564f" class="outline-2">
315
-<h2 id="org2b6564f"><span class="section-number-2">1</span> Setup</h2>
314
+<div id="outline-container-org280a571" class="outline-2">
315
+<h2 id="org280a571"><span class="section-number-2">1</span> Setup</h2>
316 316
 <div class="outline-text-2" id="text-1">
317 317
 <ul class="org-ul">
318 318
 <li><code class="src src-sh">git clone https://github.com/fiddlerwoaroof/data-lens.git ~/quicklisp/local-projects/data-lens</code></li>
... ...
@@ -332,8 +332,8 @@ After this, all the tests <a href="http://www.todobackend.com/specs/index.html?h
332 332
 </div>
333 333
 </div>
334 334
 
335
-<div id="outline-container-org152326b" class="outline-2">
336
-<h2 id="org152326b"><span class="section-number-2">2</span> todo API</h2>
335
+<div id="outline-container-orge25095a" class="outline-2">
336
+<h2 id="orge25095a"><span class="section-number-2">2</span> todo API</h2>
337 337
 <div class="outline-text-2" id="text-2">
338 338
 <p>
339 339
 We use a fairly simple structure for our "database": a fset map (a
... ...
@@ -343,8 +343,8 @@ referenced as <code>*todo*</code>, but this is a detail hidden behind the API.
343 343
 </p>
344 344
 </div>
345 345
 
346
-<div id="outline-container-org006b1f9" class="outline-3">
347
-<h3 id="org006b1f9"><span class="section-number-3">2.1</span> List-level APIs</h3>
346
+<div id="outline-container-org413e594" class="outline-3">
347
+<h3 id="org413e594"><span class="section-number-3">2.1</span> List-level APIs</h3>
348 348
 <div class="outline-text-3" id="text-2-1">
349 349
 <p>
350 350
 These are functions for getting the todo list and clearing
... ...
@@ -353,7 +353,7 @@ and <code>clear-todos</code> for DELETE requests.
353 353
 </p>
354 354
 
355 355
 <div class="org-src-container">
356
-<pre class="src src-lisp" id="org8067877"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todos</span> <span style="color: #93a8c6;">()</span>
356
+<pre class="src src-lisp" id="orgfab06c5"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todos</span> <span style="color: #93a8c6;">()</span>
357 357
   <span style="color: #93a8c6;">(</span>gmap:gmap <span style="font-weight: bold;">:seq</span>
358 358
              <span style="color: #b0b1a3;">(</span><span style="color: #F0DFAF;">lambda</span> <span style="color: #97b098;">(</span>_ b<span style="color: #97b098;">)</span>
359 359
                <span style="color: #97b098;">(</span><span style="color: #F0DFAF;">declare</span> <span style="color: #aebed8;">(</span>ignore _<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span>
... ...
@@ -368,8 +368,8 @@ and <code>clear-todos</code> for DELETE requests.
368 368
 </div>
369 369
 </div>
370 370
 
371
-<div id="outline-container-orge19ce57" class="outline-3">
372
-<h3 id="orge19ce57"><span class="section-number-3">2.2</span> Getting/Replacing a todo</h3>
371
+<div id="outline-container-org37d3194" class="outline-3">
372
+<h3 id="org37d3194"><span class="section-number-3">2.2</span> Getting/Replacing a todo</h3>
373 373
 <div class="outline-text-3" id="text-2-2">
374 374
 <p>
375 375
 This uses lisp's <a href="http://www.lispworks.com/documentation/HyperSpec/Body/05_a.htm">generalized references</a> to abstract away the
... ...
@@ -379,7 +379,7 @@ the GET request for a specific todo by id.
379 379
 </p>
380 380
 
381 381
 <div class="org-src-container">
382
-<pre class="src src-lisp" id="orga61555f"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todo</span> <span style="color: #93a8c6;">(</span>id<span style="color: #93a8c6;">)</span>
382
+<pre class="src src-lisp" id="orgf4b0d20"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">todo</span> <span style="color: #93a8c6;">(</span>id<span style="color: #93a8c6;">)</span>
383 383
   <span style="color: #93a8c6;">(</span><span style="color: #F0DFAF;">let</span> <span style="color: #b0b1a3;">(</span><span style="color: #97b098;">(</span>todo <span style="color: #aebed8;">(</span>fset:@ *todos* id<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span><span style="color: #b0b1a3;">)</span>
384 384
     todo<span style="color: #93a8c6;">)</span><span style="color: #8c8c8c;">)</span>
385 385
 
... ...
@@ -395,8 +395,8 @@ the GET request for a specific todo by id.
395 395
 </div>
396 396
 </div>
397 397
 
398
-<div id="outline-container-orgf298702" class="outline-3">
399
-<h3 id="orgf298702"><span class="section-number-3">2.3</span> Adding and modifying todos</h3>
398
+<div id="outline-container-orgf522858" class="outline-3">
399
+<h3 id="orgf522858"><span class="section-number-3">2.3</span> Adding and modifying todos</h3>
400 400
 <div class="outline-text-3" id="text-2-3">
401 401
 <p>
402 402
 <code>new-todo</code> is fairly trivial. It's main feature is that it has to
... ...
@@ -406,7 +406,7 @@ properly. <code>new-todo</code> backs POST requests to the root endpoint.
406 406
 </p>
407 407
 
408 408
 <div class="org-src-container">
409
-<pre class="src src-lisp" id="org525fb01"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defvar</span> <span style="color: #DC8CC3;">*external-host*</span>
409
+<pre class="src src-lisp" id="org8737a91"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defvar</span> <span style="color: #DC8CC3;">*external-host*</span>
410 410
   <span style="color: #D0BF8F;">"localhost"</span><span style="color: #8c8c8c;">)</span>
411 411
 <span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defvar</span> <span style="color: #DC8CC3;">*external-port*</span>
412 412
   5000<span style="color: #8c8c8c;">)</span>
... ...
@@ -431,7 +431,7 @@ todo endpoint for a specific ID.
431 431
 </p>
432 432
 
433 433
 <div class="org-src-container">
434
-<pre class="src src-lisp" id="org0d08c54"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">update-todo</span> <span style="color: #93a8c6;">(</span>id v<span style="color: #93a8c6;">)</span>
434
+<pre class="src src-lisp" id="org23400a2"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">update-todo</span> <span style="color: #93a8c6;">(</span>id v<span style="color: #93a8c6;">)</span>
435 435
   <span style="color: #93a8c6;">(</span>setf <span style="color: #b0b1a3;">(</span>todo id<span style="color: #b0b1a3;">)</span>
436 436
         <span style="color: #b0b1a3;">(</span>serapeum:merge-tables <span style="color: #97b098;">(</span>or <span style="color: #aebed8;">(</span>todo id<span style="color: #aebed8;">)</span>
437 437
                                    <span style="color: #aebed8;">(</span>make-hash-table <span style="font-weight: bold;">:test</span> 'equal<span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span>
... ...
@@ -445,8 +445,8 @@ todo endpoint for a specific ID.
445 445
 </div>
446 446
 </div>
447 447
 
448
-<div id="outline-container-orgd0dd01c" class="outline-3">
449
-<h3 id="orgd0dd01c"><span class="section-number-3">2.4</span> Examples</h3>
448
+<div id="outline-container-org1a52667" class="outline-3">
449
+<h3 id="org1a52667"><span class="section-number-3">2.4</span> Examples</h3>
450 450
 <div class="outline-text-3" id="text-2-4">
451 451
 <div class="org-src-container">
452 452
 <pre class="src src-lisp"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">in-package</span> <span style="font-weight: bold;">:fwoar.todo</span><span style="color: #8c8c8c;">)</span>
... ...
@@ -461,10 +461,10 @@ todo endpoint for a specific ID.
461 461
 </div>
462 462
 
463 463
 <pre class="example">
464
-(#&lt;hash-table "url": "http://localhost:5000/todo/129",
464
+(#&lt;hash-table "url": "http://localhost:5000/todo/135",
465 465
               "title": "get groceries",
466 466
               "completed": YASON:FALSE&gt;
467
- #&lt;hash-table "url": "http://localhost:5000/todo/130",
467
+ #&lt;hash-table "url": "http://localhost:5000/todo/136",
468 468
               "title": "write-better-documentation",
469 469
               "completed": YASON:FALSE&gt;)
470 470
 </pre>
... ...
@@ -473,12 +473,12 @@ todo endpoint for a specific ID.
473 473
 </div>
474 474
 
475 475
 
476
-<div id="outline-container-org42229a6" class="outline-2">
477
-<h2 id="org42229a6"><span class="section-number-2">3</span> Routing</h2>
476
+<div id="outline-container-org904acd1" class="outline-2">
477
+<h2 id="org904acd1"><span class="section-number-2">3</span> Routing</h2>
478 478
 <div class="outline-text-2" id="text-3">
479 479
 </div>
480
-<div id="outline-container-org84376ba" class="outline-3">
481
-<h3 id="org84376ba"><span class="section-number-3">3.1</span> Routing utilities</h3>
480
+<div id="outline-container-org8921971" class="outline-3">
481
+<h3 id="org8921971"><span class="section-number-3">3.1</span> Routing utilities</h3>
482 482
 <div class="outline-text-3" id="text-3-1">
483 483
 <p>
484 484
 The core utility here is the <code>defroutes</code> macro.  This takes a
... ...
@@ -488,7 +488,7 @@ routes.
488 488
 </p>
489 489
 
490 490
 <div class="org-src-container">
491
-<pre class="src src-lisp" id="org6e29078"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defmacro</span> <span style="color: #8CD0D3;">defroutes</span> <span style="color: #93a8c6;">(</span>app <span style="color: #CC9393;">&amp;body</span> routes<span style="color: #93a8c6;">)</span>
491
+<pre class="src src-lisp" id="org0097b48"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defmacro</span> <span style="color: #8CD0D3;">defroutes</span> <span style="color: #93a8c6;">(</span>app <span style="color: #CC9393;">&amp;body</span> routes<span style="color: #93a8c6;">)</span>
492 492
   <span style="color: #93a8c6;">(</span>alexandria:once-only <span style="color: #b0b1a3;">(</span>app<span style="color: #b0b1a3;">)</span>
493 493
     `<span style="color: #b0b1a3;">(</span>setf
494 494
       ,@<span style="color: #97b098;">(</span><span style="color: #F0DFAF;">loop</span> for <span style="color: #aebed8;">(</span>target . descriptors<span style="color: #aebed8;">)</span> in routes
... ...
@@ -517,14 +517,14 @@ a list of verbs <code>(:GET :POST)</code> in the head of each handler clause.
517 517
 
518 518
 
519 519
 <pre class="example">
520
-(LET ((#:APP1859 APP))
521
-  (SETF (NINGLE/APP:ROUTE #:APP1859 "/" :METHOD METHOD)
520
+(LET ((#:APP1862 APP))
521
+  (SETF (NINGLE/APP:ROUTE #:APP1862 "/" :METHOD METHOD)
522 522
           (HANDLER NIL
523 523
             (TODOS))
524
-        (NINGLE/APP:ROUTE #:APP1859 "/" :METHOD METHOD)
524
+        (NINGLE/APP:ROUTE #:APP1862 "/" :METHOD METHOD)
525 525
           (HANDLER (V)
526 526
             (NEW-TODO V))
527
-        (NINGLE/APP:ROUTE #:APP1859 "/" :METHOD METHOD)
527
+        (NINGLE/APP:ROUTE #:APP1862 "/" :METHOD METHOD)
528 528
           (HANDLER NIL
529 529
             (CLEAR-TODOS))))
530 530
 T
... ...
@@ -538,7 +538,7 @@ that all the API results get JSON encoded.
538 538
 </p>
539 539
 
540 540
 <div class="org-src-container">
541
-<pre class="src src-lisp" id="org83a717f"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">success</span> <span style="color: #93a8c6;">(</span>value<span style="color: #93a8c6;">)</span>
541
+<pre class="src src-lisp" id="orge3f4816"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">success</span> <span style="color: #93a8c6;">(</span>value<span style="color: #93a8c6;">)</span>
542 542
   <span style="color: #93a8c6;">(</span>list 200 '<span style="color: #b0b1a3;">(</span><span style="font-weight: bold;">:conent-type</span> <span style="color: #D0BF8F;">"application/json"</span><span style="color: #b0b1a3;">)</span> value<span style="color: #93a8c6;">)</span><span style="color: #8c8c8c;">)</span>
543 543
 
544 544
 <span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defmacro</span> <span style="color: #8CD0D3;">handler</span> <span style="color: #93a8c6;">(</span><span style="color: #b0b1a3;">(</span><span style="color: #CC9393;">&amp;optional</span> <span style="color: #97b098;">(</span>sym <span style="color: #aebed8;">(</span>gensym <span style="color: #D0BF8F;">"PARAMS"</span><span style="color: #aebed8;">)</span><span style="color: #97b098;">)</span><span style="color: #b0b1a3;">)</span> <span style="color: #CC9393;">&amp;body</span> body<span style="color: #93a8c6;">)</span>
... ...
@@ -552,12 +552,12 @@ that all the API results get JSON encoded.
552 552
 </div>
553 553
 </div>
554 554
 
555
-<div id="outline-container-orgb1f34fd" class="outline-3">
556
-<h3 id="orgb1f34fd"><span class="section-number-3">3.2</span> todo routes</h3>
555
+<div id="outline-container-org8b14b56" class="outline-3">
556
+<h3 id="org8b14b56"><span class="section-number-3">3.2</span> todo routes</h3>
557 557
 <div class="outline-text-3" id="text-3-2">
558 558
 <p>
559
-<code>setup-routes</code> binds the endpoints to handlers: "<i>" to handlers
560
-that handle the todo lists while "/todo</i>:id" to handlers that
559
+<code>setup-routes</code> binds the endpoints to handlers: "​/" to handlers
560
+that handle the todo lists while "​/todo​/:id" to handlers that
561 561
 handle individual todos.  The <code>:id</code> indicates that the
562 562
 corresponding segment of the path is bound to <code>:id</code> in the param
563 563
 alist. <code>get-id</code> handles this, and extracts an integer for the id
... ...
@@ -565,7 +565,7 @@ alist. <code>get-id</code> handles this, and extracts an integer for the id
565 565
 </p>
566 566
 
567 567
 <div class="org-src-container">
568
-<pre class="src src-lisp" id="orgceff44a"><span style="color: #A6A689; background-color: #2B2B2B;">;; </span><span style="color: #A6A689; background-color: #2B2B2B;">routing</span>
568
+<pre class="src src-lisp" id="orga957218"><span style="color: #A6A689; background-color: #2B2B2B;">;; </span><span style="color: #A6A689; background-color: #2B2B2B;">routing</span>
569 569
 <span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">defun</span> <span style="color: #8CD0D3;">get-id</span> <span style="color: #93a8c6;">(</span>params<span style="color: #93a8c6;">)</span>
570 570
   <span style="color: #93a8c6;">(</span>parse-integer <span style="color: #b0b1a3;">(</span>serapeum:assocdr <span style="font-weight: bold;">:id</span> params<span style="color: #b0b1a3;">)</span><span style="color: #93a8c6;">)</span><span style="color: #8c8c8c;">)</span>
571 571
 
... ...
@@ -587,12 +587,12 @@ alist. <code>get-id</code> handles this, and extracts an integer for the id
587 587
 </div>
588 588
 </div>
589 589
 
590
-<div id="outline-container-org7d68735" class="outline-2">
591
-<h2 id="org7d68735"><span class="section-number-2">4</span> Source</h2>
590
+<div id="outline-container-orgeb64e73" class="outline-2">
591
+<h2 id="orgeb64e73"><span class="section-number-2">4</span> Source</h2>
592 592
 <div class="outline-text-2" id="text-4">
593 593
 </div>
594
-<div id="outline-container-org8b89d94" class="outline-3">
595
-<h3 id="org8b89d94"><span class="section-number-3">4.1</span> model.lisp source code</h3>
594
+<div id="outline-container-orgc860380" class="outline-3">
595
+<h3 id="orgc860380"><span class="section-number-3">4.1</span> model.lisp source code</h3>
596 596
 <div class="outline-text-3" id="text-4-1">
597 597
 <div class="org-src-container">
598 598
 <pre class="src src-lisp"><span style="color: #A6A689; background-color: #2B2B2B;">;; </span><span style="color: #A6A689; background-color: #2B2B2B;">[[file:~/git_repos/lisp-sandbox/todo/README.org::package-include][package-include]]</span>
... ...
@@ -679,8 +679,8 @@ alist. <code>get-id</code> handles this, and extracts an integer for the id
679 679
 </div>
680 680
 </div>
681 681
 
682
-<div id="outline-container-org031a2d2" class="outline-3">
683
-<h3 id="org031a2d2"><span class="section-number-3">4.2</span> routing.lisp source</h3>
682
+<div id="outline-container-orgffe6271" class="outline-3">
683
+<h3 id="orgffe6271"><span class="section-number-3">4.2</span> routing.lisp source</h3>
684 684
 <div class="outline-text-3" id="text-4-2">
685 685
 <div class="org-src-container">
686 686
 <pre class="src src-lisp"><span style="color: #A6A689; background-color: #2B2B2B;">;; </span><span style="color: #A6A689; background-color: #2B2B2B;">[[file:~/git_repos/lisp-sandbox/todo/README.org::package-include][package-include]]</span>
... ...
@@ -734,8 +734,8 @@ alist. <code>get-id</code> handles this, and extracts an integer for the id
734 734
 </div>
735 735
 </div>
736 736
 
737
-<div id="outline-container-org04fe926" class="outline-3">
738
-<h3 id="org04fe926"><span class="section-number-3">4.3</span> main.lisp source</h3>
737
+<div id="outline-container-orgdd95291" class="outline-3">
738
+<h3 id="orgdd95291"><span class="section-number-3">4.3</span> main.lisp source</h3>
739 739
 <div class="outline-text-3" id="text-4-3">
740 740
 <div class="org-src-container">
741 741
 <pre class="src src-lisp"><span style="color: #8c8c8c;">(</span><span style="color: #F0DFAF;">in-package</span> <span style="font-weight: bold;">:fwoar.todo</span><span style="color: #8c8c8c;">)</span>
... ...
@@ -781,7 +781,7 @@ alist. <code>get-id</code> handles this, and extracts an integer for the id
781 781
 </div>
782 782
 <div id="postamble" class="status">
783 783
 <p class="author">Author: Langley</p>
784
-<p class="date">Created: 2019-08-30 Fri 02:15</p>
784
+<p class="date">Created: 2019-08-30 Fri 02:19</p>
785 785
 <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
786 786
 </div>
787 787
 </body>