jekyll_pdate_plugin 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -4,6 +4,8 @@ So you want to have `persian date` in your jekyll blog/site ? This plugin provid
4
4
 
5
5
  Special thanks to [@hzamani](https://github.com/hzamani) for [Parsi Date](https://github.com/hzamani/parsi-date) gem.
6
6
 
7
+ [![ohloh.com](https://www.ohloh.net/accounts/322550/widgets/account_detailed.gif)](https://www.ohloh.net/accounts/322550?ref=Detailed)
8
+
7
9
  ## Installation
8
10
 
9
11
  Add this line to your application's Gemfile:
@@ -20,6 +22,8 @@ Or install it yourself as:
20
22
 
21
23
  ## Usage
22
24
 
25
+ ### pdate_to_string filter
26
+
23
27
  Use `pdate_to_string` filter instead of `date_to_string` filter.
24
28
 
25
29
  Example: `/path/to/_layouts/post.html`
@@ -34,7 +38,7 @@ Example: `/path/to/_layouts/post.html`
34
38
  {{ content }}
35
39
  </div>
36
40
 
37
- ### Override default format
41
+ #### Override default format
38
42
 
39
43
  Default filter output format is `%A %d %B %Y`. To change this format add following configuration to your `_config.yml`
40
44
 
@@ -42,6 +46,23 @@ Default filter output format is `%A %d %B %Y`. To change this format add followi
42
46
  pdate_filter: "FORMAT"
43
47
 
44
48
  [Available formats](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/DateTime.html#method-i-strftime)
49
+
50
+ ### pnumber filter
51
+
52
+ Simply just use this filter wherever you want to convert english numbers to persian numbers.
53
+
54
+ Example: `/path/to/_layouts/post.html`
55
+
56
+ ---
57
+ layout: default
58
+ ---
59
+ <h2>{{ page.title | pnumber }}</h2>
60
+ <p class="meta">{{ page.date | pdate_to_string | pnumber }}</p>
61
+
62
+ <div class="post">
63
+ {{ content }}
64
+ </div>
65
+
45
66
  ## Contributing
46
67
 
47
68
  1. Fork it ( http://github.com/intuxicated/jekyll_pdate_plugin/fork )
@@ -49,6 +70,3 @@ Default filter output format is `%A %d %B %Y`. To change this format add followi
49
70
  3. Commit your changes (`git commit -am 'Add some feature'`)
50
71
  4. Push to the branch (`git push origin my-new-feature`)
51
72
  5. Create new Pull Request
52
-
53
-
54
-
@@ -1,6 +1,6 @@
1
1
  module Jekyll
2
2
  module PdatePlugin
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
6
6
 
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require "jekyll_pdate_plugin/version"
2
3
  require 'parsi-date'
3
4
 
@@ -10,6 +11,10 @@ module Jekyll
10
11
  end
11
12
  datetime.to_parsi.strftime pdate_format
12
13
  end
14
+
15
+ def pnumber(number)
16
+ number.to_s.gsub(/[0-9]/,'1'=>'۱','2'=>'۲','3'=>'۳','4'=>'۴','5'=>'۵','6'=>'۶','7'=>'۷','8'=>'۸','9'=>'۹','0'=>'۰')
17
+ end
13
18
  end
14
19
  end
15
20
  Liquid::Template.register_filter(Jekyll::PdatePlugin)
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.1
4
+ version: 0.0.2
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-05 00:00:00.000000000 Z
12
+ date: 2014-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parsi-date