git.fiddlerwoaroof.com
Browse code

documentation: use verbatim instead of zero-width space

Ed Langley authored on 30/08/2019 07:25:09
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:19 -->
6
+<!-- 2019-08-30 Fri 02:24 -->
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="#org280a571">1. Setup</a></li>
289
-<li><a href="#orge25095a">2. todo API</a>
288
+<li><a href="#org343d8ca">1. Setup</a></li>
289
+<li><a href="#org86967a4">2. todo API</a>
290 290
 <ul>
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>
291
+<li><a href="#org2559486">2.1. List-level APIs</a></li>
292
+<li><a href="#org2c7df46">2.2. Getting/Replacing a todo</a></li>
293
+<li><a href="#orgc00153f">2.3. Adding and modifying todos</a></li>
294
+<li><a href="#orgfff0f8f">2.4. Examples</a></li>
295 295
 </ul>
296 296
 </li>
297
-<li><a href="#org904acd1">3. Routing</a>
297
+<li><a href="#org4a9d282">3. Routing</a>
298 298
 <ul>
299
-<li><a href="#org8921971">3.1. Routing utilities</a></li>
300
-<li><a href="#org8b14b56">3.2. todo routes</a></li>
299
+<li><a href="#orgef313e5">3.1. Routing utilities</a></li>
300
+<li><a href="#orgf5b5540">3.2. todo routes</a></li>
301 301
 </ul>
302 302
 </li>
303
-<li><a href="#orgeb64e73">4. Source</a>
303
+<li><a href="#org973d526">4. Source</a>
304 304
 <ul>
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>
305
+<li><a href="#orgfcd6386">4.1. model.lisp source code</a></li>
306
+<li><a href="#org3c0842b">4.2. routing.lisp source</a></li>
307
+<li><a href="#orge390366">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-org280a571" class="outline-2">
315
-<h2 id="org280a571"><span class="section-number-2">1</span> Setup</h2>
314
+<div id="outline-container-org343d8ca" class="outline-2">
315
+<h2 id="org343d8ca"><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-orge25095a" class="outline-2">
336
-<h2 id="orge25095a"><span class="section-number-2">2</span> todo API</h2>
335
+<div id="outline-container-org86967a4" class="outline-2">
336
+<h2 id="org86967a4"><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-org413e594" class="outline-3">
347
-<h3 id="org413e594"><span class="section-number-3">2.1</span> List-level APIs</h3>
346
+<div id="outline-container-org2559486" class="outline-3">
347
+<h3 id="org2559486"><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="orgfab06c5"><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="org5be1375"><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-org37d3194" class="outline-3">
372
-<h3 id="org37d3194"><span class="section-number-3">2.2</span> Getting/Replacing a todo</h3>
371
+<div id="outline-container-org2c7df46" class="outline-3">
372
+<h3 id="org2c7df46"><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="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>
382
+<pre class="src src-lisp" id="orgac84e0c"><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-orgf522858" class="outline-3">
399
-<h3 id="orgf522858"><span class="section-number-3">2.3</span> Adding and modifying todos</h3>
398
+<div id="outline-container-orgc00153f" class="outline-3">
399
+<h3 id="orgc00153f"><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="org8737a91"><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="org8122e6a"><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="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>
434
+<pre class="src src-lisp" id="org34e368b"><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-org1a52667" class="outline-3">
449
-<h3 id="org1a52667"><span class="section-number-3">2.4</span> Examples</h3>
448
+<div id="outline-container-orgfff0f8f" class="outline-3">
449
+<h3 id="orgfff0f8f"><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/135",
464
+(#&lt;hash-table "url": "http://localhost:5000/todo/137",
465 465
               "title": "get groceries",
466 466
               "completed": YASON:FALSE&gt;
467
- #&lt;hash-table "url": "http://localhost:5000/todo/136",
467
+ #&lt;hash-table "url": "http://localhost:5000/todo/138",
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-org904acd1" class="outline-2">
477
-<h2 id="org904acd1"><span class="section-number-2">3</span> Routing</h2>
476
+<div id="outline-container-org4a9d282" class="outline-2">
477
+<h2 id="org4a9d282"><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-org8921971" class="outline-3">
481
-<h3 id="org8921971"><span class="section-number-3">3.1</span> Routing utilities</h3>
480
+<div id="outline-container-orgef313e5" class="outline-3">
481
+<h3 id="orgef313e5"><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="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>
491
+<pre class="src src-lisp" id="org91b1a37"><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 ((#:APP1862 APP))
521
-  (SETF (NINGLE/APP:ROUTE #:APP1862 "/" :METHOD METHOD)
520
+(LET ((#:APP1863 APP))
521
+  (SETF (NINGLE/APP:ROUTE #:APP1863 "/" :METHOD METHOD)
522 522
           (HANDLER NIL
523 523
             (TODOS))
524
-        (NINGLE/APP:ROUTE #:APP1862 "/" :METHOD METHOD)
524
+        (NINGLE/APP:ROUTE #:APP1863 "/" :METHOD METHOD)
525 525
           (HANDLER (V)
526 526
             (NEW-TODO V))
527
-        (NINGLE/APP:ROUTE #:APP1862 "/" :METHOD METHOD)
527
+        (NINGLE/APP:ROUTE #:APP1863 "/" :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="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>
541
+<pre class="src src-lisp" id="org7792957"><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-org8b14b56" class="outline-3">
556
-<h3 id="org8b14b56"><span class="section-number-3">3.2</span> todo routes</h3>
555
+<div id="outline-container-orgf5b5540" class="outline-3">
556
+<h3 id="orgf5b5540"><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: "​/" to handlers
560
-that handle the todo lists while "​/todo​/:id" to handlers that
559
+<code>setup-routes</code> binds the endpoints to handlers: <code>"/"</code> to handlers
560
+that handle the todo lists while <code>"/todo/:id"</code> 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="orga957218"><span style="color: #A6A689; background-color: #2B2B2B;">;; </span><span style="color: #A6A689; background-color: #2B2B2B;">routing</span>
568
+<pre class="src src-lisp" id="org375dd30"><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-orgeb64e73" class="outline-2">
591
-<h2 id="orgeb64e73"><span class="section-number-2">4</span> Source</h2>
590
+<div id="outline-container-org973d526" class="outline-2">
591
+<h2 id="org973d526"><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-orgc860380" class="outline-3">
595
-<h3 id="orgc860380"><span class="section-number-3">4.1</span> model.lisp source code</h3>
594
+<div id="outline-container-orgfcd6386" class="outline-3">
595
+<h3 id="orgfcd6386"><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-orgffe6271" class="outline-3">
683
-<h3 id="orgffe6271"><span class="section-number-3">4.2</span> routing.lisp source</h3>
682
+<div id="outline-container-org3c0842b" class="outline-3">
683
+<h3 id="org3c0842b"><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-orgdd95291" class="outline-3">
738
-<h3 id="orgdd95291"><span class="section-number-3">4.3</span> main.lisp source</h3>
737
+<div id="outline-container-orge390366" class="outline-3">
738
+<h3 id="orge390366"><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:19</p>
784
+<p class="date">Created: 2019-08-30 Fri 02:24</p>
785 785
 <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
786 786
 </div>
787 787
 </body>