write 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,10 +17,14 @@ module Write
17
17
  end
18
18
 
19
19
  def head_links
20
- content_for :head, auto_discovery_link_tag(:atom, feed_url, :title => Write.full_title) +
20
+ content_for :head, auto_discovery_link_tag(:atom, atom_feed_url, :title => Write.full_title) +
21
21
  stylesheet_link_tag("write/application", :media => "all")
22
22
  end
23
23
 
24
+ def atom_feed_url
25
+ Write.feed_url || feed_url
26
+ end
27
+
24
28
  def post_snippet post
25
29
  truncate_html(Write::MD.render(post.content), :length => 256).html_safe
26
30
  end
@@ -34,18 +34,20 @@ module Write
34
34
  end
35
35
 
36
36
  def self.find year, code
37
- all.find { |p| p.year == year.to_i && p.code == code }
37
+ all.find { |p| p.year == year.to_i && (p.code == code || p.qcode == code) }
38
38
  end
39
39
 
40
40
  def self.last_update
41
41
  all.sort_by(&:updated_date).last.updated_date
42
42
  end
43
43
 
44
- attr_reader :code
44
+ attr_reader :code, :qcode
45
45
 
46
46
  def initialize attributes
47
47
  @attributes = attributes
48
- @code = attributes["description"].downcase.gsub(/[^a-z0-9]/, "-").squeeze
48
+ @code = attributes["description"].downcase.gsub(/[^a-z0-9]/, "-")
49
+ @qcode = @code.squeeze
50
+ @code = @code.squeeze("-").chomp("-")
49
51
  @raw_url = files["write.md"]["raw_url"]
50
52
  GG.log "Caching post #{@code}"
51
53
  @raw_data = open(@raw_url).read
@@ -1,5 +1,5 @@
1
1
  <% head_links %>
2
- <% content_for :title, Write.title + " - " + @post.description %>
2
+ <% content_for :title, @post.description + " - " + Write.title %>
3
3
 
4
4
  <%= content_tag :div, link_to(Write.tagline, root_path), class: "blog-title" %>
5
5
 
@@ -26,7 +26,11 @@ module Write
26
26
  end
27
27
 
28
28
  def self.full_title
29
- "#{title} - #{tagline}"
29
+ "#{tagline} - #{title}"
30
+ end
31
+
32
+ def self.feed_url
33
+ config[:feed_url]
30
34
  end
31
35
 
32
36
  def self.layout
@@ -1,3 +1,3 @@
1
1
  module Write
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: write
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-24 00:00:00.000000000 Z
12
+ date: 2013-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails