octopress / date-format

Automatically adds variables with nicely formated dates and time tags to Jekyll posts and pages.
MIT License
16 stars 13 forks source link

Example for date_time_html is a bit misleading #3

Open rbeeger opened 10 years ago

rbeeger commented 10 years ago

The example for date_time_html suggests that whatever format I specify in date_format, this octopress plugin will parse that format and create a html with a correctly classed span for each element.

That isn't the case however. As soon as I define in _octopress.yml

date_format: "%d-%b-%Y"

the generated code looks like this

<time class='entry-date' datetime='2014-08-13T00:17:32+02:00'>
  <span class='date'>13-Aug-2014</span> 
  <span class='time'>12:17 am</span>
</time>

I actually prefer it that way, but others might be surprised by this.

imathis commented 10 years ago

Hmm I should probably include more examples. In this case, the ordinal date format is customized so that it wraps each part with a span. Since it's really just parsing this through Ruby's string-from-time parser. if you want to achieve the same, you could do something like this:

date_format: "<span class='day'>%d</span>-<span class='month'>%b</span>-<span class='year'>%Y</span>"

I'll update the example to explain this better. Thanks for the push!