aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-07-25 20:34:52 -0400
committerBrandon Mathis <brandon@imathis.com>2011-07-25 20:35:24 -0400
commit20764e31eefcc077341a7dab649e37dcd361a8d0 (patch)
tree46c3cd9529d66b3b34fc7cbbeced0744b8f7d16a
parentd10ba20d140ca0a4a0eda1900d66f6c76bbfa883 (diff)
downloadmy_new_personal_website-20764e31eefcc077341a7dab649e37dcd361a8d0.tar.xz
my_new_personal_website-20764e31eefcc077341a7dab649e37dcd361a8d0.zip
updated syntax highlighting support for perl and objective c in code_block and include_code plugins
-rw-r--r--.themes/classic/sass/partials/_syntax.scss4
-rw-r--r--plugins/code_block.rb2
-rw-r--r--plugins/include_code.rb6
3 files changed, 9 insertions, 3 deletions
diff --git a/.themes/classic/sass/partials/_syntax.scss b/.themes/classic/sass/partials/_syntax.scss
index bb350ed7..4ccd63d8 100644
--- a/.themes/classic/sass/partials/_syntax.scss
+++ b/.themes/classic/sass/partials/_syntax.scss
@@ -126,9 +126,10 @@ p code {
.n { color: $blue !important; }
.na { color: $blue !important; } /* Name.Attribute */
.nb { color: $green !important; } /* Name.Builtin */
- //.nc { color: #445588; font-weight: bold } /* Name.Class */
+ .nc { color: $magenta !important;} /* Name.Class */
.no { color: $yellow !important; } /* Name.Constant */
//.ni { color: #800080 } /* Name.Entity */
+ .nl { color: $green !important; }
.ne { color: $blue !important; font-weight: bold !important; } /* Name.Exception */
.nf { color: $blue !important; font-weight: bold !important; } /* Name.Function */
.nn { color: $yellow !important; } /* Name.Namespace */
@@ -215,3 +216,4 @@ figure[role=code] {
padding-left: 3em;
}
+
diff --git a/plugins/code_block.rb b/plugins/code_block.rb
index 4264d197..4cf2817b 100644
--- a/plugins/code_block.rb
+++ b/plugins/code_block.rb
@@ -73,6 +73,8 @@ module Jekyll
source = "<div><figure role=code>"
source += @caption if @caption
if @filetype
+ @filetype = 'objc' if @filetype == 'm'
+ @filetype = 'perl' if @filetype == 'pl'
source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}</figure></div>"
else
source += "<pre><code>" + code.lstrip.rstrip.gsub(/</,'&lt;') + "</code></pre></figure></div>"
diff --git a/plugins/include_code.rb b/plugins/include_code.rb
index 6a7d786e..b0258a4c 100644
--- a/plugins/include_code.rb
+++ b/plugins/include_code.rb
@@ -50,11 +50,13 @@ module Jekyll
Dir.chdir(code_path) do
code = file.read
- file_type = file.extname
+ @filetype = file.extname
+ @filetype = 'objc' if @filetype == 'm'
+ @filetype = 'perl' if @filetype == 'pl'
title = @title ? "#{@title} (#{file.basename})" : file.basename
url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}"
source = "<div><figure role=code><figcaption><span>#{title}</span> <a href='#{url}'>download</a></figcaption>\n"
- source += "{% highlight #{file_type} %}\n" + code + "\n{% endhighlight %}</figure></div>"
+ source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}</figure></div>"
partial = Liquid::Template.parse(source)
context.stack do
partial.render(context)