jekyll_pdate_plugin 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
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 `pdate_to_string` filter for `Liquid`.
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 `pdate_to_string` filter instead of `date_to_string` filter.
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 | pdate_to_string }}</p>
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 "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
@@ -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 = "jekyll_pdate_plugin"
7
+ spec.name = 'jekyll_pdate_plugin'
8
8
  spec.version = Jekyll::PdatePlugin::VERSION
9
- spec.authors = ["intuxicated"]
10
- spec.email = ["hidensoft@gmail.com"]
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
- gem}
14
- spec.homepage = "https://github.com/intuxicated/jekyll_pdate_plugin"
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 = ["lib"]
19
+ spec.require_paths = ['lib']
21
20
 
22
- spec.add_dependency "parsi-date"
21
+ spec.add_dependency 'parsi-date'
23
22
 
24
- spec.add_development_dependency "bundler", "~> 1.5"
25
- spec.add_development_dependency "rake"
23
+ spec.add_development_dependency 'bundler', '~> 1.5'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
26
  end
@@ -1,15 +1,18 @@
1
1
  # -*- coding: utf-8 -*-
2
- require "jekyll_pdate_plugin/version"
2
+ require 'jekyll_pdate_plugin/version'
3
3
  require 'parsi-date'
4
4
 
5
5
  module Jekyll
6
6
  module PdatePlugin
7
- def pdate_to_string(datetime)
8
- pdate_format = @context.registers[:site].config['pdate_filter']
9
- if pdate_format == nil
10
- pdate_format = "%A %d %B %Y"
11
- end
12
- datetime.to_parsi.strftime pdate_format
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)
@@ -1,6 +1,5 @@
1
1
  module Jekyll
2
2
  module PdatePlugin
3
- VERSION = "0.0.2"
3
+ VERSION = '0.0.3'
4
4
  end
5
- end
6
-
5
+ end
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.2
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: 2014-05-06 00:00:00.000000000 Z
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
- description: ! "add pdate_to_string filter to Liquid filters using parsi-date \ngem"
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
- - hidensoft@gmail.com
80
+ - mhmd.niknam@gmail.com
65
81
  executables: []
66
82
  extensions: []
67
83
  extra_rdoc_files: []