octopress 3.0.10 → 3.0.11
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/octopress/draft.rb +14 -9
- data/lib/octopress/page.rb +6 -0
- data/lib/octopress/post.rb +16 -9
- data/lib/octopress/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e6b29a3b51423e35fba71f3d0d4fe5778585265
|
4
|
+
data.tar.gz: 7247be37b187c33ce20e4d9591c334c0a1b9b72b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d7371b758f4d894575fb3cc87acc3680843830579cc361c790ab8be85eeb545e9cbda60fb38426f8952caca5914bc36c137abab20c04dc0563b135f7f618e6
|
7
|
+
data.tar.gz: 2c391db9477a119d06718345d8ed23fedb55179dc832e8c2a9def22d7259ce79b05fda48f2ebee685c99ea5930655667f2f7edb9d36c1a11b3f68ad02d395b4e
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 3.0.11 (2015-07-15)
|
4
|
+
- Fix: filenames and extensions are preserved when publishing drafts and unpublishing posts.
|
5
|
+
|
3
6
|
### 3.0.10 (2015-07-15)
|
4
|
-
-
|
7
|
+
- Fix: `--force` flag works properly when publishing drafts and unpublishing posts.
|
5
8
|
|
6
9
|
### 3.0.9 (2015-06-18)
|
7
10
|
- Documentation improvements
|
data/lib/octopress/draft.rb
CHANGED
@@ -21,7 +21,11 @@ module Octopress
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def path
|
24
|
-
name =
|
24
|
+
name = if @options['path']
|
25
|
+
"#{path_slug(@options['path'])}.#{File.extname(@options['path']).sub(/^\./, '')}"
|
26
|
+
else
|
27
|
+
"#{title_slug}.#{extension}"
|
28
|
+
end
|
25
29
|
File.join(site.source, '_drafts', name)
|
26
30
|
end
|
27
31
|
|
@@ -35,14 +39,15 @@ module Octopress
|
|
35
39
|
@options['title'] = read_post_yaml('title')
|
36
40
|
|
37
41
|
post_options = {
|
38
|
-
'title'
|
39
|
-
'date'
|
40
|
-
'slug'
|
41
|
-
'
|
42
|
-
'content'
|
43
|
-
'dir'
|
44
|
-
'type'
|
45
|
-
'write_message' => "Published: #{relative_path(path)} →"
|
42
|
+
'title' => @options['title'],
|
43
|
+
'date' => @options['date'],
|
44
|
+
'slug' => path_slug(@options['path']),
|
45
|
+
'extension' => File.extname(@options['path']).sub(/^\./, ''),
|
46
|
+
'content' => read_post_content,
|
47
|
+
'dir' => @options['dir'],
|
48
|
+
'type' => "post from draft",
|
49
|
+
'write_message' => "Published: #{relative_path(path)} →",
|
50
|
+
'force' => @options['force']
|
46
51
|
}
|
47
52
|
|
48
53
|
# Create a new post file
|
data/lib/octopress/page.rb
CHANGED
@@ -200,6 +200,12 @@ module Octopress
|
|
200
200
|
def date_slug
|
201
201
|
@options['date'].split('T')[0]
|
202
202
|
end
|
203
|
+
|
204
|
+
# Returns a slug extracted from a path
|
205
|
+
#
|
206
|
+
def path_slug(path)
|
207
|
+
File.basename(path, '.*').scan(/((\d+-){3})?(\S+)/).flatten[2]
|
208
|
+
end
|
203
209
|
|
204
210
|
# Returns a string which is url compatible.
|
205
211
|
#
|
data/lib/octopress/post.rb
CHANGED
@@ -18,6 +18,12 @@ module Octopress
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def path
|
21
|
+
name = if @options['path']
|
22
|
+
"#{date_slug}-#{path_slug(@options['path'])}.#{File.extname(@options['path']).sub(/^\./, '')}"
|
23
|
+
else
|
24
|
+
"#{date_slug}-#{title_slug}.#{extension}"
|
25
|
+
end
|
26
|
+
File.join(site.source, '_drafts', name)
|
21
27
|
name = "#{date_slug}-#{title_slug}.#{extension}"
|
22
28
|
dir = File.join(site.source, '_posts', @options['dir'])
|
23
29
|
FileUtils.mkdir_p dir
|
@@ -33,17 +39,18 @@ module Octopress
|
|
33
39
|
@options['title'] = read_post_yaml('title')
|
34
40
|
|
35
41
|
post_options = {
|
36
|
-
'title'
|
37
|
-
'date'
|
38
|
-
'slug'
|
39
|
-
'
|
40
|
-
'content'
|
41
|
-
'dir'
|
42
|
-
'type'
|
43
|
-
'write_message' => "Unpublished: #{relative_path(path)} →"
|
42
|
+
'title' => @options['title'],
|
43
|
+
'date' => @options['date'],
|
44
|
+
'slug' => path_slug(@options['path']),
|
45
|
+
'extension' => File.extname(@options['path']).sub(/^\./, ''),
|
46
|
+
'content' => read_post_content,
|
47
|
+
'dir' => @options['dir'],
|
48
|
+
'type' => "draft from post",
|
49
|
+
'write_message' => "Unpublished: #{relative_path(path)} →",
|
50
|
+
'force' => @options['force']
|
44
51
|
}
|
45
52
|
|
46
|
-
Draft.new(site, post_options).write
|
53
|
+
Draft.new(site, post_options).write
|
47
54
|
|
48
55
|
# Remove the old post file
|
49
56
|
#
|
data/lib/octopress/version.rb
CHANGED