diff options
Diffstat (limited to '')
-rw-r--r-- | .themes/classic/source/javascripts/twitter.js | 4 | ||||
-rw-r--r-- | Rakefile | 22 | ||||
-rw-r--r-- | plugins/category_generator.rb | 4 |
3 files changed, 19 insertions, 11 deletions
diff --git a/.themes/classic/source/javascripts/twitter.js b/.themes/classic/source/javascripts/twitter.js index 1f1b2f91..a4e85557 100644 --- a/.themes/classic/source/javascripts/twitter.js +++ b/.themes/classic/source/javascripts/twitter.js @@ -68,7 +68,7 @@ function prettyDate(time) { var diff = ((current_date_full - date.getTime()) / 1000); var day_diff = Math.floor(diff / 86400); - if (isNaN(day_diff) || day_diff < 0 || day_diff >= 31) return; + if (isNaN(day_diff) || day_diff < 0) return "<span>∞</span>"; return day_diff == 0 && ( diff < 60 && say.just_now || @@ -78,5 +78,5 @@ function prettyDate(time) { diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) || day_diff == 1 && say.yesterday || day_diff < 7 && day_diff + say.days_ago || - day_diff < 31 && Math.ceil(day_diff / 7) + say.weeks_ago; + day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago; } @@ -92,6 +92,11 @@ task :new_post, :title do |t, args| args.with_defaults(:title => 'new-post') 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' + end puts "Creating new post: #{filename}" open(filename, 'w') do |post| system "mkdir -p #{source_dir}/#{posts_dir}/"; @@ -119,6 +124,11 @@ task :new_page, :filename do |t, args| filename = "#{name}.#{extension}" 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' + end puts "Creating new page: #{file}" open(file, 'w') do |page| page.puts "---" @@ -173,15 +183,13 @@ desc "Move source to source.old, install source theme updates, replace source/_i task :update_source, :theme do |t, args| theme = args.theme || 'classic' if File.directory?("#{source_dir}.old") - puts "removed existing #{source_dir}.old directory" + puts "## Removed existing #{source_dir}.old directory" rm_r "#{source_dir}.old", :secure=>true end - mv source_dir, "#{source_dir}.old" - puts "moved #{source_dir} into #{source_dir}.old/" - mkdir_p source_dir - cp_r "#{themes_dir}/"+theme+"/source/.", source_dir - cp_r "#{source_dir}.old/.", source_dir, :preserve=>true - cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/" + cp_r "#{source_dir}/.", "#{source_dir}.old" + puts "## Copied #{source_dir} into #{source_dir}.old/" + cp_r "#{themes_dir}/"+theme+"/source/.", source_dir, :remove_destination=>true + cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/", :remove_destination=>true mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir puts "## Updated #{source_dir} ##" diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb index aa1180e1..f732fc1b 100644 --- a/plugins/category_generator.rb +++ b/plugins/category_generator.rb @@ -68,7 +68,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/, '-')), category) + self.write_category_index(File.join(dir, category.gsub(/[_\P{word}]/, '-').gsub(/-{2,}/, '-')), category) end # Throw an exception if the layout couldn't be found. @@ -105,7 +105,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/, '-')}/'>#{item}</a>" + "<a class='category' href='/#{dir}/#{item.gsub(/[_\P{word}]/, '-').gsub(/-{2,}/, '-')}/'>#{item}</a>" end case categories.length |