octopress-date-format 2.0.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/octopress-date-format.rb +14 -2
- data/lib/octopress-date-format/version.rb +1 -1
- metadata +2 -3
- data/lib/octopress-date-format/configuration.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c8eb3200076ffb34ddff36208941349740217f2
|
4
|
+
data.tar.gz: 157b3d14982e791756faf5dc7c95a03fbc64e7fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 454cc19b7a1287eae597e658d00e008736de7c4f11f015fb8e524c7ecb39c22841c0f27895b8df705910af8ee78eddee5302bd8bbdc7d58492d2b3e4ce6cd4de
|
7
|
+
data.tar.gz: f3a1cfa6e2530188068916218de682917e12d5e9086983a43794a51857c0ebc0a1fb4ed2da05ba30c4f647f2e4f8d2b4769ba0105964aa96c6d7694c060f2358
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -68,8 +68,8 @@ Of course you can use Liquid conditionals when outputting an updated date.
|
|
68
68
|
|
69
69
|
## Configuration
|
70
70
|
|
71
|
-
You may change the formatting of the dates and times in
|
72
|
-
|
71
|
+
You may change the formatting of the dates and times in
|
72
|
+
Jekyll's configuration file. Here are the defaults:
|
73
73
|
|
74
74
|
```
|
75
75
|
date_format: 'ordinal' # July 3rd, 2014
|
@@ -1,9 +1,21 @@
|
|
1
1
|
require 'octopress-hooks'
|
2
|
-
require 'octopress-date-format/configuration'
|
3
2
|
require 'octopress-date-format/version'
|
4
3
|
|
5
4
|
module Octopress
|
6
5
|
module PageDate
|
6
|
+
DEFAULTS = {
|
7
|
+
'date_format' => 'ordinal',
|
8
|
+
'time_format' => '%-I:%M %P'
|
9
|
+
}
|
10
|
+
|
11
|
+
def self.config
|
12
|
+
@config
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.config=(config)
|
16
|
+
@config = DEFAULTS.merge(config)
|
17
|
+
end
|
18
|
+
|
7
19
|
class PageHook < Hooks::Page
|
8
20
|
def post_init(page)
|
9
21
|
PageDate.hack_date(page)
|
@@ -18,7 +30,7 @@ module Octopress
|
|
18
30
|
|
19
31
|
class SiteHook < Hooks::Site
|
20
32
|
def pre_read(site)
|
21
|
-
PageDate
|
33
|
+
PageDate.config = site.config
|
22
34
|
end
|
23
35
|
end
|
24
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-date-format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-hooks
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- LICENSE.txt
|
92
92
|
- README.md
|
93
93
|
- lib/octopress-date-format.rb
|
94
|
-
- lib/octopress-date-format/configuration.rb
|
95
94
|
- lib/octopress-date-format/version.rb
|
96
95
|
homepage: https://github.com/octopress/date-format
|
97
96
|
licenses:
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Octopress
|
2
|
-
unless defined? Octopress.config
|
3
|
-
def self.config
|
4
|
-
file = '_octopress.yml'
|
5
|
-
if File.exist?(file)
|
6
|
-
SafeYAML.load_file(file) || {}
|
7
|
-
else
|
8
|
-
{}
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
module PageDate
|
14
|
-
module Configuration
|
15
|
-
@jekyll_config = {}
|
16
|
-
|
17
|
-
DEFAULTS = {
|
18
|
-
'date_format' => 'ordinal',
|
19
|
-
'time_format' => '%-I:%M %P'
|
20
|
-
}
|
21
|
-
|
22
|
-
def self.jekyll_config=(config)
|
23
|
-
@jekyll_config = config
|
24
|
-
end
|
25
|
-
|
26
|
-
# For broader compatibility, also read config from Jekyll
|
27
|
-
def self.jekyll_date_config
|
28
|
-
@jekyll_config.select { |key,_| DEFAULTS.include? key }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.config
|
33
|
-
@config ||= begin
|
34
|
-
default = PageDate::Configuration::DEFAULTS
|
35
|
-
jekyll = PageDate::Configuration::jekyll_date_config
|
36
|
-
octopress = Octopress.config
|
37
|
-
|
38
|
-
config = Jekyll::Utils.deep_merge_hashes(default, jekyll)
|
39
|
-
Jekyll::Utils.deep_merge_hashes(config, octopress)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|