write 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/helpers/write/application_helper.rb +5 -1
- data/app/models/write/gg.rb +5 -3
- data/app/views/write/posts/show.html.erb +1 -1
- data/lib/write.rb +5 -1
- data/lib/write/version.rb +1 -1
- metadata +2 -2
@@ -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,
|
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
|
data/app/models/write/gg.rb
CHANGED
@@ -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]/, "-")
|
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
|
data/lib/write.rb
CHANGED
data/lib/write/version.rb
CHANGED
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.
|
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:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|