Artifact 11f89f1bffffd66823d06c733b8f3dcaea07438f:


0000: 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 32 30 30  ;; Copyright 200
0010: 37 2d 32 30 31 31 2c 20 4d 61 74 74 68 65 77 20  7-2011, Matthew 
0020: 57 65 6c 6c 61 6e 64 2e 0a 3b 3b 20 0a 3b 3b 20  Welland..;; .;; 
0030: 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73   This program is
0040: 20 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 20   made available 
0050: 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 50  under the GNU GP
0060: 4c 20 76 65 72 73 69 6f 6e 20 32 2e 30 20 6f 72  L version 2.0 or
0070: 0a 3b 3b 20 20 67 72 65 61 74 65 72 2e 20 53 65  .;;  greater. Se
0080: 65 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 69  e the accompanyi
0090: 6e 67 20 66 69 6c 65 20 43 4f 50 59 49 4e 47 20  ng file COPYING 
00a0: 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 3b 3b 20  for details..;; 
00b0: 0a 3b 3b 20 20 54 68 69 73 20 70 72 6f 67 72 61  .;;  This progra
00c0: 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 64  m is distributed
00d0: 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 52   WITHOUT ANY WAR
00e0: 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 74 20 65  RANTY; without e
00f0: 76 65 6e 20 74 68 65 0a 3b 3b 20 20 69 6d 70 6c  ven the.;;  impl
0100: 69 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 20  ied warranty of 
0110: 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 20  MERCHANTABILITY 
0120: 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 20 41  or FITNESS FOR A
0130: 20 50 41 52 54 49 43 55 4c 41 52 0a 3b 3b 20 20   PARTICULAR.;;  
0140: 50 55 52 50 4f 53 45 2e 0a 0a 28 64 65 63 6c 61  PURPOSE...(decla
0150: 72 65 20 28 75 6e 69 74 20 68 74 6d 6c 2d 66 69  re (unit html-fi
0160: 6c 74 65 72 29 29 0a 28 72 65 71 75 69 72 65 2d  lter)).(require-
0170: 65 78 74 65 6e 73 69 6f 6e 20 72 65 67 65 78 29  extension regex)
0180: 0a 0a 3b 3b 20 0a 28 64 65 66 69 6e 65 20 28 73  ..;; .(define (s
0190: 3a 73 70 6c 69 74 2d 73 74 72 69 6e 67 20 73 74  :split-string st
01a0: 72 6e 67 20 64 65 6c 69 6d 29 0a 20 20 28 69 66  rng delim).  (if
01b0: 20 28 65 71 3f 20 28 73 74 72 69 6e 67 2d 6c 65   (eq? (string-le
01c0: 6e 67 74 68 20 73 74 72 6e 67 29 20 30 29 20 28  ngth strng) 0) (
01d0: 6c 69 73 74 20 73 74 72 6e 67 29 0a 20 20 20 20  list strng).    
01e0: 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 68 65    (let loop ((he
01f0: 61 64 20 28 6d 61 6b 65 2d 73 74 72 69 6e 67 20  ad (make-string 
0200: 31 20 28 63 61 72 20 28 73 74 72 69 6e 67 2d 3e  1 (car (string->
0210: 6c 69 73 74 20 73 74 72 6e 67 29 29 29 29 0a 09  list strng))))..
0220: 09 20 28 74 61 69 6c 20 28 63 64 72 20 28 73 74  . (tail (cdr (st
0230: 72 69 6e 67 2d 3e 6c 69 73 74 20 73 74 72 6e 67  ring->list strng
0240: 29 29 29 0a 09 09 20 28 64 65 73 74 20 27 28 29  )))... (dest '()
0250: 29 0a 09 09 20 28 74 65 6d 70 20 22 22 29 29 0a  )... (temp "")).
0260: 09 28 63 6f 6e 64 20 28 28 65 71 75 61 6c 3f 20  .(cond ((equal? 
0270: 68 65 61 64 20 64 65 6c 69 6d 29 0a 09 20 20 20  head delim)..   
0280: 20 20 20 20 28 73 65 74 21 20 64 65 73 74 20 28      (set! dest (
0290: 61 70 70 65 6e 64 20 64 65 73 74 20 28 6c 69 73  append dest (lis
02a0: 74 20 74 65 6d 70 29 29 29 0a 09 20 20 20 20 20  t temp)))..     
02b0: 20 20 28 73 65 74 21 20 74 65 6d 70 20 22 22 29    (set! temp "")
02c0: 29 0a 09 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f  )..      ((null?
02d0: 20 68 65 61 64 29 20 0a 09 20 20 20 20 20 20 20   head) ..       
02e0: 28 73 65 74 21 20 64 65 73 74 20 28 61 70 70 65  (set! dest (appe
02f0: 6e 64 20 64 65 73 74 20 28 6c 69 73 74 20 74 65  nd dest (list te
0300: 6d 70 29 29 29 29 0a 09 20 20 20 20 20 20 28 65  mp))))..      (e
0310: 6c 73 65 20 28 73 65 74 21 20 74 65 6d 70 20 28  lse (set! temp (
0320: 73 74 72 69 6e 67 2d 61 70 70 65 6e 64 20 74 65  string-append te
0330: 6d 70 20 68 65 61 64 29 29 29 29 20 3b 3b 20 65  mp head)))) ;; e
0340: 6e 64 20 69 66 0a 09 28 63 6f 6e 64 20 28 28 6e  nd if..(cond ((n
0350: 75 6c 6c 3f 20 74 61 69 6c 29 0a 09 20 20 20 20  ull? tail)..    
0360: 20 20 20 28 73 65 74 21 20 64 65 73 74 20 28 61     (set! dest (a
0370: 70 70 65 6e 64 20 64 65 73 74 20 28 6c 69 73 74  ppend dest (list
0380: 20 74 65 6d 70 29 29 29 20 64 65 73 74 29 0a 09   temp))) dest)..
0390: 20 20 20 20 20 20 28 65 6c 73 65 20 28 6c 6f 6f        (else (loo
03a0: 70 20 28 6d 61 6b 65 2d 73 74 72 69 6e 67 20 31  p (make-string 1
03b0: 20 28 63 61 72 20 74 61 69 6c 29 29 20 28 63 64   (car tail)) (cd
03c0: 72 20 74 61 69 6c 29 20 64 65 73 74 20 74 65 6d  r tail) dest tem
03d0: 70 29 29 29 29 29 29 0a 0a 3b 3b 20 61 6c 6c 6f  p))))))..;; allo
03e0: 77 65 64 2d 74 61 67 73 20 69 73 20 61 20 6c 69  wed-tags is a li
03f0: 73 74 20 6f 66 20 74 61 67 73 20 61 73 20 73 79  st of tags as sy
0400: 6d 62 6f 6c 73 3a 0a 3b 3b 20 20 20 27 28 61 20  mbols:.;;   '(a 
0410: 62 20 63 65 6e 74 65 72 20 70 20 61 29 0a 3b 3b  b center p a).;;
0420: 20 70 61 72 73 69 6e 67 20 69 73 20 73 69 6d 70   parsing is simp
0430: 6c 69 73 74 69 63 20 61 6e 64 20 74 68 65 20 72  listic and the r
0440: 65 73 70 6f 6e 73 65 20 63 6f 6e 73 65 72 76 61  esponse conserva
0450: 74 69 76 65 0a 3b 3b 20 69 66 20 61 20 3c 20 69  tive.;; if a < i
0460: 73 20 66 6f 75 6e 64 20 77 69 74 68 6f 75 74 20  s found without 
0470: 74 68 65 20 74 61 67 20 61 6e 64 20 63 6c 6f 73  the tag and clos
0480: 69 6e 67 20 3e 20 74 68 65 6e 0a 3b 3b 20 74 68  ing > then.;; th
0490: 65 20 3c 20 6f 72 20 3e 20 69 73 20 72 65 70 6c  e < or > is repl
04a0: 61 63 65 64 20 77 69 74 68 20 26 6c 74 3b 20 6f  aced with &lt; o
04b0: 72 20 26 67 74 3b 20 77 69 74 68 6f 75 74 20 0a  r &gt; without .
04c0: 3b 3b 20 65 76 65 6e 20 74 72 79 69 6e 67 20 68  ;; even trying h
04d0: 61 72 64 20 74 6f 20 66 69 67 75 72 65 20 6f 75  ard to figure ou
04e0: 74 20 69 66 20 74 68 65 72 65 20 69 73 20 61 20  t if there is a 
04f0: 6c 65 67 69 74 20 74 61 67 20 0a 3b 3b 20 62 75  legit tag .;; bu
0500: 72 69 65 64 20 69 6e 20 74 68 65 20 74 65 78 74  ried in the text
0510: 20 73 6f 6d 65 77 68 65 72 65 2e 0a 3b 3b 20 61   somewhere..;; a
0520: 20 6c 69 73 74 20 6f 66 20 73 74 72 69 6e 67 73   list of strings
0530: 20 69 73 20 72 65 74 75 72 6e 65 64 2e 0a 3b 3b   is returned..;;
0540: 0a 3b 3b 20 4e 4f 54 45 53 0a 3b 3b 20 31 2e 20  .;; NOTES.;; 1. 
0550: 63 61 73 65 20 69 73 20 69 6d 70 6f 72 74 61 6e  case is importan
0560: 74 20 69 6e 20 74 68 65 20 61 6c 6c 6f 77 65 64  t in the allowed
0570: 2d 74 61 67 73 20 6c 69 73 74 21 0a 3b 3b 20 32  -tags list!.;; 2
0580: 2e 20 6f 6e 6c 79 20 22 73 6f 6c 69 64 22 20 74  . only "solid" t
0590: 61 67 73 20 61 72 65 20 73 75 70 70 6f 72 74 65  ags are supporte
05a0: 64 20 69 2e 65 2e 20 3c 61 20 68 72 65 66 3d 22  d i.e. <a href="
05b0: 66 6f 6f 22 3e 20 77 69 6c 6c 20 6e 6f 74 20 77  foo"> will not w
05c0: 6f 72 6b 3f 0a 3b 3b 0a 0a 3b 3b 20 28 73 3a 63  ork?.;;..;; (s:c
05d0: 67 69 2d 6f 75 74 20 28 65 76 61 6c 20 28 73 3a  gi-out (eval (s:
05e0: 6f 75 74 70 75 74 20 28 73 3a 68 74 6d 6c 2d 66  output (s:html-f
05f0: 69 6c 74 65 72 20 22 68 65 6c 6c 6f 3c 62 3e 67  ilter "hello<b>g
0600: 6f 6f 64 62 79 65 3c 2f 62 3e 3c 62 3e 20 65 68  oodbye</b><b> eh
0610: 22 20 27 28 61 20 62 20 69 29 29 29 29 0a 0a 3b  " '(a b i))))..;
0620: 3b 20 73 74 72 61 74 65 67 79 0a 3b 3b 20 31 2e  ; strategy.;; 1.
0630: 20 63 6f 6e 76 65 72 74 20 5c 6e 20 74 6f 20 3c   convert \n to <
0640: 6c 69 6e 65 66 65 65 64 3e 0a 3b 3b 20 32 2e 20  linefeed>.;; 2. 
0650: 53 70 6c 69 74 20 6f 6e 20 22 3c 22 0a 3b 3b 20  Split on "<".;; 
0660: 33 2e 20 53 70 6c 69 74 20 6f 6e 20 22 3e 22 0a  3. Split on ">".
0670: 3b 3b 20 34 2e 20 46 69 78 0a 28 64 65 66 69 6e  ;; 4. Fix.(defin
0680: 65 20 28 73 3a 68 74 6d 6c 2d 66 69 6c 74 65 72  e (s:html-filter
0690: 20 69 6e 70 75 74 2d 74 65 78 74 20 61 6c 6c 6f   input-text allo
06a0: 77 65 64 2d 74 61 67 73 29 0a 20 20 28 6c 65 74  wed-tags).  (let
06b0: 2a 20 28 28 74 6f 6b 73 20 20 20 28 73 3a 73 74  * ((toks   (s:st
06c0: 72 2d 3e 74 6f 6b 73 20 69 6e 70 75 74 2d 74 65  r->toks input-te
06d0: 78 74 29 29 0a 09 20 28 74 6d 70 20 20 20 20 28  xt)).. (tmp    (
06e0: 73 3a 74 6f 6b 73 2d 3e 73 74 6d 6c 20 27 28 73  s:toks->stml '(s
06f0: 3a 6e 75 6c 6c 29 20 23 66 20 74 6f 6b 73 20 61  :null) #f toks a
0700: 6c 6c 6f 77 65 64 2d 74 61 67 73 29 29 0a 09 20  llowed-tags)).. 
0710: 28 72 65 73 20 20 20 20 28 63 61 72 20 74 6d 70  (res    (car tmp
0720: 29 29 0a 09 20 28 6e 78 74 74 61 67 20 28 63 61  )).. (nxttag (ca
0730: 64 72 20 74 6d 70 29 29 0a 09 20 28 72 65 6d 20  dr tmp)).. (rem 
0740: 20 20 20 28 63 61 64 64 72 20 74 6d 70 29 29 29     (caddr tmp)))
0750: 0a 20 20 20 20 72 65 73 29 29 0a 0a 28 64 65 66  .    res))..(def
0760: 69 6e 65 20 28 73 3a 68 74 6d 6c 2d 66 69 6c 74  ine (s:html-filt
0770: 65 72 2d 3e 73 74 72 69 6e 67 20 69 6e 70 75 74  er->string input
0780: 2d 74 65 78 74 20 61 6c 6c 6f 77 65 64 2d 74 61  -text allowed-ta
0790: 67 73 29 0a 20 20 28 6c 65 74 20 28 28 6f 73 74  gs).  (let ((ost
07a0: 72 20 28 6f 70 65 6e 2d 6f 75 74 70 75 74 2d 73  r (open-output-s
07b0: 74 72 69 6e 67 29 29 29 0a 20 20 20 20 3b 3b 3b  tring))).    ;;;
07c0: 20 28 73 3a 6f 75 74 70 75 74 2d 6e 65 77 20 6f   (s:output-new o
07d0: 73 74 72 20 28 73 3a 68 74 6d 6c 2d 66 69 6c 74  str (s:html-filt
07e0: 65 72 20 69 6e 70 75 74 2d 74 65 78 74 20 61 6c  er input-text al
07f0: 6c 6f 77 65 64 2d 74 61 67 73 29 29 0a 20 20 20  lowed-tags)).   
0800: 20 28 73 3a 6f 75 74 70 75 74 2d 6e 65 77 20 6f   (s:output-new o
0810: 73 74 72 20 28 63 61 72 20 28 65 76 61 6c 20 28  str (car (eval (
0820: 73 3a 68 74 6d 6c 2d 66 69 6c 74 65 72 20 69 6e  s:html-filter in
0830: 70 75 74 2d 74 65 78 74 20 61 6c 6c 6f 77 65 64  put-text allowed
0840: 2d 74 61 67 73 29 29 29 29 0a 20 20 20 20 28 67  -tags)))).    (g
0850: 65 74 2d 6f 75 74 70 75 74 2d 73 74 72 69 6e 67  et-output-string
0860: 20 6f 73 74 72 29 29 29 0a 09 0a 3b 3b 20 20 20   ostr)))...;;   
0870: 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d    (if (null? rem
0880: 29 0a 3b 3b 20 09 72 65 73 20 27 28 29 29 0a 3b  ).;; .res '()).;
0890: 3b 20 09 28 73 3a 74 6f 6b 73 2d 3e 73 74 6d 6c  ; .(s:toks->stml
08a0: 20 28 69 66 20 28 6c 69 73 74 3f 20 72 65 73 29   (if (list? res)
08b0: 20 72 65 73 20 27 28 29 29 20 23 66 20 72 65 6d   res '()) #f rem
08c0: 20 61 6c 6c 6f 77 65 64 2d 74 61 67 73 29 29 29   allowed-tags)))
08d0: 29 0a 0a 28 64 65 66 69 6e 65 20 28 73 3a 73 74  )..(define (s:st
08e0: 72 2d 3e 74 6f 6b 73 20 73 74 72 29 0a 20 20 28  r->toks str).  (
08f0: 61 70 70 6c 79 20 61 70 70 65 6e 64 20 28 6d 61  apply append (ma
0900: 70 20 28 6c 61 6d 62 64 61 20 28 74 6f 6b 29 0a  p (lambda (tok).
0910: 09 09 20 20 20 20 20 20 20 28 69 6e 74 65 72 73  ..       (inters
0920: 70 65 72 73 65 20 28 73 3a 73 70 6c 69 74 2d 73  perse (s:split-s
0930: 74 72 69 6e 67 20 74 6f 6b 20 22 3e 22 29 20 22  tring tok ">") "
0940: 3e 22 29 29 20 0a 09 09 20 20 20 20 20 28 69 6e  >")) ...     (in
0950: 74 65 72 73 70 65 72 73 65 20 28 73 3a 73 70 6c  tersperse (s:spl
0960: 69 74 2d 73 74 72 69 6e 67 20 73 74 72 20 22 3c  it-string str "<
0970: 22 29 20 22 3c 22 29 29 29 29 0a 0a 28 64 65 66  ") "<"))))..(def
0980: 69 6e 65 20 28 73 3a 74 61 67 2d 3e 73 74 6d 6c  ine (s:tag->stml
0990: 20 74 61 67 29 0a 20 20 28 73 74 72 69 6e 67 2d   tag).  (string-
09a0: 3e 73 79 6d 62 6f 6c 20 28 73 74 72 69 6e 67 2d  >symbol (string-
09b0: 61 70 70 65 6e 64 20 22 73 3a 22 20 28 73 79 6d  append "s:" (sym
09c0: 62 6f 6c 2d 3e 73 74 72 69 6e 67 20 74 61 67 29  bol->string tag)
09d0: 29 29 29 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73  )))...(define (s
09e0: 3a 74 6f 6b 73 2d 3e 73 74 6d 6c 20 72 65 73 20  :toks->stml res 
09f0: 74 61 67 20 72 65 6d 20 61 6c 6c 6f 77 65 64 29  tag rem allowed)
0a00: 0a 20 20 3b 3b 20 28 70 72 69 6e 74 20 22 74 61  .  ;; (print "ta
0a10: 67 3a 20 22 20 74 61 67 20 22 20 72 65 6d 3a 20  g: " tag " rem: 
0a20: 22 20 72 65 6d 29 0a 20 20 28 69 66 20 28 6e 75  " rem).  (if (nu
0a30: 6c 6c 3f 20 72 65 6d 29 0a 20 20 20 20 20 20 28  ll? rem).      (
0a40: 6c 69 73 74 20 28 61 70 70 65 6e 64 20 72 65 73  list (append res
0a50: 20 28 69 66 20 74 61 67 0a 09 09 09 20 20 20 20   (if tag....    
0a60: 28 6c 69 73 74 20 28 73 3a 74 61 67 2d 3e 73 74  (list (s:tag->st
0a70: 6d 6c 20 74 61 67 29 29 0a 09 09 09 09 27 28 29  ml tag)).....'()
0a80: 29 29 20 23 66 20 27 28 29 20 61 6c 6c 6f 77 65  )) #f '() allowe
0a90: 64 29 20 3b 3b 20 74 68 65 20 63 61 73 65 20 6f  d) ;; the case o
0aa0: 66 20 61 20 6c 6f 6e 65 20 74 61 67 20 0a 20 20  f a lone tag .  
0ab0: 20 20 20 20 3b 3b 20 68 61 6e 64 6c 65 20 61 20      ;; handle a 
0ac0: 73 74 61 72 74 69 6e 67 20 74 61 67 0a 20 20 20  starting tag.   
0ad0: 20 20 20 28 6c 65 74 2a 20 28 28 74 6d 70 20 20     (let* ((tmp  
0ae0: 20 20 20 20 20 28 73 3a 75 70 74 6f 2d 74 61 67       (s:upto-tag
0af0: 20 72 65 6d 20 61 6c 6c 6f 77 65 64 29 29 0a 09   rem allowed))..
0b00: 20 20 20 20 20 28 74 78 74 20 20 20 20 20 20 20       (txt       
0b10: 28 63 61 72 20 74 6d 70 29 29 20 20 20 20 20 20  (car tmp))      
0b20: 3b 3b 20 74 68 69 73 20 74 78 74 20 67 6f 65 73  ;; this txt goes
0b30: 20 77 69 74 68 20 74 61 67 21 21 21 0a 09 20 20   with tag!!!..  
0b40: 20 20 20 28 6e 65 78 74 74 61 67 20 20 20 28 63     (nexttag   (c
0b50: 61 64 72 20 74 6d 70 29 29 20 20 20 20 20 3b 3b  adr tmp))     ;;
0b60: 20 74 68 69 73 20 69 73 20 74 68 65 20 4e 45 58   this is the NEX
0b70: 54 20 44 41 4d 4e 20 74 61 67 21 0a 09 20 20 20  T DAMN tag!..   
0b80: 20 20 28 62 65 67 69 6e 2d 74 61 67 20 28 63 61    (begin-tag (ca
0b90: 64 64 72 20 74 6d 70 29 29 0a 09 20 20 20 20 20  ddr tmp))..     
0ba0: 28 6e 65 77 72 65 6d 20 20 20 20 28 63 61 64 64  (newrem    (cadd
0bb0: 64 72 20 74 6d 70 29 29 29 0a 09 3b 3b 20 28 70  dr tmp)))..;; (p
0bc0: 72 69 6e 74 20 22 74 78 74 3a 20 20 20 20 20 20  rint "txt:      
0bd0: 20 20 22 20 74 78 74 20 22 5c 6e 6e 65 78 74 74    " txt "\nnextt
0be0: 61 67 3a 20 20 20 20 22 20 6e 65 78 74 74 61 67  ag:    " nexttag
0bf0: 20 22 5c 6e 62 65 67 69 6e 2d 74 61 67 3a 20 20   "\nbegin-tag:  
0c00: 22 20 62 65 67 69 6e 2d 74 61 67 20 22 5c 6e 6e  " begin-tag "\nn
0c10: 65 77 72 65 6d 3a 20 20 20 20 20 22 20 6e 65 77  ewrem:     " new
0c20: 72 65 6d 20 22 5c 6e 72 65 73 3a 20 20 20 20 20  rem "\nres:     
0c30: 20 20 20 22 20 72 65 73 20 22 5c 6e 22 29 0a 09     " res "\n")..
0c40: 28 69 66 20 62 65 67 69 6e 2d 74 61 67 20 3b 3b  (if begin-tag ;;
0c50: 20 6e 65 73 74 20 74 68 65 20 66 6f 6c 6c 6f 77   nest the follow
0c60: 69 6e 67 20 73 74 75 66 66 0a 09 20 20 20 20 28  ing stuff..    (
0c70: 6c 65 74 2a 20 28 28 63 68 69 6c 64 64 61 74 20  let* ((childdat 
0c80: 28 73 3a 74 6f 6b 73 2d 3e 73 74 6d 6c 20 27 28  (s:toks->stml '(
0c90: 29 20 6e 65 78 74 74 61 67 20 6e 65 77 72 65 6d  ) nexttag newrem
0ca0: 20 61 6c 6c 6f 77 65 64 29 29 0a 09 09 20 20 20   allowed))...   
0cb0: 28 63 68 69 6c 64 20 20 20 20 28 63 61 72 20 63  (child    (car c
0cc0: 68 69 6c 64 64 61 74 29 29 0a 09 09 20 20 20 28  hilddat))...   (
0cd0: 6e 65 77 74 61 67 20 20 20 28 63 61 64 72 20 63  newtag   (cadr c
0ce0: 68 69 6c 64 64 61 74 29 29 0a 09 09 20 20 20 28  hilddat))...   (
0cf0: 6e 65 77 72 65 6d 32 20 20 28 63 61 64 64 72 20  newrem2  (caddr 
0d00: 63 68 69 6c 64 64 61 74 29 29 0a 09 09 20 20 20  childdat))...   
0d10: 28 61 6c 6c 6f 77 65 64 20 20 28 63 61 64 64 64  (allowed  (caddd
0d20: 72 20 63 68 69 6c 64 64 61 74 29 29 29 20 3b 3b  r childdat))) ;;
0d30: 20 79 61 2c 20 69 74 20 73 68 6f 75 6c 64 6e 27   ya, it shouldn'
0d40: 74 20 68 61 76 65 20 63 68 61 6e 67 65 64 0a 09  t have changed..
0d50: 20 20 20 20 20 20 28 69 66 20 74 61 67 20 0a 09        (if tag ..
0d60: 09 20 20 28 73 3a 74 6f 6b 73 2d 3e 73 74 6d 6c  .  (s:toks->stml
0d70: 20 28 61 70 70 65 6e 64 20 72 65 73 20 28 6c 69   (append res (li
0d80: 73 74 20 28 61 70 70 65 6e 64 20 28 6c 69 73 74  st (append (list
0d90: 20 28 73 3a 74 61 67 2d 3e 73 74 6d 6c 20 74 61   (s:tag->stml ta
0da0: 67 29 29 20 63 68 69 6c 64 20 28 6c 69 73 74 20  g)) child (list 
0db0: 74 78 74 29 29 29 29 0a 09 09 09 09 6e 65 77 74  txt)))).....newt
0dc0: 61 67 20 6e 65 77 72 65 6d 32 20 61 6c 6c 6f 77  ag newrem2 allow
0dd0: 65 64 29 0a 09 09 20 20 28 73 3a 74 6f 6b 73 2d  ed)...  (s:toks-
0de0: 3e 73 74 6d 6c 20 28 61 70 70 65 6e 64 20 72 65  >stml (append re
0df0: 73 20 28 6c 69 73 74 20 74 78 74 29 20 63 68 69  s (list txt) chi
0e00: 6c 64 29 0a 09 09 09 09 6e 65 77 74 61 67 20 6e  ld).....newtag n
0e10: 65 77 72 65 6d 32 20 61 6c 6c 6f 77 65 64 29 29  ewrem2 allowed))
0e20: 29 0a 09 20 20 20 20 3b 3b 20 69 74 20 6d 75 73  )..    ;; it mus
0e30: 74 20 68 61 76 65 20 62 65 65 6e 20 61 6e 20 65  t have been an e
0e40: 6e 64 20 74 61 67 0a 09 20 20 20 20 28 6c 69 73  nd tag..    (lis
0e50: 74 20 28 61 70 70 65 6e 64 20 72 65 73 20 28 6c  t (append res (l
0e60: 69 73 74 20 0a 09 09 09 20 20 20 20 20 20 20 28  ist ....       (
0e70: 69 66 20 74 61 67 0a 09 09 09 09 20 20 20 28 6c  if tag.....   (l
0e80: 69 73 74 20 28 73 3a 74 61 67 2d 3e 73 74 6d 6c  ist (s:tag->stml
0e90: 20 74 61 67 29 20 74 78 74 29 0a 09 09 09 09 20   tag) txt)..... 
0ea0: 20 20 74 78 74 29 29 29 0a 09 09 20 20 23 66 0a    txt)))...  #f.
0eb0: 09 09 20 20 6e 65 77 72 65 6d 0a 09 09 20 20 61  ..  newrem...  a
0ec0: 6c 6c 6f 77 65 64 29 29 29 29 29 0a 0a 0a 3b 3b  llowed)))))...;;
0ed0: 20 22 3c 22 20 22 62 22 20 22 3e 22 20 20 3d 3e   "<" "b" ">"  =>
0ee0: 20 22 3c 62 3e 22 0a 3b 3b 20 22 3c 22 0a 3b 3b   "<b>".;; "<".;;
0ef0: 20 28 64 65 66 69 6e 65 20 28 73 3a 72 65 62 75   (define (s:rebu
0f00: 69 6c 64 2d 74 61 67 73 20 69 6e 70 75 74 2d 6c  ild-tags input-l
0f10: 69 73 74 29 0a 0a 3b 3b 20 28 22 62 6c 61 68 20  ist)..;; ("blah 
0f20: 62 6c 61 68 22 20 22 3c 22 20 22 62 22 20 22 3e  blah" "<" "b" ">
0f30: 22 20 22 6d 6f 72 65 20 73 74 75 66 66 22 20 22  " "more stuff" "
0f40: 3c 22 20 22 69 22 20 22 3e 22 20 29 20 0a 3b 3b  <" "i" ">" ) .;;
0f50: 20 20 20 20 20 3d 3e 20 28 22 62 6c 61 68 20 62       => ("blah b
0f60: 6c 61 68 22 20 62 20 23 74 20 28 20 22 6d 6f 72  lah" b #t ( "mor
0f70: 65 20 73 74 75 66 66 22 20 22 3c 22 20 22 69 22  e stuff" "<" "i"
0f80: 20 22 3e 22 20 29 29 0a 3b 3b 20 28 22 62 6c 61   ">" )).;; ("bla
0f90: 68 20 62 6c 61 68 22 20 22 3c 22 20 22 2f 62 22  h blah" "<" "/b"
0fa0: 20 22 3e 22 20 22 6d 6f 72 65 20 73 74 75 66 66   ">" "more stuff
0fb0: 22 20 22 3c 22 20 22 69 22 20 22 3e 22 20 29 20  " "<" "i" ">" ) 
0fc0: 0a 3b 3b 20 20 20 20 20 3d 3e 20 28 22 62 6c 61  .;;     => ("bla
0fd0: 68 20 62 6c 61 68 22 20 62 20 23 66 20 28 20 22  h blah" b #f ( "
0fe0: 6d 6f 72 65 20 73 74 75 66 66 22 20 22 3c 22 20  more stuff" "<" 
0ff0: 22 69 22 20 22 3e 22 20 29 29 0a 28 64 65 66 69  "i" ">" )).(defi
1000: 6e 65 20 28 73 3a 75 70 74 6f 2d 74 61 67 20 69  ne (s:upto-tag i
1010: 6e 6c 73 74 20 61 6c 6c 6f 77 65 64 2d 74 61 67  nlst allowed-tag
1020: 73 29 0a 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20  s).  (if (null? 
1030: 69 6e 6c 73 74 29 20 69 6e 6c 73 74 0a 20 20 20  inlst) inlst.   
1040: 20 20 20 28 6c 65 74 20 6c 6f 6f 70 20 28 28 74     (let loop ((t
1050: 6f 6b 20 20 28 63 61 72 20 69 6e 6c 73 74 29 29  ok  (car inlst))
1060: 0a 09 09 20 28 74 61 69 6c 20 28 63 64 72 20 69  ... (tail (cdr i
1070: 6e 6c 73 74 29 29 0a 09 09 20 28 70 72 65 6c 20  nlst))... (prel 
1080: 22 22 29 29 20 3b 3b 20 63 72 65 61 74 65 20 61  "")) ;; create a
1090: 20 73 74 72 69 6e 67 20 6f 72 20 61 20 6c 69 73   string or a lis
10a0: 74 20 6f 66 20 73 74 72 69 6e 67 20 70 61 72 74  t of string part
10b0: 73 3f 0a 09 28 69 66 20 28 73 74 72 69 6e 67 3d  s?..(if (string=
10c0: 3f 20 74 6f 6b 20 22 3c 22 29 20 3b 3b 20 6d 69  ? tok "<") ;; mi
10d0: 67 68 74 20 68 61 76 65 20 61 20 74 61 67 0a 09  ght have a tag..
10e0: 20 20 20 20 28 69 66 20 28 3e 20 28 6c 65 6e 67      (if (> (leng
10f0: 74 68 20 74 61 69 6c 29 20 31 29 20 3b 3b 20 74  th tail) 1) ;; t
1100: 6f 20 62 65 20 61 20 74 61 67 2c 20 6e 65 65 64  o be a tag, need
1110: 20 74 61 67 20 61 6e 64 20 63 6c 6f 73 69 6e 67   tag and closing
1120: 20 22 3e 22 0a 09 09 28 6c 65 74 20 28 28 74 61   ">"...(let ((ta
1130: 67 20 28 63 61 72 20 74 61 69 6c 29 29 0a 09 09  g (car tail))...
1140: 20 20 20 20 20 20 28 65 6e 64 20 28 63 61 64 72        (end (cadr
1150: 20 74 61 69 6c 29 29 0a 09 09 20 20 20 20 20 20   tail))...      
1160: 28 72 65 6d 20 28 63 64 64 72 20 74 61 69 6c 29  (rem (cddr tail)
1170: 29 29 20 0a 09 09 20 20 28 69 66 20 28 73 74 72  )) ...  (if (str
1180: 69 6e 67 3d 3f 20 65 6e 64 20 22 3e 22 29 20 3b  ing=? end ">") ;
1190: 3b 20 79 65 70 2c 20 69 74 20 69 73 20 70 72 6f  ; yep, it is pro
11a0: 62 61 62 6c 79 20 61 20 74 61 67 0a 09 09 20 20  bably a tag...  
11b0: 20 20 20 20 28 6c 65 74 2a 20 28 28 74 72 69 6d      (let* ((trim
11c0: 2d 74 61 67 20 28 69 66 20 20 28 73 74 72 69 6e  -tag (if  (strin
11d0: 67 3d 3f 20 22 2f 22 20 28 73 75 62 73 74 72 69  g=? "/" (substri
11e0: 6e 67 20 74 61 67 20 30 20 31 29 29 0a 09 09 09  ng tag 0 1))....
11f0: 09 09 20 20 20 20 28 73 75 62 73 74 72 69 6e 67  ..    (substring
1200: 20 74 61 67 20 31 20 28 73 74 72 69 6e 67 2d 6c   tag 1 (string-l
1210: 65 6e 67 74 68 20 74 61 67 29 29 20 23 66 29 29  ength tag)) #f))
1220: 0a 09 09 09 20 20 20 20 20 28 74 61 67 2d 73 79  ....     (tag-sy
1230: 6d 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62  m  (string->symb
1240: 6f 6c 20 28 69 66 20 74 72 69 6d 2d 74 61 67 20  ol (if trim-tag 
1250: 74 72 69 6d 2d 74 61 67 20 74 61 67 29 29 29 29  trim-tag tag))))
1260: 0a 09 09 09 28 69 66 20 28 6d 65 6d 62 65 72 20  ....(if (member 
1270: 74 61 67 2d 73 79 6d 20 61 6c 6c 6f 77 65 64 2d  tag-sym allowed-
1280: 74 61 67 73 29 0a 09 09 09 20 20 20 20 3b 3b 20  tags)....    ;; 
1290: 68 61 76 65 20 61 20 76 61 6c 69 64 20 74 61 67  have a valid tag
12a0: 2c 20 72 65 62 75 69 6c 64 20 69 74 20 61 6e 64  , rebuild it and
12b0: 20 72 65 74 75 72 6e 20 74 68 65 20 72 65 73 75   return the resu
12c0: 6c 74 0a 09 09 09 20 20 20 20 28 6c 69 73 74 20  lt....    (list 
12d0: 70 72 65 6c 20 74 61 67 2d 73 79 6d 20 28 69 66  prel tag-sym (if
12e0: 20 74 72 69 6d 2d 74 61 67 20 23 66 20 23 74 29   trim-tag #f #t)
12f0: 20 72 65 6d 29 0a 09 09 09 20 20 20 20 3b 3b 20   rem)....    ;; 
1300: 6e 6f 74 20 61 20 76 61 6c 69 64 20 74 61 67 2c  not a valid tag,
1310: 20 63 6f 6e 76 65 72 74 20 22 3c 22 20 61 6e 64   convert "<" and
1320: 20 22 3e 22 20 61 6e 64 20 61 64 64 20 61 6c 6c   ">" and add all
1330: 20 74 6f 20 70 72 65 6c 0a 09 09 09 20 20 20 20   to prel....    
1340: 28 6c 65 74 20 28 28 6e 65 77 70 72 65 6c 20 28  (let ((newprel (
1350: 73 74 72 69 6e 67 2d 61 70 70 65 6e 64 20 70 72  string-append pr
1360: 65 6c 20 22 26 6c 74 3b 22 20 74 61 67 20 22 26  el "&lt;" tag "&
1370: 67 74 3b 22 29 29 29 0a 09 09 09 20 20 20 20 20  gt;")))....     
1380: 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 6d 29   (if (null? rem)
1390: 28 6c 69 73 74 20 6e 65 77 70 72 65 6c 20 23 66  (list newprel #f
13a0: 20 23 66 20 27 28 29 29 20 3b 3b 20 72 65 74 75   #f '()) ;; retu
13b0: 72 6e 20 6e 65 77 70 72 65 6c 20 2d 20 61 64 64  rn newprel - add
13c0: 20 23 66 20 23 66 20 3f 3f 3f 0a 09 09 09 09 20   #f #f ???..... 
13d0: 20 28 6c 6f 6f 70 20 28 63 61 72 20 72 65 6d 29   (loop (car rem)
13e0: 28 63 64 72 20 72 65 6d 29 20 6e 65 77 70 72 65  (cdr rem) newpre
13f0: 6c 29 29 29 29 29 0a 09 09 20 20 20 20 20 20 3b  l)))))...      ;
1400: 3b 20 73 6f 2c 20 69 74 20 77 61 73 6e 27 74 20  ; so, it wasn't 
1410: 61 20 74 61 67 0a 09 09 20 20 20 20 20 20 28 6c  a tag...      (l
1420: 65 74 20 28 28 6e 65 77 70 72 65 6c 20 28 73 74  et ((newprel (st
1430: 72 69 6e 67 2d 61 70 70 65 6e 64 20 70 72 65 6c  ring-append prel
1440: 20 22 26 6c 74 3b 22 20 74 61 67 29 29 29 0a 09   "&lt;" tag)))..
1450: 09 09 28 69 66 20 28 6e 75 6c 6c 3f 20 74 61 69  ..(if (null? tai
1460: 6c 29 0a 09 09 09 20 20 20 20 28 6c 69 73 74 20  l)....    (list 
1470: 6e 65 77 70 72 65 6c 20 23 66 20 23 66 20 27 28  newprel #f #f '(
1480: 29 29 0a 09 09 09 20 20 20 20 28 6c 6f 6f 70 20  ))....    (loop 
1490: 28 63 61 72 20 72 65 6d 29 28 63 64 72 20 72 65  (car rem)(cdr re
14a0: 6d 29 20 6e 65 77 70 72 65 6c 29 29 29 29 29 0a  m) newprel))))).
14b0: 09 09 3b 3b 20 74 6f 6f 20 73 68 6f 72 74 20 74  ..;; too short t
14c0: 6f 20 62 65 20 61 20 74 61 67 0a 09 09 28 6c 69  o be a tag...(li
14d0: 73 74 20 28 61 70 70 6c 79 20 73 74 72 69 6e 67  st (apply string
14e0: 2d 61 70 70 65 6e 64 20 70 72 65 6c 20 22 26 6c  -append prel "&l
14f0: 74 3b 22 20 74 61 69 6c 29 20 23 66 20 23 66 20  t;" tail) #f #f 
1500: 27 28 29 29 29 0a 09 20 20 20 20 28 69 66 20 28  '()))..    (if (
1510: 6e 75 6c 6c 3f 20 74 61 69 6c 29 20 0a 09 09 3b  null? tail) ...;
1520: 3b 20 77 65 27 72 65 20 64 6f 6e 65 0a 09 09 28  ; we're done...(
1530: 6c 69 73 74 20 28 73 74 72 69 6e 67 2d 61 70 70  list (string-app
1540: 65 6e 64 20 70 72 65 6c 20 74 6f 6b 29 20 23 66  end prel tok) #f
1550: 20 23 66 20 27 28 29 29 0a 09 09 28 6c 6f 6f 70   #f '())...(loop
1560: 20 28 63 61 72 20 74 61 69 6c 29 28 63 64 72 20   (car tail)(cdr 
1570: 74 61 69 6c 29 28 73 74 72 69 6e 67 2d 61 70 70  tail)(string-app
1580: 65 6e 64 20 70 72 65 6c 20 74 6f 6b 29 29 29 29  end prel tok))))
1590: 29 29 29 0a 0a 0a 28 64 65 66 69 6e 65 20 28 73  )))...(define (s
15a0: 3a 64 69 76 79 2d 75 70 2d 63 67 69 2d 73 74 72  :divy-up-cgi-str
15b0: 20 69 6e 73 74 72 29 0a 20 20 28 6d 61 70 20 28   instr).  (map (
15c0: 6c 61 6d 62 64 61 20 28 78 29 20 28 73 74 72 69  lambda (x) (stri
15d0: 6e 67 2d 73 70 6c 69 74 20 78 20 22 3d 22 29 29  ng-split x "="))
15e0: 20 28 73 74 72 69 6e 67 2d 73 70 6c 69 74 20 69   (string-split i
15f0: 6e 73 74 72 20 22 26 22 29 29 29 0a 0a 28 64 65  nstr "&")))..(de
1600: 66 69 6e 65 20 28 73 3a 64 65 63 6f 64 65 2d 73  fine (s:decode-s
1610: 74 72 20 69 6e 73 74 72 29 0a 20 20 28 6c 65 74  tr instr).  (let
1620: 2a 20 28 28 61 62 63 20 28 73 74 72 69 6e 67 2d  * ((abc (string-
1630: 73 75 62 73 74 69 74 75 74 65 20 22 5c 5c 2b 22  substitute "\\+"
1640: 20 22 20 22 20 69 6e 73 74 72 20 23 74 29 29 0a   " " instr #t)).
1650: 09 20 28 74 6f 6b 73 20 28 73 3a 73 70 6c 69 74  . (toks (s:split
1660: 2d 73 74 72 69 6e 67 20 61 62 63 20 22 25 22 29  -string abc "%")
1670: 29 29 0a 20 20 20 20 28 69 66 20 28 3c 20 28 6c  )).    (if (< (l
1680: 65 6e 67 74 68 20 74 6f 6b 73 29 20 32 29 20 61  ength toks) 2) a
1690: 62 63 0a 09 28 6c 65 74 20 6c 6f 6f 70 20 28 28  bc..(let loop ((
16a0: 68 65 61 64 20 28 63 61 64 72 20 74 6f 6b 73 29  head (cadr toks)
16b0: 29 0a 09 09 20 20 20 28 74 61 69 6c 20 28 63 64  )...   (tail (cd
16c0: 64 72 20 74 6f 6b 73 29 29 0a 09 09 20 20 20 28  dr toks))...   (
16d0: 72 65 73 75 6c 74 20 28 63 61 72 20 74 6f 6b 73  result (car toks
16e0: 29 29 29 0a 09 20 20 28 69 66 20 28 73 74 72 69  )))..  (if (stri
16f0: 6e 67 3d 3f 20 68 65 61 64 20 22 22 29 0a 09 20  ng=? head "").. 
1700: 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20       (if (null? 
1710: 74 61 69 6c 29 0a 09 09 20 20 72 65 73 75 6c 74  tail)...  result
1720: 0a 09 09 20 20 28 6c 6f 6f 70 20 28 63 61 72 20  ...  (loop (car 
1730: 74 61 69 6c 29 28 63 64 72 20 74 61 69 6c 29 20  tail)(cdr tail) 
1740: 72 65 73 75 6c 74 29 29 0a 09 20 20 20 20 20 20  result))..      
1750: 28 6c 65 74 2a 20 28 28 6b 65 79 20 28 73 75 62  (let* ((key (sub
1760: 73 74 72 69 6e 67 20 68 65 61 64 20 30 20 32 29  string head 0 2)
1770: 29 0a 09 09 20 20 20 20 20 28 72 65 6d 20 28 73  )...     (rem (s
1780: 75 62 73 74 72 69 6e 67 20 68 65 61 64 20 32 20  ubstring head 2 
1790: 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 68  (string-length h
17a0: 65 61 64 29 29 29 0a 09 09 20 20 20 20 20 28 6e  ead)))...     (n
17b0: 75 6d 20 28 73 74 72 69 6e 67 2d 3e 6e 75 6d 62  um (string->numb
17c0: 65 72 20 6b 65 79 20 31 36 29 29 0a 09 09 20 20  er key 16))...  
17d0: 20 20 20 28 63 68 20 20 28 69 66 20 28 61 6e 64     (ch  (if (and
17e0: 20 28 6e 75 6d 62 65 72 3f 20 6e 75 6d 29 0a 20   (number? num). 
17f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1800: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1810: 20 20 28 65 78 61 63 74 3f 20 6e 75 6d 29 29 0a    (exact? num)).
1820: 09 09 09 20 20 20 20 20 20 28 69 6e 74 65 67 65  ...      (intege
1830: 72 2d 3e 63 68 61 72 20 6e 75 6d 29 0a 09 09 09  r->char num)....
1840: 20 20 20 20 20 20 23 66 29 29 20 3b 3b 20 74 68        #f)) ;; th
1850: 69 73 20 69 73 20 61 6e 20 65 72 72 6f 72 2e 20  is is an error. 
1860: 49 20 77 69 6c 6c 20 70 72 6f 62 61 62 6c 79 20  I will probably 
1870: 72 65 67 72 65 74 20 74 68 69 73 20 73 6f 6d 65  regret this some
1880: 20 64 61 79 0a 09 09 20 20 20 20 20 28 63 68 73   day...     (chs
1890: 74 72 20 20 28 69 66 20 63 68 20 28 6d 61 6b 65  tr  (if ch (make
18a0: 2d 73 74 72 69 6e 67 20 31 20 63 68 29 20 22 22  -string 1 ch) ""
18b0: 29 29 0a 09 09 20 20 20 20 20 28 6e 65 77 72 65  ))...     (newre
18c0: 73 20 28 69 66 20 63 68 0a 09 09 09 09 20 28 73  s (if ch..... (s
18d0: 74 72 69 6e 67 2d 61 70 70 65 6e 64 20 72 65 73  tring-append res
18e0: 75 6c 74 20 63 68 73 74 72 20 72 65 6d 29 0a 09  ult chstr rem)..
18f0: 09 09 09 20 28 73 74 72 69 6e 67 2d 61 70 70 65  ... (string-appe
1900: 6e 64 20 72 65 73 75 6c 74 20 68 65 61 64 29 29  nd result head))
1910: 29 29 0a 09 09 3b 3b 20 28 70 72 69 6e 74 20 22  ))...;; (print "
1920: 68 65 61 64 3a 20 22 20 68 65 61 64 20 22 20 6e  head: " head " n
1930: 75 6d 3a 20 22 20 6e 75 6d 20 22 20 63 68 3a 20  um: " num " ch: 
1940: 7c 22 20 63 68 20 22 7c 20 63 68 73 74 72 3a 20  |" ch "| chstr: 
1950: 22 20 63 68 73 74 72 29 0a 09 09 28 69 66 20 28  " chstr)...(if (
1960: 6e 75 6c 6c 3f 20 74 61 69 6c 29 0a 09 09 20 20  null? tail)...  
1970: 20 20 6e 65 77 72 65 73 0a 09 09 20 20 20 20 28    newres...    (
1980: 6c 6f 6f 70 20 28 63 61 72 20 74 61 69 6c 29 28  loop (car tail)(
1990: 63 64 72 20 74 61 69 6c 29 20 6e 65 77 72 65 73  cdr tail) newres
19a0: 29 29 29 29 29 29 29 29 0a 0a 28 64 65 66 69 6e  ))))))))..(defin
19b0: 65 20 28 73 3a 70 72 6f 63 65 73 73 2d 63 67 69  e (s:process-cgi
19c0: 2d 69 6e 70 75 74 20 69 6e 73 74 72 29 0a 20 20  -input instr).  
19d0: 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 79  (map (lambda (xy
19e0: 29 0a 20 20 20 20 20 20 20 20 20 28 6c 69 73 74  ).         (list
19f0: 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c   (string->symbol
1a00: 20 28 73 3a 64 65 63 6f 64 65 2d 73 74 72 20 28   (s:decode-str (
1a10: 63 61 72 20 78 79 29 29 29 0a 20 20 20 20 20 20  car xy))).      
1a20: 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71           (if (eq
1a30: 3f 20 28 6c 65 6e 67 74 68 20 78 79 29 20 31 29  ? (length xy) 1)
1a40: 20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20   .              
1a50: 20 20 20 20 20 22 22 0a 20 20 20 20 20 20 20 20       "".        
1a60: 20 20 20 20 20 20 20 20 20 20 20 28 73 3a 64 65             (s:de
1a70: 63 6f 64 65 2d 73 74 72 20 28 63 61 64 72 20 78  code-str (cadr x
1a80: 79 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20  y))))).         
1a90: 28 73 3a 64 69 76 79 2d 75 70 2d 63 67 69 2d 73  (s:divy-up-cgi-s
1aa0: 74 72 20 69 6e 73 74 72 29 29 29 0a 0a 3b 3b 20  tr instr)))..;; 
1ab0: 66 6f 72 20 74 65 73 74 69 6e 67 20 2d 2d 20 64  for testing -- d
1ac0: 65 6c 65 74 6d 65 0a 3b 3b 20 28 64 65 66 69 6e  eletme.;; (defin
1ad0: 65 20 62 6c 61 68 20 22 70 6f 73 74 5f 74 69 74  e blah "post_tit
1ae0: 6c 65 3d 25 32 42 25 32 42 25 32 42 25 32 42 25  le=%2B%2B%2B%2B%
1af0: 32 42 25 32 42 25 32 42 25 32 42 25 32 42 25 32  2B%2B%2B%2B%2B%2
1b00: 42 25 32 42 68 65 6c 6c 6f 2d 2d 2d 2d 2d 2d 2d  B%2Bhello-------
1b10: 2d 2d 2d 2d 2d 2d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b  ------++++++++++
1b20: 2b 25 32 36 25 32 36 25 32 36 25 32 36 25 32 36  +%26%26%26%26%26
1b30: 25 32 36 25 32 36 25 32 36 25 32 36 25 34 30 25  %26%26%26%26%40%
1b40: 34 30 25 34 30 25 34 30 25 34 30 25 34 30 25 34  40%40%40%40%40%4
1b50: 30 25 34 30 25 34 30 26 70 6f 73 74 5f 62 6f 64  0%40%40&post_bod
1b60: 79 3d 25 32 42 25 32 42 25 32 42 25 32 42 25 32  y=%2B%2B%2B%2B%2
1b70: 42 25 32 42 25 32 42 25 32 42 25 32 42 25 32 42  B%2B%2B%2B%2B%2B
1b80: 25 32 42 68 65 6c 6c 6f 2d 2d 2d 2d 2d 2d 2d 2d  %2Bhello--------
1b90: 2d 2d 2d 2d 2d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b  -----+++++++++++
1ba0: 25 32 36 25 32 36 25 32 36 25 32 36 25 32 36 25  %26%26%26%26%26%
1bb0: 32 36 25 32 36 25 32 36 25 32 36 25 34 30 25 34  26%26%26%26%40%4
1bc0: 30 25 34 30 25 34 30 25 34 30 25 34 30 25 34 30  0%40%40%40%40%40
1bd0: 25 34 30 25 34 30 25 30 44 25 30 41 25 30 44 25  %40%40%0D%0A%0D%
1be0: 30 41 25 32 42 25 32 42 25 32 42 25 32 42 25 32  0A%2B%2B%2B%2B%2
1bf0: 42 25 32 42 25 32 42 25 32 42 25 32 42 25 32 42  B%2B%2B%2B%2B%2B
1c00: 25 32 42 68 65 6c 6c 6f 2d 2d 2d 2d 2d 2d 2d 2d  %2Bhello--------
1c10: 2d 2d 2d 2d 2d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b  -----+++++++++++
1c20: 25 32 36 25 32 36 25 32 36 25 32 36 25 32 36 25  %26%26%26%26%26%
1c30: 32 36 25 32 36 25 32 36 25 32 36 25 34 30 25 34  26%26%26%26%40%4
1c40: 30 25 34 30 25 34 30 25 34 30 25 34 30 25 34 30  0%40%40%40%40%40
1c50: 25 34 30 25 34 30 25 30 44 25 30 41 25 30 44 25  %40%40%0D%0A%0D%
1c60: 30 41 25 30 44 25 30 41 25 32 42 25 32 42 25 32  0A%0D%0A%2B%2B%2
1c70: 42 25 32 42 25 32 42 25 32 42 25 32 42 25 32 42  B%2B%2B%2B%2B%2B
1c80: 25 32 42 25 32 42 25 32 42 68 65 6c 6c 6f 2d 2d  %2B%2B%2Bhello--
1c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2b 2b 2b 2b  -----------+++++
1ca0: 2b 2b 2b 2b 2b 2b 25 32 36 25 32 36 25 32 36 25  ++++++%26%26%26%
1cb0: 32 36 25 32 36 25 32 36 25 32 36 25 32 36 25 32  26%26%26%26%26%2
1cc0: 36 25 34 30 25 34 30 25 34 30 25 34 30 25 34 30  6%40%40%40%40%40
1cd0: 25 34 30 25 34 30 25 34 30 25 34 30 26 6e 65 77  %40%40%40%40&new
1ce0: 5f 70 6f 73 74 3d 53 75 62 6d 69 74 22 29 0a 3b  _post=Submit").;
1cf0: 3b 20 28 64 65 66 69 6e 65 20 62 6c 61 68 32 20  ; (define blah2 
1d00: 22 70 6f 73 74 5f 74 69 74 6c 65 3d 35 25 32 35  "post_title=5%25
1d10: 26 70 6f 73 74 5f 62 6f 64 79 3d 61 6e 64 2b 31  &post_body=and+1
1d20: 30 25 32 35 26 6e 65 77 5f 70 6f 73 74 3d 53 75  0%25&new_post=Su
1d30: 62 6d 69 74 22 29 0a                             bmit").