Coder Social home page Coder Social logo

intuxicated / jekyll_pdate_plugin Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 0.0 280 KB

This plugin provide pdate_to_string (persian date) filter for Liquid

Home Page: http://intuxicated.github.io/jekyll_pdate_plugin

License: MIT License

Ruby 100.00%

jekyll_pdate_plugin's Introduction

JekyllPdatePlugin

So you want to have persian date in your jekyll blog/site ? This plugin provide pdate filter for Liquid.

Special thanks to @hzamani for Parsi Date gem.

ohloh.com

Installation

Add this line to your application's Gemfile:

gem 'jekyll_pdate_plugin'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll_pdate_plugin

Usage

pdate ( or pdate_to_string ) filter

Use pdate filter instead of date filter:

Example: /path/to/_layouts/post.html

---
layout: default
---
<h2>{{ page.title }}</h2>
<p class="meta">{{ page.date | pdate }}</p>

<div class="post">
    {{ content }}
</div>

Or call pdate with argument:

---
layout: default
---
<h2>{{ page.title }}</h2>
<p class="meta">{{ page.date | pdate: "%Y %A %d %B" }}</p>

<div class="post">
    {{ content }}
</div>

Override default format

Default filter output format is %A %d %B %Y. To change this format add following configuration to your _config.yml

...
pdate_filter: "FORMAT"

Available formats

NOTE: This configuration has a higher priority than calling pdate filter with an argument.

pnumber filter

Simply just use this filter wherever you want to convert english numbers to persian numbers.

Example: /path/to/_layouts/post.html

---
layout: default
---
<h2>{{ page.title | pnumber }}</h2>
<p class="meta">{{ page.date | pdate_to_string | pnumber }}</p>

<div class="post">
    {{ content }}
</div>

Contributing

  1. Fork it ( http://github.com/intuxicated/jekyll_pdate_plugin/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

jekyll_pdate_plugin's People

Contributors

intuxicated avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.