8000 Merge branch 'master' of github.com:imathis/octopress · hardBox/rubysec.github.com@cf5e909 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf5e909

Browse files
committed
Merge branch 'master' of github.com:imathis/octopress
* 'master' of github.com:imathis/octopress: Update plugins/pygments_code.rb Async load of Facebook JS Update plugins/pygments_code.rb Upgrade ruby version optimized order of styles and scripts in header Added stringex and changed to use #to_url for create directory. To don't receive error in url to accented characters.
2 parents 3548752 + 16c18e4 commit cf5e909

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.themes/classic/source/_includes/facebook_like.html

Lines changed: 1 addition & 1 deletion
Original fil 8000 e line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<script>(function(d, s, id) {
44
var js, fjs = d.getElementsByTagName(s)[0];
55
if (d.getElementById(id)) {return;}
6-
js = d.createElement(s); js.id = id;
6+
js = d.createElement(s); js.id = id; js.async = true;
77
js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";
88
fjs.parentNode.insertBefore(js, fjs);
99
}(document, 'script', 'facebook-jssdk'));</script>

.themes/classic/source/_includes/head.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
<link rel="canonical" href="{{ canonical }}">
2121
<link href="{{ root_url }}/favicon.png" rel="icon">
2222
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
23+
<link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml">
24+
{% include custom/head.html %}
2325
<script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script>
2426
<script src="{{ root_url }}/javascripts/ender.js"></script>
2527
<script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script>
26-
<link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml">
27-
{% include custom/head.html %}
2828
{% include google_analytics.html %}
2929
</head>

plugins/category_generator.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# - category_title_prefix: The string used before the category name in the page title (default is
2020
# 'Category: ').
2121

22+
require 'stringex'
23+
2224
module Jekyll
2325

2426
# The CategoryIndex class creates a single category page for the specified category.
@@ -106,7 +108,7 @@ def write_category_indexes
106108
if self.layouts.key? 'category_index'
107109
dir = self.config['category_dir'] || 'categories'
108110
self.categories.keys.each do |category|
109-
self.write_category_index(File.join(dir, category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase), category)
111+
self.write_category_index(File.join(dir, category.to_url), category)
110112
end
111113

112114
# Throw an exception if the layout couldn't be found.
@@ -171,7 +173,7 @@ def category_links(categories)
171173
#
172174
def category_link(category)
173175
dir = @context.registers[:site].config['category_dir']
174-
"<a class='category' href='/#{dir}/#{category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{category}</a>"
176+
"<a class='category' href='/#{dir}/#{category.to_url}/'>#{category}</a>"
175177
end
176178

177179
# Outputs the post.date as formatted html, with hooks for CSS styling.

plugins/pygments_code.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ def pygments(code, lang)
2121
if File.exist?(path)
2222
highlighted_code = File.read(path)
2323
else
24-
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
24+
begin
25+
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
26+
rescue MentosError
27+
raise "Pygments can't parse unknown language: #{lang}."
28+
end
2529
File.open(path, 'w') {|f| f.print(highlighted_code) }
2630
end
2731
else

0 commit comments

Comments
 (0)
0