diff --git a/extra/webapps/pastebin/annotate-paste.furnace b/extra/webapps/pastebin/annotate-paste.furnace index 89ce12fd61..abb5cc3d07 100755 --- a/extra/webapps/pastebin/annotate-paste.furnace +++ b/extra/webapps/pastebin/annotate-paste.furnace @@ -9,22 +9,22 @@ string write %>" /> -Your name: - - - - -Summary: +Summary: -File type: +Your name: + + + + +File type: <% "modes" render-template %> -Content: +Content: diff --git a/extra/webapps/pastebin/annotation.furnace b/extra/webapps/pastebin/annotation.furnace index d4617667ed..420c1625f5 100755 --- a/extra/webapps/pastebin/annotation.furnace +++ b/extra/webapps/pastebin/annotation.furnace @@ -8,4 +8,4 @@ Created:<% "date" get write %> -<% "syntax" render-template % +<% "syntax" render-template %> diff --git a/extra/webapps/pastebin/footer.furnace b/extra/webapps/pastebin/footer.furnace new file mode 100644 index 0000000000..15b90110a0 --- /dev/null +++ b/extra/webapps/pastebin/footer.furnace @@ -0,0 +1,3 @@ + + + diff --git a/extra/webapps/pastebin/header.furnace b/extra/webapps/pastebin/header.furnace new file mode 100644 index 0000000000..2c8e79a18d --- /dev/null +++ b/extra/webapps/pastebin/header.furnace @@ -0,0 +1,23 @@ +<% USING: namespaces io furnace sequences xmode.code2html webapps.pastebin ; %> + + + + + + + + <% "title" get write %> + + <% default-stylesheet %> + + + + + + +

<% "title" get write %>

diff --git a/extra/webapps/pastebin/modes.furnace b/extra/webapps/pastebin/modes.furnace index cc09ae90ed..960b7d4e27 100644 --- a/extra/webapps/pastebin/modes.furnace +++ b/extra/webapps/pastebin/modes.furnace @@ -1,7 +1,7 @@ -<% USING: xmode.catalog sequences kernel html.elements assocs io ; %> +<% USING: xmode.catalog sequences kernel html.elements assocs io sorting ; %> diff --git a/extra/webapps/pastebin/new-paste.furnace b/extra/webapps/pastebin/new-paste.furnace index 28453f10f7..c647df82b0 100755 --- a/extra/webapps/pastebin/new-paste.furnace +++ b/extra/webapps/pastebin/new-paste.furnace @@ -1,34 +1,41 @@ -<% USING: furnace ; %> +<% USING: furnace namespaces ; %> + +<% + "new paste" "title" set + "header" render-template +%>
- - - - - - + - + + + + + + - + - +
Your name:
Summary:Summary:
File type:Your name:
File type: <% "modes" render-template %>
Channel:Channel:
Content:Content:
+ +<% "footer" render-template %> diff --git a/extra/webapps/pastebin/paste-list.furnace b/extra/webapps/pastebin/paste-list.furnace index 1edc312f54..75f05c67e9 100644 --- a/extra/webapps/pastebin/paste-list.furnace +++ b/extra/webapps/pastebin/paste-list.furnace @@ -1,29 +1,29 @@ <% USING: namespaces furnace sequences ; %> - +<% + "Pastebin" "title" set + "header" render-template +%> - - - + + + + + +
+ + + + + + + <% "pastes" get [ "paste-summary" render-component ] each %> +
Summary:Paste by:Date:
+
+

This pastebin is written in Factor. It can be used for collaborative development over IRC. You can post code for review, and annotate other people's code. Syntax highlighting for over a hundred file types is supported. +

+

+ <% "webapps.pastebin" browse-webapp-source %>

+
- Pastebin - - - - - -

[ "paste" bin ]

- - - <% "new-paste-quot" get "New paste" render-link %> - - - - - - - <% "pastes" get [ "paste-summary" render-component ] each %> -
 Summary:Paste by:Date:
