add line numbers; add credits; closes #14

This commit is contained in:
Stephen Chang 2013-10-05 00:05:23 -04:00
parent 7beeafa2ac
commit 7cea25c79f

View File

@ -28,21 +28,24 @@
(define sample-pastes (define sample-pastes
'("4557" ; Sierpinski '("4557" ; Sierpinski
"9545" ; div1 ; "9545" ; div1
"3516" ; circles (test require) ; "3516" ; circles (test require)
"3289" ; Greek letters "3289" ; Greek letters
"2531" ; lazy fib "2531" ; lazy fib
"7747" ; set bang (test multi-expr, no #lang) "7747" ; set bang (test multi-expr, no #lang)
"2417" ; scribble syntax "2417" ; scribble syntax
"9425" ; big bang (test 2 requires on 1 line) "9425" ; big bang (test 2 requires on 1 line)
"8474" ; typed/racket ; "8474" ; typed/racket
"8937" ; datalog ; "8937" ; datalog
"2979" ; test limits, and forms in racket but not racket/base "2979" ; test limits, and forms in racket but not racket/base
"7169" ; racket/gui ; "7169" ; racket/gui
"5352" ; test 2 specs in 1 require ; "5352" ; web scrape, test 2 specs in 1 require
"9476" ; another typed/racket "7577" ; typed/racket
"1679" ; type error
"6813" ; ffi "6813" ; ffi
"5752" ; bs ipsum (as text) "2328" ; checkerboard
"2332" ; plot
; "5752" ; bs ipsum (as text)
)) ))
(define NUM-RECENT-PASTES 32) (define NUM-RECENT-PASTES 32)
@ -127,7 +130,7 @@
"(lambda () (namespace-anchor->namespace anchor)) " "(lambda () (namespace-anchor->namespace anchor)) "
"'(racket/pretty file/convertible))]\n" "'(racket/pretty file/convertible))]\n"
" [sandbox-path-permissions '([exists \"/\"])]\n" " [sandbox-path-permissions '([exists \"/\"])]\n"
" [sandbox-eval-limits '(8 64)])\n" " [sandbox-eval-limits '(10 64)])\n"
" (let ([e (make-evaluator '" lang ")])\n" " (let ([e (make-evaluator '" lang ")])\n"
" (call-in-sandbox-context e\n" " (call-in-sandbox-context e\n"
" (lambda ()\n" " (lambda ()\n"
@ -198,7 +201,8 @@
(div (div
(center (center
(img ((src ,racket-logo-url))) (img ((src ,racket-logo-url)))
(h1 ,(mk-link pastebin-url "PasteRack") ": An evaluating " (h1 ((style "font-family:sans-serif"))
,(mk-link pastebin-url "PasteRack") ": An evaluating "
,(mk-link racket-lang-url "Racket") " pastebin.") ,(mk-link racket-lang-url "Racket") " pastebin.")
(form ((action ,(embed/url process-paste)) (method "post")) (form ((action ,(embed/url process-paste)) (method "post"))
(table (tr (table (tr
@ -210,8 +214,17 @@
(td ((style "width:8em")) (td ((style "width:8em"))
(input ((type "submit") (value "Submit Paste")))) (input ((type "submit") (value "Submit Paste"))))
(td (input ((type "checkbox") (name "astext") (value "off"))) (td (input ((type "checkbox") (name "astext") (value "off")))
" Submit as text only")))))) " Submit as text only"))))
(div ((style "width:10em;position:relative;float:right"))))))) (br)(br)(br)
(div ((style "font-size:small;color:#808080"))
"Powered by " ,(mk-link racket-lang-url "Racket") ". "
"View "
,(mk-link "https://github.com/stchang/pasterack" "source") "."
" Report issues or suggestions "
,(mk-link "https://github.com/stchang/pasterack/issues" "here") ".")
))
(div ((style "width:10em;position:relative;float:right")))
))))
(send/suspend/dispatch response-generator)) (send/suspend/dispatch response-generator))
(define (process-paste request) (define (process-paste request)
@ -282,20 +295,34 @@
(script ,(++ "top.document.title=\"Paste" pastenum ":" (script ,(++ "top.document.title=\"Paste" pastenum ":"
(bytes->string/utf-8 paste-name) "\""))) (bytes->string/utf-8 paste-name) "\"")))
(body () (body ()
(div ((style "margin-left:10px;position:relative;float:left")) (div ((style "position:absolute;left:20px;top:24px"))
; (div ((style "margin-left:10px;position:relative;float:left"))
(table ((cellspacing "0") (cellpadding "0")) (table ((cellspacing "0") (cellpadding "0"))
(tr (td ,(mk-link pastebin-url "PasteRack.org"))) (tr (td ,(mk-link pastebin-url "PasteRack.org")))
(tr (td ((height "10px")))) (tr (td ((height "10px"))))
(tr (td "Paste # " (a ((href ,paste-url)) ,pastenum))) (tr (td "Paste # " (a ((href ,paste-url)) ,pastenum)))
(tr (td ((colspan "3")) (small ,(bytes->string/utf-8 time-str)))))) (tr (td ((colspan "3")) (small ,(bytes->string/utf-8 time-str))))))
(div ((style "margin-top:-15px") (class "maincolumn")) (div ((style "position:absolute;left:12em"))
(h4 ((style "font-family:sans-serif")) ; (div ((style "margin-top:-15px") (class "maincolumn"))
,(bytes->string/utf-8 paste-name)) ,(let ([name (bytes->string/utf-8 paste-name)])
(br) (if (string=? name "") '(br)
`(h4 ((style "font-family:sans-serif")) ,name)))
,(match code-main-div ,(match code-main-div
[`(div ((class "main")) ,ver ,body) [`(div ((class "main")) ,ver
(blockquote ((class "SCodeFlow"))
(table ,table-params . ,rows)))
(define new-rows
(map
(lambda (r)
(match r
[`(tr () . ,rst)
`(li (span ((style "font-size:large")) . ,rst))]
[_ r]))
rows))
`(div ((class "main")) `(div ((class "main"))
,body (blockquote ((class "SCodeFlow"))
(ol ((start "0")(style "font-size:small;color:#A0A0A0"))
. ,new-rows))
(p "=>") (p "=>")
,(match eval-main-div ,(match eval-main-div
[`(div ((class "main")) ,ver [`(div ((class "main")) ,ver