mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-25 00:48:53 -05:00
updated syntax highlighting support for perl and objective c in code_block and include_code plugins
This commit is contained in:
parent
d10ba20d14
commit
20764e31ee
@ -126,9 +126,10 @@ p code {
|
|||||||
.n { color: $blue !important; }
|
.n { color: $blue !important; }
|
||||||
.na { color: $blue !important; } /* Name.Attribute */
|
.na { color: $blue !important; } /* Name.Attribute */
|
||||||
.nb { color: $green !important; } /* Name.Builtin */
|
.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 */
|
.no { color: $yellow !important; } /* Name.Constant */
|
||||||
//.ni { color: #800080 } /* Name.Entity */
|
//.ni { color: #800080 } /* Name.Entity */
|
||||||
|
.nl { color: $green !important; }
|
||||||
.ne { color: $blue !important; font-weight: bold !important; } /* Name.Exception */
|
.ne { color: $blue !important; font-weight: bold !important; } /* Name.Exception */
|
||||||
.nf { color: $blue !important; font-weight: bold !important; } /* Name.Function */
|
.nf { color: $blue !important; font-weight: bold !important; } /* Name.Function */
|
||||||
.nn { color: $yellow !important; } /* Name.Namespace */
|
.nn { color: $yellow !important; } /* Name.Namespace */
|
||||||
@ -215,3 +216,4 @@ figure[role=code] {
|
|||||||
padding-left: 3em;
|
padding-left: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,8 @@ module Jekyll
|
|||||||
source = "<div><figure role=code>"
|
source = "<div><figure role=code>"
|
||||||
source += @caption if @caption
|
source += @caption if @caption
|
||||||
if @filetype
|
if @filetype
|
||||||
|
@filetype = 'objc' if @filetype == 'm'
|
||||||
|
@filetype = 'perl' if @filetype == 'pl'
|
||||||
source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}</figure></div>"
|
source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}</figure></div>"
|
||||||
else
|
else
|
||||||
source += "<pre><code>" + code.lstrip.rstrip.gsub(/</,'<') + "</code></pre></figure></div>"
|
source += "<pre><code>" + code.lstrip.rstrip.gsub(/</,'<') + "</code></pre></figure></div>"
|
||||||
|
@ -50,11 +50,13 @@ module Jekyll
|
|||||||
|
|
||||||
Dir.chdir(code_path) do
|
Dir.chdir(code_path) do
|
||||||
code = file.read
|
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
|
title = @title ? "#{@title} (#{file.basename})" : file.basename
|
||||||
url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}"
|
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 = "<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)
|
partial = Liquid::Template.parse(source)
|
||||||
context.stack do
|
context.stack do
|
||||||
partial.render(context)
|
partial.render(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user