3 ms·
Also, here's a quick-and-dirty diff for it: --- news.arc.old 2008-03-31 15:07:54.000000000 -0700 +++ news.arc 2008-03-31 15:08:34.000000000
by aston 19y ago
Also, here's a quick-and-dirty diff for it:
--- news.arc.old 2008-03-31 15:07:54.000000000 -0700
+++ news.arc 2008-03-31 15:08:34.000000000 -0700
@@ -382,7 +382,9 @@
.pagebreak {page-break-before:always}
pre { overflow: hidden; padding: 2px; }
-pre:hover {overflow:auto} "))
+pre:hover {overflow:auto}
+
+blockquote {border-left: 3px solid #bbbbbb; padding-left: 8px; font-style: italic;} "))
; only need pre padding because of a bug in Mac Firefox
--- app.arc.old 2008-03-31 14:07:12.000000000 -0700
+++ app.arc 2008-03-31 15:06:43.000000000 -0700
@@ -423,6 +423,13 @@
(pr cb)
(= i (+ (- newi spaces 1) (len cb))))
(pr "</code></pre>"))
+ (iflet (newi spaces) (blockquoted s i (if (is i 0) 2 0))
+ (do (pr "<blockquote><p>")
+ (let bq (block-quote s (- newi spaces 1))
+ (pr (car bq))
+ (= i (cadr bq))
+ (pr "</p></blockquote>")))
+
(iflet newi (parabreak s i (if (is i 0) 1 0))
(do (unless (is i 0) (pr "<p>"))
(= i (- newi 1)))
@@ -441,7 +448,7 @@
(tag (a href url rel 'nofollow)
(pr (if (no maxurl) url (ellipsize url maxurl))))
(= i (- n 1)))
- (writec (s i))))))))
+ (writec (s i)))))))))
(def indented-code (s i (o newlines 0) (o spaces 0))
(let c (s i)
@@ -455,6 +462,20 @@
(indented-code s (+ i 1) (+ newlines 1) 0)
(indented-code s (+ i 1) newlines (+ spaces 1)))))
+(def blockquoted (s i (o newlines 0) (o spaces 0) (o arrow 0))
+ (let c (s i)
+ (if (is c #\|)
+ (blockquoted s (+ i 1) newlines spaces 1)
+ (nonwhite c)
+ (if (and (> spaces 0) (is arrow 1))
+ (list i (+ 1 spaces))
+ nil)
+ (atend i s)
+ nil
+ (is c #\newline)
+ (blockquoted s (+ i 1) (+ newlines 1) 0 0)
+ (blockquoted s (+ i 1) newlines (+ spaces 1) arrow))))
+
(def parabreak (s i (o newlines 0))
(let c (s i)
(if (or (nonwhite c) (atend i s))
@@ -494,6 +515,25 @@
(nonwhite (s (+ i 2))))))
(writec (s (++ i))))))
+(def block-quote (s i)
+ (++ i)
+ (list
+ (tostring
+ (until (let left (- (len s) i 1)
+ (or (is left 0)
+ (and (> left 3)
+ (is (s (+ i 1)) #\newline)
+ (or (no (is (s (+ i 2)) #\|))
+ (nonwhite (s (+ i 3)))))))
+ (if (and (>= i 0)
+ (is (s (+ i 1)) #\|)
+ (or (is i 0) (is (s i) #\newline)))
+ (do (writec #\space)(++ i))
+ (if (is (s (+ i 1)) #\newline)
+ (do (pr "</p><p>") (++ i))
+ (writec (s (++ i)))))))
+ i))
+
(def unmarkdown (s)
(tostring
(forlen i s
@@ -520,6 +560,11 @@
(awhen (findsubseq "</code></pre>" s (+ i 12))
(pr (cut s (+ i 11) it))
(= i (+ it 12)))
+ (litmatch "<blockquote><p>" s i)
+ (awhen (findsubseq "</p></blockquote>" s (+ i 16))
+ (pr #\newline #\newline "|")
+ (pr (subst "\n|" "</p><p> " (cut s (+ i 15) it)))
+ (= i (+ it 16)))
(writec (s i))))))