Commits

Anonymous committed 74069ef

Add crazy-trim to make Markdown Test happy

Comments (0)

Files changed (1)

   (preceded-by (maybe indent) line))
 
 
+;; This is only to make Markdown Test happy
+(define (crazy-trim line)
+  (irregex-replace '(seq (submatch (* #\space)) #\newline)
+                   line
+                   (lambda (m)
+                     (let ((s (irregex-match-substring m 1)))
+                       (if (= 1 (string-length s))
+                           " \n"
+                           "\n")))))
 
 ;; VerbatimChunk = a:StartList
 ;;                 ( BlankLine { a = cons(mk_str("\n"), a); } )*
                                (preceded-by (result #\newline))
                                (zero-or-more)))
               (text (one-or-more non-blank-indented-line)))
-    (result (append blank-lines text))))
+    (result (append blank-lines (map crazy-trim text)))))
 
 
 ;; Verbatim =     a:StartList ( VerbatimChunk { a = cons($$, a); } )+