Update tag classes moving into a module
This commit is contained in:
parent
10d980b6e1
commit
2c45150545
|
@ -1,5 +1,5 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
module Tags
|
||||||
class HighlightBlock < Liquid::Block
|
class HighlightBlock < Liquid::Block
|
||||||
include Liquid::StandardFilters
|
include Liquid::StandardFilters
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ module Jekyll
|
||||||
def render_codehighlighter(context, code)
|
def render_codehighlighter(context, code)
|
||||||
#The div is required because RDiscount blows ass
|
#The div is required because RDiscount blows ass
|
||||||
<<-HTML
|
<<-HTML
|
||||||
<div>
|
<div>
|
||||||
<pre><code class='#{@lang}'>#{h(code).strip}</code></pre>
|
<pre><code class='#{@lang}'>#{h(code).strip}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock)
|
Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
module Tags
|
||||||
class IncludeTag < Liquid::Tag
|
class IncludeTag < Liquid::Tag
|
||||||
def initialize(tag_name, file, tokens)
|
def initialize(tag_name, file, tokens)
|
||||||
super
|
super
|
||||||
|
@ -31,7 +31,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('include', Jekyll::IncludeTag)
|
Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
module Tags
|
||||||
class PostComparer
|
class PostComparer
|
||||||
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
|
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ module Jekyll
|
||||||
return "#"
|
return "#"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('post_url', Jekyll::PostUrl)
|
Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)
|
||||||
|
|
|
@ -39,7 +39,7 @@ CONTENT
|
||||||
|
|
||||||
context "language name" do
|
context "language name" do
|
||||||
should "match only the required set of chars" do
|
should "match only the required set of chars" do
|
||||||
r = Jekyll::HighlightBlock::SYNTAX
|
r = Jekyll::Tags::HighlightBlock::SYNTAX
|
||||||
assert_match r, "ruby"
|
assert_match r, "ruby"
|
||||||
assert_match r, "c#"
|
assert_match r, "c#"
|
||||||
assert_match r, "xml+cheetah"
|
assert_match r, "xml+cheetah"
|
||||||
|
@ -55,19 +55,19 @@ CONTENT
|
||||||
|
|
||||||
context "initialized tag" do
|
context "initialized tag" do
|
||||||
should "work" do
|
should "work" do
|
||||||
tag = Jekyll::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"])
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"])
|
||||||
assert_equal({}, tag.instance_variable_get(:@options))
|
assert_equal({}, tag.instance_variable_get(:@options))
|
||||||
|
|
||||||
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos ', ["test", "{% endhighlight %}", "\n"])
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos ', ["test", "{% endhighlight %}", "\n"])
|
||||||
assert_equal({ 'linenos' => 'inline' }, tag.instance_variable_get(:@options))
|
assert_equal({ 'linenos' => 'inline' }, tag.instance_variable_get(:@options))
|
||||||
|
|
||||||
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table ', ["test", "{% endhighlight %}", "\n"])
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table ', ["test", "{% endhighlight %}", "\n"])
|
||||||
assert_equal({ 'linenos' => 'table' }, tag.instance_variable_get(:@options))
|
assert_equal({ 'linenos' => 'table' }, tag.instance_variable_get(:@options))
|
||||||
|
|
||||||
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table nowrap', ["test", "{% endhighlight %}", "\n"])
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table nowrap', ["test", "{% endhighlight %}", "\n"])
|
||||||
assert_equal({ 'linenos' => 'table', 'nowrap' => true }, tag.instance_variable_get(:@options))
|
assert_equal({ 'linenos' => 'table', 'nowrap' => true }, tag.instance_variable_get(:@options))
|
||||||
|
|
||||||
tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
|
||||||
assert_equal({ 'cssclass' => 'hl', 'linenos' => 'table' }, tag.instance_variable_get(:@options))
|
assert_equal({ 'cssclass' => 'hl', 'linenos' => 'table' }, tag.instance_variable_get(:@options))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue