jekyll_pdate_plugin 0.0.2 → 0.0.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/.gitignore +1 -0
- data/README.md +19 -4
- data/Rakefile +1 -1
- data/jekyll_pdate_plugin.gemspec +11 -11
- data/lib/jekyll_pdate_plugin.rb +10 -7
- data/lib/jekyll_pdate_plugin/version.rb +2 -3
- metadata +20 -4
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# JekyllPdatePlugin
|
2
2
|
|
3
|
-
So you want to have `persian date` in your jekyll blog/site ? This plugin provide `
|
3
|
+
So you want to have `persian date` in your jekyll blog/site ? This plugin provide `pdate` filter for `Liquid`.
|
4
4
|
|
5
5
|
Special thanks to [@hzamani](https://github.com/hzamani) for [Parsi Date](https://github.com/hzamani/parsi-date) gem.
|
6
6
|
|
@@ -22,9 +22,9 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
### pdate_to_string filter
|
25
|
+
### pdate ( or pdate_to_string ) filter
|
26
26
|
|
27
|
-
Use `
|
27
|
+
#### Use `pdate` filter instead of `date` filter:
|
28
28
|
|
29
29
|
Example: `/path/to/_layouts/post.html`
|
30
30
|
|
@@ -32,7 +32,19 @@ Example: `/path/to/_layouts/post.html`
|
|
32
32
|
layout: default
|
33
33
|
---
|
34
34
|
<h2>{{ page.title }}</h2>
|
35
|
-
<p class="meta">{{ page.date |
|
35
|
+
<p class="meta">{{ page.date | pdate }}</p>
|
36
|
+
|
37
|
+
<div class="post">
|
38
|
+
{{ content }}
|
39
|
+
</div>
|
40
|
+
|
41
|
+
#### Or call pdate with argument:
|
42
|
+
|
43
|
+
---
|
44
|
+
layout: default
|
45
|
+
---
|
46
|
+
<h2>{{ page.title }}</h2>
|
47
|
+
<p class="meta">{{ page.date | pdate: "%Y %A %d %B" }}</p>
|
36
48
|
|
37
49
|
<div class="post">
|
38
50
|
{{ content }}
|
@@ -47,6 +59,9 @@ Default filter output format is `%A %d %B %Y`. To change this format add followi
|
|
47
59
|
|
48
60
|
[Available formats](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/DateTime.html#method-i-strftime)
|
49
61
|
|
62
|
+
> **NOTE:**
|
63
|
+
> This configuration has a higher priority than calling pdate filter with an argument.
|
64
|
+
|
50
65
|
### pnumber filter
|
51
66
|
|
52
67
|
Simply just use this filter wherever you want to convert english numbers to persian numbers.
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
data/jekyll_pdate_plugin.gemspec
CHANGED
@@ -4,23 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'jekyll_pdate_plugin/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'jekyll_pdate_plugin'
|
8
8
|
spec.version = Jekyll::PdatePlugin::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['intuxicated']
|
10
|
+
spec.email = ['mhmd.niknam@gmail.com']
|
11
11
|
spec.summary = %q{add persian date to Liquid filters}
|
12
|
-
spec.description = %q{add pdate_to_string filter to Liquid filters using parsi-date
|
13
|
-
|
14
|
-
spec.
|
15
|
-
spec.license = "MIT"
|
12
|
+
spec.description = %q{add pdate_to_string filter to Liquid filters using parsi-date gem}
|
13
|
+
spec.homepage = 'https://github.com/intuxicated/jekyll_pdate_plugin'
|
14
|
+
spec.license = 'MIT'
|
16
15
|
|
17
16
|
spec.files = `git ls-files -z`.split("\x0")
|
18
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
21
20
|
|
22
|
-
spec.add_dependency
|
21
|
+
spec.add_dependency 'parsi-date'
|
23
22
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
26
|
end
|
data/lib/jekyll_pdate_plugin.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
2
|
+
require 'jekyll_pdate_plugin/version'
|
3
3
|
require 'parsi-date'
|
4
4
|
|
5
5
|
module Jekyll
|
6
6
|
module PdatePlugin
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
|
8
|
+
def pdate(datetime, format = '%A %d %B %Y')
|
9
|
+
pdate_to_string(datetime,format)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pdate_to_string(datetime, format = '%A %d %B %Y')
|
13
|
+
config_format = @context.registers[:site].config['pdate_filter']
|
14
|
+
format = config_format unless config_format.nil?
|
15
|
+
datetime.to_parsi.strftime format
|
13
16
|
end
|
14
17
|
|
15
18
|
def pnumber(number)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_pdate_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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: 2015-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parsi-date
|
@@ -59,9 +59,25 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: add pdate_to_string filter to Liquid filters using parsi-date gem
|
63
79
|
email:
|
64
|
-
-
|
80
|
+
- mhmd.niknam@gmail.com
|
65
81
|
executables: []
|
66
82
|
extensions: []
|
67
83
|
extra_rdoc_files: []
|