georgi-shinmun 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/LICENSE +18 -0
- data/README.md +361 -0
- data/Rakefile +17 -0
- data/bin/shinmun +12 -0
- data/example/Rakefile +41 -0
- data/example/assets/images/favicon.ico +0 -0
- data/example/assets/images/loading.gif +0 -0
- data/example/assets/javascripts/coderay.js +13 -0
- data/example/assets/javascripts/comments.js +45 -0
- data/example/assets/javascripts/jquery-form.min.js +5 -0
- data/example/assets/javascripts/jquery.min.js +32 -0
- data/example/assets/stylesheets/article.css +15 -0
- data/example/assets/stylesheets/coderay.css +100 -0
- data/example/assets/stylesheets/comments.css +20 -0
- data/example/assets/stylesheets/form.css +12 -0
- data/example/assets/stylesheets/list.css +13 -0
- data/example/assets/stylesheets/print.css +76 -0
- data/example/assets/stylesheets/reset.css +23 -0
- data/example/assets/stylesheets/style.css +83 -0
- data/example/assets/stylesheets/table.css +24 -0
- data/example/assets/stylesheets/typo.css +40 -0
- data/example/assets/wmd/images/bg-fill.png +0 -0
- data/example/assets/wmd/images/bg.png +0 -0
- data/example/assets/wmd/images/blockquote.png +0 -0
- data/example/assets/wmd/images/bold.png +0 -0
- data/example/assets/wmd/images/code.png +0 -0
- data/example/assets/wmd/images/h1.png +0 -0
- data/example/assets/wmd/images/hr.png +0 -0
- data/example/assets/wmd/images/img.png +0 -0
- data/example/assets/wmd/images/italic.png +0 -0
- data/example/assets/wmd/images/link.png +0 -0
- data/example/assets/wmd/images/ol.png +0 -0
- data/example/assets/wmd/images/redo.png +0 -0
- data/example/assets/wmd/images/separator.png +0 -0
- data/example/assets/wmd/images/ul.png +0 -0
- data/example/assets/wmd/images/undo.png +0 -0
- data/example/assets/wmd/images/wmd-on.png +0 -0
- data/example/assets/wmd/images/wmd.png +0 -0
- data/example/assets/wmd/showdown.js +421 -0
- data/example/assets/wmd/wmd-base.js +1799 -0
- data/example/assets/wmd/wmd-plus.js +311 -0
- data/example/assets/wmd/wmd.js +73 -0
- data/example/config.ru +8 -0
- data/example/config/aggregations.yml +1 -0
- data/example/config/assets.yml +13 -0
- data/example/config/blog.yml +10 -0
- data/example/map.rb +100 -0
- data/example/pages/about.md +6 -0
- data/example/password +1 -0
- data/example/templates/_comment_form.rhtml +90 -0
- data/example/templates/_comments.rhtml +11 -0
- data/example/templates/_pagination.rhtml +10 -0
- data/example/templates/admin/commit.rhtml +27 -0
- data/example/templates/admin/commits.rhtml +9 -0
- data/example/templates/admin/edit.rhtml +17 -0
- data/example/templates/admin/pages.rhtml +19 -0
- data/example/templates/admin/posts.rhtml +24 -0
- data/example/templates/category.rhtml +12 -0
- data/example/templates/category.rxml +20 -0
- data/example/templates/index.rhtml +12 -0
- data/example/templates/index.rxml +21 -0
- data/example/templates/layout.rhtml +82 -0
- data/example/templates/page.rhtml +7 -0
- data/example/templates/post.rhtml +48 -0
- data/lib/shinmun.rb +21 -0
- data/lib/shinmun/aggregations/delicious.rb +57 -0
- data/lib/shinmun/aggregations/flickr.rb +81 -0
- data/lib/shinmun/blog.rb +165 -0
- data/lib/shinmun/bluecloth_coderay.rb +21 -0
- data/lib/shinmun/comment.rb +17 -0
- data/lib/shinmun/helpers.rb +64 -0
- data/lib/shinmun/post.rb +161 -0
- data/lib/shinmun/post_handler.rb +17 -0
- data/templates/_comments.rhtml +11 -0
- data/templates/archive.rhtml +6 -0
- data/templates/category.rhtml +6 -0
- data/templates/category.rxml +20 -0
- data/templates/index.rhtml +4 -0
- data/templates/index.rxml +21 -0
- data/templates/layout.rhtml +9 -0
- data/templates/page.rhtml +2 -0
- data/templates/post.rhtml +3 -0
- data/test/blog_spec.rb +177 -0
- data/test/map.rb +51 -0
- metadata +172 -0
data/example/password
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
password
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<div class="comment-form">
|
2
|
+
|
3
|
+
<div class="loading" style="display:none">
|
4
|
+
<img src="/assets/images/loading.gif" />
|
5
|
+
Posting Comment...
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<h4 class="preview-header" style="display:none">Comment Preview</h4>
|
9
|
+
|
10
|
+
<div class="preview">
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<form>
|
14
|
+
<input type="hidden" name="path" value="<%= @post.path %>"/>
|
15
|
+
<p>
|
16
|
+
<label>Name</label><br/>
|
17
|
+
<input type="text" name="name" size="40"/>
|
18
|
+
</p>
|
19
|
+
<p>
|
20
|
+
<label>Website</label><br/>
|
21
|
+
<input type="text" name="website" size="40"/>
|
22
|
+
</p>
|
23
|
+
<p>
|
24
|
+
<label>Comment (Use Markdown for formatting) <a href="#markdown-help" onclick="$('#markdown-help').show(); return false">show help</a></label><br/>
|
25
|
+
<textarea name="text" cols="60" rows="10"></textarea>
|
26
|
+
</p>
|
27
|
+
<p>
|
28
|
+
<input type="submit" value="Post comment"/>
|
29
|
+
<input type="button" value="Preview comment" class="preview-button"/>
|
30
|
+
</p>
|
31
|
+
</form>
|
32
|
+
|
33
|
+
<a name="markdown-help"></a>
|
34
|
+
|
35
|
+
<div id="markdown-help" style="display:none; margin-top:2em">
|
36
|
+
<h2>Comment Formatting</h2>
|
37
|
+
|
38
|
+
<ul>
|
39
|
+
<li>Comments may be formatted with Markdown.</li>
|
40
|
+
<li>Syntax highlighting is available (see below).</li>
|
41
|
+
<li>Errors will be shown after your comment, so please check with preview.</li>
|
42
|
+
<li>HTML code is filtered out for security reasons.</li>
|
43
|
+
</ul>
|
44
|
+
|
45
|
+
<h4>Emphasis</h4>
|
46
|
+
<pre>_italic_ __bold__ or *italic* **bold**</pre>
|
47
|
+
|
48
|
+
<h4>Links</h4>
|
49
|
+
<pre>[Link text](http://example.com)</pre>
|
50
|
+
|
51
|
+
<h4>Lists</h4>
|
52
|
+
<pre>
|
53
|
+
1. Lines with beginning cardinal numbers will turn into ordered lists.
|
54
|
+
2. This is the second item.
|
55
|
+
|
56
|
+
* Lines with beginning stars will turn into unordered lists.
|
57
|
+
* This is the second item.
|
58
|
+
</pre>
|
59
|
+
|
60
|
+
<h4>Block quotes</h4>
|
61
|
+
<pre>
|
62
|
+
> Lines with beginning brackets will turn into block quotes.
|
63
|
+
> Block quotes may be nested. </pre>
|
64
|
+
|
65
|
+
<h4>Code blocks</h4>
|
66
|
+
Code blocks are indented with 4 spaces and surrounded by blank lines:
|
67
|
+
<pre>
|
68
|
+
|
69
|
+
$ git commit -m "added markdown help"
|
70
|
+
</pre>
|
71
|
+
|
72
|
+
<h4>Syntax highlighting</h4>
|
73
|
+
|
74
|
+
Following languages are supported:
|
75
|
+
<strong>c, diff, javascript, scheme, css, html, xml, java, json, rhtml, yaml, delphi</strong>.
|
76
|
+
|
77
|
+
You have to declare the language like this:
|
78
|
+
<pre>
|
79
|
+
|
80
|
+
@@ruby
|
81
|
+
|
82
|
+
def method_missing(id, *args, &block)
|
83
|
+
puts "#{id} was called with #{args.inspect}"
|
84
|
+
end
|
85
|
+
|
86
|
+
</pre>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% for comment in @comments %>
|
2
|
+
<div class="comment">
|
3
|
+
<div class="top">
|
4
|
+
<%= comment.website.empty? ? comment.name : link_to(comment.name, comment.website) %> said
|
5
|
+
<%= distance_of_time_in_words(comment.time, Time.now, true) %> ago:
|
6
|
+
</div>
|
7
|
+
<div class="body">
|
8
|
+
<%= markdown(comment.text, :filter_html, :filter_styles) %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h2>Commit <%= @commit.id %></h2>
|
2
|
+
|
3
|
+
<em><%= @commit.author %> on <%= @commit.date %></em>
|
4
|
+
|
5
|
+
<pre><%= @commit.message %></pre>
|
6
|
+
|
7
|
+
<ul>
|
8
|
+
<% for diff in @commit.diffs %>
|
9
|
+
<li><a href="#<%= diff.a_path %>"><%= diff.a_path %></a></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
|
13
|
+
<% for diff in @commit.diffs %>
|
14
|
+
<a name="<%= diff.a_path %>"></a>
|
15
|
+
<div class="diff">
|
16
|
+
<div class="path"><%= diff.a_path %></div>
|
17
|
+
<div class="body">
|
18
|
+
<% for line in diff.diff.split("\n")[3..-1] %>
|
19
|
+
<div class="line <%= diff_line_class line %>">
|
20
|
+
<%=h line[1..-1] %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<hr/>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h1><%= @post.title %></h1>
|
2
|
+
|
3
|
+
<form method="post">
|
4
|
+
<p>
|
5
|
+
<textarea style="width:100%" name="data" rows="20"><%= @post.dump %></textarea>
|
6
|
+
</p>
|
7
|
+
<p>
|
8
|
+
<input type="submit" value="Save"/>
|
9
|
+
</p>
|
10
|
+
</form>
|
11
|
+
|
12
|
+
<% if @post.type == 'md' %>
|
13
|
+
<script type="text/javascript">
|
14
|
+
wmd_options = { output: "Markdown" };
|
15
|
+
</script>
|
16
|
+
<script type="text/javascript" src="/assets/wmd/wmd.js"></script>
|
17
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h1>Pages</h1>
|
2
|
+
|
3
|
+
<form method="post" action="/admin/create">
|
4
|
+
<input type="text" name="title" size="40"/>
|
5
|
+
<input type="submit" value="Create page"/>
|
6
|
+
</form>
|
7
|
+
|
8
|
+
<hr/>
|
9
|
+
|
10
|
+
<table style="width:100%">
|
11
|
+
<% for page in @blog.pages %>
|
12
|
+
<tr>
|
13
|
+
<td><%= link_to page.title, "/#{page.name}" %></td>
|
14
|
+
<td><%= link_to 'Edit', "/admin/edit/#{page.path}" %></td>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</table>
|
18
|
+
|
19
|
+
<hr/>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Posts</h1>
|
2
|
+
|
3
|
+
<form method="post" action="/admin/create">
|
4
|
+
<input type="hidden" name="date" value="<%= Date.today.strftime %>"/>
|
5
|
+
<input type="text" name="title" size="40"/>
|
6
|
+
<input type="submit" value="Create post"/>
|
7
|
+
</form>
|
8
|
+
|
9
|
+
<hr/>
|
10
|
+
|
11
|
+
<table style="width:100%">
|
12
|
+
<% for post in @posts[@page * @page_size, @page_size] %>
|
13
|
+
<tr>
|
14
|
+
<td><%= post_link post %></td>
|
15
|
+
<td><%= human_date post.date %></td>
|
16
|
+
<td><%= link_to 'Edit', "/admin/edit/#{post.path}" %></td>
|
17
|
+
<td><form method="post" action="/admin/delete/<%= post.path %>"><input type="submit" value="Delete"/></form></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<%= render '_pagination.rhtml', :list => @posts, :page => @page, :page_size => @page_size, :path => '/admin/posts' %>
|
23
|
+
|
24
|
+
<hr/>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<rss version="2.0">
|
3
|
+
<channel>
|
4
|
+
<title><%= @name %></title>
|
5
|
+
<link><%= @blog.url %>/categories/<%= urlify @category %>.html</link>
|
6
|
+
<language><%= @blog.language %></language>
|
7
|
+
<copyright><%= @blog.author %></copyright>
|
8
|
+
<pubDate><%= rfc822 Time.now %></pubDate>
|
9
|
+
<% for post in @posts[0, 20] %>
|
10
|
+
<item>
|
11
|
+
<title><%= post.title %></title>
|
12
|
+
<category><%= post.category %></category>
|
13
|
+
<description><%= strip_tags post.summary %></description>
|
14
|
+
<author><%= @author || @blog.author %></author>
|
15
|
+
<link><%= @blog.url %>/<%= post.path %>.html</link>
|
16
|
+
<pubDate><%= rfc822 post.date %></pubDate>
|
17
|
+
</item>
|
18
|
+
<% end %>
|
19
|
+
</channel>
|
20
|
+
</rss>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<rss version="2.0">
|
3
|
+
<channel>
|
4
|
+
<title><%= @blog.title %></title>
|
5
|
+
<link><%= @blog.url %></link>
|
6
|
+
<description><%= @blog.description %></description>
|
7
|
+
<language><%= @blog.language %></language>
|
8
|
+
<copyright><%= @blog.author %></copyright>
|
9
|
+
<pubDate><%= rfc822 Time.now %></pubDate>
|
10
|
+
<% for post in @blog.recent_posts %>
|
11
|
+
<item>
|
12
|
+
<title><%= post.title %></title>
|
13
|
+
<category><%= post.category %></category>
|
14
|
+
<description><%= strip_tags post.summary %></description>
|
15
|
+
<author><%= @author || @blog.author %></author>
|
16
|
+
<link><%= @blog.url %>/<%= post.path %>.html</link>
|
17
|
+
<pubDate><%= rfc822 post.date %></pubDate>
|
18
|
+
</item>
|
19
|
+
<% end %>
|
20
|
+
</channel>
|
21
|
+
</rss>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<title><%= @blog.title %></title>
|
5
|
+
<meta http-equiv="Content-Language" content="English" />
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
7
|
+
<link rel="shortcut icon" type="image/x-icon" href="/assets/images/favicon.ico">
|
8
|
+
<link rel="alternate" type="application/rss+xml" title="RSS" href="/index.rss" />
|
9
|
+
<link rel="stylesheet" media="screen" type="text/css" href="/assets/stylesheets.css" />
|
10
|
+
<link rel="stylesheet" media="print" type="text/css" href="/assets/stylesheets/print.css" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div class="container">
|
14
|
+
<h3><a href="/"><%= @blog.title %></a> - <%= @blog.description %></h3>
|
15
|
+
|
16
|
+
<span>
|
17
|
+
<%= link_to 'Home', '/' %> -
|
18
|
+
<%= link_to 'About', '/about' %> -
|
19
|
+
<%= link_to 'Subscribe RSS', '/index.rss' %>
|
20
|
+
</span>
|
21
|
+
|
22
|
+
<span style="margin-left:1em">
|
23
|
+
Categories:
|
24
|
+
<%= link_to 'Ruby', '/categories/ruby' %> -
|
25
|
+
<%= link_to 'Javascript', '/categories/javascript' %>
|
26
|
+
</span>
|
27
|
+
|
28
|
+
<% if session[:admin] %>
|
29
|
+
<hr/>
|
30
|
+
<div>
|
31
|
+
Admin:
|
32
|
+
<%= link_to 'Posts', '/admin/posts/' %> -
|
33
|
+
<%= link_to 'Pages', '/admin/pages' %> -
|
34
|
+
<%= link_to 'Commits', '/admin/commits' %>
|
35
|
+
<% if @post %> - <%= link_to 'Edit post', "/admin/edit/#{@post.path}" %><% end %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<hr/>
|
40
|
+
|
41
|
+
<%= @content %>
|
42
|
+
|
43
|
+
<p>
|
44
|
+
Archive:
|
45
|
+
<% for year, month in @blog.archives %>
|
46
|
+
<%= archive_link year, month %>
|
47
|
+
<% end %>
|
48
|
+
</p>
|
49
|
+
|
50
|
+
<% if @blog.aggregations['flickr'] %>
|
51
|
+
|
52
|
+
<h4>Interesting Art @ Flickr</h4>
|
53
|
+
|
54
|
+
<p>
|
55
|
+
<% for pic in @blog.aggregations['flickr'].pics %>
|
56
|
+
<a href="<%= pic.link %>">
|
57
|
+
<img alt="<%= pic.title %>" src="<%= pic.thumbnail %>" width="45" height="45" />
|
58
|
+
</a>
|
59
|
+
<% end %>
|
60
|
+
</p>
|
61
|
+
|
62
|
+
<% end %>
|
63
|
+
|
64
|
+
<% if @blog.aggregations['delicious'] %>
|
65
|
+
|
66
|
+
<h4>Ruby @ Delicious</h4>
|
67
|
+
|
68
|
+
<ul>
|
69
|
+
<% for item in @blog.aggregations['delicious'].items %>
|
70
|
+
<li>
|
71
|
+
<%= link_to item.title, item.link %>
|
72
|
+
</li>
|
73
|
+
<% end %>
|
74
|
+
</ul>
|
75
|
+
|
76
|
+
<% end %>
|
77
|
+
|
78
|
+
<script type="text/javascript" src="/assets/javascripts.js"></script>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</body>
|
82
|
+
</html>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="article">
|
2
|
+
|
3
|
+
<h1><%= @post.title %></h1>
|
4
|
+
|
5
|
+
<div class="date">
|
6
|
+
<%= human_date @post.date %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<%= @post.body_html %>
|
10
|
+
|
11
|
+
<hr/>
|
12
|
+
|
13
|
+
<div style="margin:1em 0em 1em 0em; color:#666">
|
14
|
+
<% if @post.category %>
|
15
|
+
Posted in category <%= link_to @post.category, "/categories/#{urlify @post.category}.html" %> by <%= @blog.author %>.
|
16
|
+
<% end %>
|
17
|
+
Tagged with <%= @post.tags %>.
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<h6>Similar Posts</h6>
|
21
|
+
|
22
|
+
<ul>
|
23
|
+
|
24
|
+
<% for post in @blog.posts_with_tags(@post.tags) %>
|
25
|
+
<% if post != @post %>
|
26
|
+
<li><%= post_link post %></li>
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
</ul>
|
31
|
+
|
32
|
+
<hr/>
|
33
|
+
|
34
|
+
<% if @comments %>
|
35
|
+
<h2>Comments</h2>
|
36
|
+
|
37
|
+
<div class="comments">
|
38
|
+
<%= render '_comments.rhtml', :comments => @comments %>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<h2>Leave a comment</h2>
|
43
|
+
|
44
|
+
<%= render '_comment_form.rhtml', :post => @post %>
|
45
|
+
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<hr/>
|