diff options
Diffstat (limited to '')
-rw-r--r-- | .themes/classic/source/_includes/archive_post.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/article.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/head.html | 5 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/date.html | 8 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/sharing.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/default.html | 3 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/page.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/post.html | 2 | ||||
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Rakefile | 25 | ||||
-rw-r--r-- | plugins/category_generator.rb | 8 |
11 files changed, 39 insertions, 22 deletions
diff --git a/.themes/classic/source/_includes/archive_post.html b/.themes/classic/source/_includes/archive_post.html index b667b88b..fef3328e 100644 --- a/.themes/classic/source/_includes/archive_post.html +++ b/.themes/classic/source/_includes/archive_post.html @@ -1,6 +1,6 @@ {% capture category %}{{ post.categories | size }}{% endcapture %} <h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1> -<time datetime="{{ post.date | datetime }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time> +<time datetime="{{ post.date | datetime | date_to_xmlschema }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time> {% if category != '0' %} <footer> <span class="categories">posted in {{ post.categories | category_links }}</span> diff --git a/.themes/classic/source/_includes/article.html b/.themes/classic/source/_includes/article.html index b561fbc7..5cd6fda1 100644 --- a/.themes/classic/source/_includes/article.html +++ b/.themes/classic/source/_includes/article.html @@ -6,7 +6,7 @@ <h1 class="entry-title">{{ page.title | titlecase }}</h1> {% endif %} {% unless page.meta == false %} - <p class="meta">{% include post/date.html %}</p> + <p class="meta">{% include post/date.html %}{{ time }}</p> {% endunless %} </header> {% endunless %} diff --git a/.themes/classic/source/_includes/head.html b/.themes/classic/source/_includes/head.html index d6a6735b..d1741120 100644 --- a/.themes/classic/source/_includes/head.html +++ b/.themes/classic/source/_includes/head.html @@ -4,7 +4,7 @@ <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]--> <head> <meta charset="utf-8"> - <title>{{site.title}}{% if page.title %}: {{page.title}}{% endif %}</title> + <title>{% if page.title %}{{page.title}} - {% endif %}{{site.title}}</title> <meta name="author" content="{{site.author}}"> {% if page.description %} <meta name="description" content="{{page.description}}"/> @@ -26,8 +26,5 @@ <script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script> <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> <link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> - {% include google_analytics.html %} - {% include google_plus_one.html %} - {% include twitter_sharing.html %} {% include custom/head.html %} </head> diff --git a/.themes/classic/source/_includes/post/date.html b/.themes/classic/source/_includes/post/date.html index dce92472..dbfa67ae 100644 --- a/.themes/classic/source/_includes/post/date.html +++ b/.themes/classic/source/_includes/post/date.html @@ -2,9 +2,11 @@ {% capture has_date %}{{ date | size }}{% endcapture %} {% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %} {% capture was_updated %}{{ updated | size }}{% endcapture %} + {% if has_date != '0' %} -<time datetime="{{ date | datetime }}" pubdate {% if updated %} updated {% endif %}>{{ date | ordinalize }}</time> + {% capture time %}<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate {% if updated %} data-updated="true" {% endif %}>{{ date | ordinalize }}</time>{% endcapture %} {% endif %} + {% if was_updated != '0' %} -<time class="updated" datetime="{{ updated | datetime }}">{{ updated | ordinalize }}</time> -{% endif %} + {% capture updated %}<time class="updated" datetime="{{ updated | datetime | date_to_xmlschema }}">Updated {{ updated | ordinalize }}</time>{% endcapture %} +{% else %}{% assign updated = false %}{% endif %} diff --git a/.themes/classic/source/_includes/post/sharing.html b/.themes/classic/source/_includes/post/sharing.html index 7b074af5..f0f9b9db 100644 --- a/.themes/classic/source/_includes/post/sharing.html +++ b/.themes/classic/source/_includes/post/sharing.html @@ -3,6 +3,6 @@ <a href="http://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}{{ page.url }}" data-via="{{ site.twitter_user }}" data-counturl="{{ site.url }}{{ page.url }}" >Tweet</a> {% endif %} {% if site.google_plus_one %} - <g:plusone size="{{ site.google_plus_one_size }}"></g:plusone> + <div class="g-plusone" data-size="{{ site.google_plus_one_size }}"></div> {% endif %} </div> diff --git a/.themes/classic/source/_layouts/default.html b/.themes/classic/source/_layouts/default.html index 57147575..5523ac1b 100644 --- a/.themes/classic/source/_layouts/default.html +++ b/.themes/classic/source/_layouts/default.html @@ -9,5 +9,8 @@ </div> </div> <footer>{% include footer.html %}</footer> + {% include google_analytics.html %} + {% include google_plus_one.html %} + {% include twitter_sharing.html %} </body> </html> diff --git a/.themes/classic/source/_layouts/page.html b/.themes/classic/source/_layouts/page.html index 08e056ec..729b48ec 100644 --- a/.themes/classic/source/_layouts/page.html +++ b/.themes/classic/source/_layouts/page.html @@ -15,7 +15,7 @@ layout: default <footer> {% if page.date or page.author %}<p class="meta"> {% if page.author %}{% include post/author.html %}{% endif %} - {% include post/date.html %} + {% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ time }}{% endif %} {% if page.categories %}{% include post/categories.html %}{% endif %} </p>{% endif %} {% unless page.sharing == false %} diff --git a/.themes/classic/source/_layouts/post.html b/.themes/classic/source/_layouts/post.html index 78557c04..ce8a5dea 100644 --- a/.themes/classic/source/_layouts/post.html +++ b/.themes/classic/source/_layouts/post.html @@ -9,7 +9,7 @@ single: true <footer> <p class="meta"> {% include post/author.html %} - {% include post/date.html %} + {% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ time }}{% endif %} {% include post/categories.html %} </p> {% unless page.sharing == false %} @@ -10,4 +10,4 @@ gem 'haml', '>= 3.1' gem 'compass', '>= 0.11' gem 'rubypants' gem 'rb-fsevent' -gem 'stringex'
\ No newline at end of file +gem 'stringex' @@ -27,6 +27,9 @@ server_port = "4000" # port for preview server eg. localhost:4000 desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]" task :install, :theme do |t, args| + if File.directory?(source_dir) || File.directory?("sass") + abort("rake aborted!") if ask("A theme is already installed, proceeding will overwrite existing files. Are you sure?", ['y', 'n']) == 'n' + end # copy theme into working Jekyll directories theme = args.theme || 'classic' puts "## Copying "+theme+" theme into ./#{source_dir} and ./sass" @@ -93,9 +96,7 @@ task :new_post, :title do |t, args| title = args.title filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}" if File.exist?(filename) - puts "### #{filename} Already exists. Overwrite? y/n:" - response = $stdin.gets.chomp.downcase - next unless response == 'y' + abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n' end puts "Creating new post: #{filename}" open(filename, 'w') do |post| @@ -125,9 +126,7 @@ task :new_page, :filename do |t, args| mkdir_p page_dir file = page_dir + filename if File.exist?(file) - puts "### #{file} Already exists. Overwrite? y/n:" - response = $stdin.gets.chomp.downcase - next unless response == 'y' + abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n' end puts "Creating new page: #{file}" open(file, 'w') do |page| @@ -301,6 +300,20 @@ def ok_failed(condition) end end +def get_stdin(message) + print message + STDIN.gets.chomp +end + +def ask(message, valid_options) + if valid_options + answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer) + else + answer = get_stdin(message) + end + answer +end + desc "list tasks" task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}" diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb index 52f2d7ef..d9357bc8 100644 --- a/plugins/category_generator.rb +++ b/plugins/category_generator.rb @@ -1,3 +1,5 @@ +# encoding: utf-8 +# # Jekyll category page generator. # http://recursive-design.com/projects/jekyll-plugins/ # @@ -16,8 +18,8 @@ # - category_dir: The subfolder to build category pages in (default is 'categories'). # - category_title_prefix: The string used before the category name in the page title (default is # 'Category: '). -module Jekyll +module Jekyll # The CategoryIndex class creates a single category page for the specified category. class CategoryIndex < Page @@ -68,7 +70,7 @@ module Jekyll if self.layouts.key? 'category_index' dir = self.config['category_dir'] || 'categories' self.categories.keys.each do |category| - self.write_category_index(File.join(dir, category.gsub(/[_\W]/, '-').gsub(/-{2,}/, '-')), category) + self.write_category_index(File.join(dir, category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase), category) end # Throw an exception if the layout couldn't be found. @@ -105,7 +107,7 @@ module Jekyll def category_links(categories) dir = @context.registers[:site].config['category_dir'] categories = categories.sort!.map do |item| - "<a class='category' href='/#{dir}/#{item.gsub(/[_\W]/, '-').gsub(/-{2,}/, '-')}/'>#{item}</a>" + "<a class='category' href='/#{dir}/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>" end case categories.length |