Update tag classes moving into a module

This commit is contained in:
Tom Bell 2013-01-19 23:50:44 +00:00
parent 10d980b6e1
commit 2c45150545
4 changed files with 122 additions and 121 deletions

View File

@ -1,5 +1,5 @@
module Jekyll
module Tags
class HighlightBlock < Liquid::Block
include Liquid::StandardFilters
@ -58,9 +58,9 @@ module Jekyll
def render_codehighlighter(context, code)
#The div is required because RDiscount blows ass
<<-HTML
<div>
<div>
<pre><code class='#{@lang}'>#{h(code).strip}</code></pre>
</div>
</div>
HTML
end
@ -71,7 +71,7 @@ module Jekyll
end
end
end
end
Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock)
Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)

View File

@ -1,5 +1,5 @@
module Jekyll
module Tags
class IncludeTag < Liquid::Tag
def initialize(tag_name, file, tokens)
super
@ -31,7 +31,7 @@ module Jekyll
end
end
end
end
end
Liquid::Template.register_tag('include', Jekyll::IncludeTag)
Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)

View File

@ -1,5 +1,5 @@
module Jekyll
module Tags
class PostComparer
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
@ -33,6 +33,7 @@ module Jekyll
return "#"
end
end
end
end
Liquid::Template.register_tag('post_url', Jekyll::PostUrl)
Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)

View File

@ -39,7 +39,7 @@ CONTENT
context "language name" 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, "c#"
assert_match r, "xml+cheetah"
@ -55,19 +55,19 @@ CONTENT
context "initialized tag" 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))
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))
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))
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))
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))
end
end