- - +<% "footer" render-template %> diff --git a/extra/webapps/pastebin/paste-summary.furnace b/extra/webapps/pastebin/paste-summary.furnace index 87c01b646d..a50f0ca140 100644 --- a/extra/webapps/pastebin/paste-summary.furnace +++ b/extra/webapps/pastebin/paste-summary.furnace @@ -1,13 +1,11 @@ -<% USING: continuations namespaces io kernel math math.parser furnace ; %> +<% USING: continuations namespaces io kernel math math.parser furnace webapps.pastebin ; %> - <% "n" get number>string write %> - <% - "n" get number>string - "show-paste-quot" get curry - "summary" get - render-link - %> + + + <% "summary" get write %> + + <% "author" get write %> <% "date" get print %> diff --git a/extra/webapps/pastebin/pastebin.factor b/extra/webapps/pastebin/pastebin.factor index ad2198f282..cd81c74828 100755 --- a/extra/webapps/pastebin/pastebin.factor +++ b/extra/webapps/pastebin/pastebin.factor @@ -1,5 +1,6 @@ USING: calendar furnace furnace.validator io.files kernel -namespaces sequences store http.server.responders html ; +namespaces sequences store http.server.responders html +math.parser rss xml.writer ; IN: webapps.pastebin TUPLE: pastebin pastes ; @@ -50,6 +51,26 @@ SYMBOL: store \ paste-list { } define-action +: paste-link ( paste -- link ) + paste-n number>string [ show-paste ] curry quot-link ; + +: paste-feed ( -- entries ) + pastebin get pastebin-pastes [ + { + paste-summary + paste-link + paste-date + } get-slots "" swap + ] map ; + +: feed.xml ( -- ) + "text/xml" serving-content + "pastebin" + "http://pastebin.factorcode.org" + paste-feed feed>xml write-xml ; + +\ feed.xml { } define-action + : save-pastebin-store ( -- ) store get-global save-store ; @@ -87,4 +108,10 @@ SYMBOL: store \ annotate-paste [ "n" show-paste ] define-redirect +: style.css ( -- ) + "text/css" serving-content + "style.css" send-resource ; + +\ style.css { } define-action + "pastebin" "paste-list" "extra/webapps/pastebin" web-app diff --git a/extra/webapps/pastebin/show-paste.furnace b/extra/webapps/pastebin/show-paste.furnace index a724410b8c..56255dcd95 100755 --- a/extra/webapps/pastebin/show-paste.furnace +++ b/extra/webapps/pastebin/show-paste.furnace @@ -1,18 +1,9 @@ <% USING: namespaces io furnace sequences xmode.code2html ; %> - - - - - - - Paste: <% "summary" get write %> - - <% default-stylesheet %> - - -

[ <% "summary" get write %> ]

+<% + "Paste: " "summary" get append "title" set + "header" render-template +%> @@ -26,3 +17,5 @@ <% "annotations" get [ "annotation" render-component ] each %> <% model get "annotate-paste" render-component %> + +<% "footer" render-template %> diff --git a/extra/webapps/pastebin/style.css b/extra/webapps/pastebin/style.css new file mode 100644 index 0000000000..dda38b90d4 --- /dev/null +++ b/extra/webapps/pastebin/style.css @@ -0,0 +1,36 @@ +body { + font:75%/1.6em "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif; + color:#888; +} + +h1.pastebin-title { + font-size:300%; +} + +a { + color:#222; + border-bottom:1px dotted #ccc; + text-decoration:none; +} + +a:hover { + border-bottom:1px solid #ccc; +} + +pre.code { + border:1px dashed #ccc; + background-color:#f5f5f5; + padding:5px; + font-size:150%; +} + +.navbar { + background-color:#eeeeee; + padding:5px; + border:1px solid #ccc; +} + +.infobox { + border: 1px solid #C1DAD7; + padding: 10px; +} diff --git a/extra/webapps/pastebin/syntax.furnace b/extra/webapps/pastebin/syntax.furnace index 246b9d04b3..17b64b920b 100755 --- a/extra/webapps/pastebin/syntax.furnace +++ b/extra/webapps/pastebin/syntax.furnace @@ -1,3 +1,3 @@ <% USING: xmode.code2html splitting namespaces ; %> -
<% "contents" get string-lines "mode" get htmlize-lines %>
+
<% "contents" get string-lines "mode" get htmlize-lines %>
Paste by:<% "author" get write %>