diff --git a/Gemfile b/Gemfile index 9517c46..53ff668 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'systemu' gem 'listen' gem 'guard-nanoc' gem 'adsf' +gem 'rouge' if RbConfig::CONFIG['target_os'] =~ /(?i-mx:bsd|dragonfly)/ gem 'rb-kqueue', '>= 0.2' diff --git a/Gemfile.lock b/Gemfile.lock index 5f5e6b9..d0d67cb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -95,6 +95,7 @@ GEM ffi (>= 0.5.0, < 2) rdiscount (2.2.0.1) ref (2.0.0) + rouge (3.2.1) ruby_dep (1.5.0) rubypants (0.6.0) sass (3.5.1) @@ -126,6 +127,7 @@ DEPENDENCIES nokogiri rake rdiscount + rouge rubypants sass systemu diff --git a/Rules b/Rules index 3777a39..4ea3c22 100644 --- a/Rules +++ b/Rules @@ -21,6 +21,7 @@ compile %r(/\d{4}/.*) do layout 'article' layout 'default' filter :rubypants + filter :colorize_syntax, default_colorizer: :rouge end compile %r(/about/.*) do @@ -41,6 +42,10 @@ compile %r{^/(?:screen|mobile)/$} do filter :sass end +compile %r{/rouge/$} do + filter :erb +end + compile '*' do filter :rdiscount layout 'default' @@ -64,7 +69,7 @@ end # (path.dirname + 'articles.json').to_s # end -route %r{^/(?:screen|mobile)/$} do +route %r{^/(?:screen|mobile|rouge)/$} do File.join("", "css", File.basename(item.identifier) + ".css") end diff --git a/content/rouge.css.erb b/content/rouge.css.erb new file mode 100644 index 0000000..aac8594 --- /dev/null +++ b/content/rouge.css.erb @@ -0,0 +1,6 @@ +<%= Rouge::Themes::Base16::Solarized.render(scope: 'pre') %> + +pre { + padding: 0 5px 5px; + border-radius: 3px; +}