octopress-printable 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/octopress-printable/plugin.rb +4 -3
- data/lib/octopress-printable/post_link.rb +14 -1
- data/lib/octopress-printable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20f5c0e3fd5d01d59859f822a963b5d8f68dd26f
|
4
|
+
data.tar.gz: 3bbb7c559fbd021aa1a088a55539cd96c77500b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fef828f2b5fd5395645662ce474a6c02365dea94419f9e60eb38b5b86535b3c3fcaae47d824f3acc2f6afa02875613492900c979deaf0899697ac162910193f5
|
7
|
+
data.tar.gz: 624b0d3666b70aced2ba0e1ae7a943daee639dc32a4103cd0aae1e6ec06fdc4120e30292e1a6f039f62ce715a1c3054f07817091950d4e99e32e053aab362f7a
|
data/CHANGELOG.md
CHANGED
@@ -33,9 +33,10 @@ module Octopress
|
|
33
33
|
|
34
34
|
site.posts.each do |p|
|
35
35
|
post = p.path
|
36
|
-
pdf =
|
37
|
-
pdf = pdf.sub(
|
38
|
-
pdf = pdf.
|
36
|
+
pdf = p.url.sub(/^\//, "")
|
37
|
+
pdf = pdf.sub(/\/$/, "")
|
38
|
+
pdf = pdf.gsub(/\//, "-")
|
39
|
+
pdf = "#{printables_dir}/#{pdf}.pdf"
|
39
40
|
|
40
41
|
if !File.exists?(pdf) || File.stat(post).mtime > File.stat(pdf).mtime
|
41
42
|
puts "Converting #{post} to #{pdf}"
|
@@ -16,12 +16,25 @@ module Octopress
|
|
16
16
|
while /{% post_link (?<markup>[^\s]+)(?<text>\s+.+)? %}/ =~ str
|
17
17
|
@match = true
|
18
18
|
|
19
|
-
|
19
|
+
found_year = false
|
20
|
+
if /^(?<year>\d+)-(?<month>\d+)-(?<day>\d+)-(?<title>.*)/ =~ markup
|
21
|
+
found_year = true
|
22
|
+
end
|
20
23
|
|
21
24
|
if ! text
|
22
25
|
File.open("#{@source_dir}/#{@posts_dir}/#{markup}.markdown", 'r') do |f|
|
26
|
+
found_text = false
|
23
27
|
while l = f.gets
|
24
28
|
if /title: (?:"|')(?<text>.*)(?:"|')/ =~ l
|
29
|
+
found_text = true
|
30
|
+
end
|
31
|
+
if ! found_year
|
32
|
+
if /date: (?<year>\d+)-(?<month>\d+)-(?<day>\d+)/ =~ l
|
33
|
+
found_year = true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
if found_text && found_year
|
25
38
|
break
|
26
39
|
end
|
27
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-printable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wang Jian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|