File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,13 @@ class ColorizeSyntax < Nanoc3::Filter
58
58
#
59
59
# @param [String] content The content to filter
60
60
#
61
- # @option params [symbol ] :default_colorizer (DEFAULT_COLORIZER) The
61
+ # @option params [Symbol ] :default_colorizer (DEFAULT_COLORIZER) The
62
62
# default colorizer, i.e. the colorizer that will be used when the
63
63
# colorizer is not overriden for a specific language.
64
64
#
65
+ # @option params [Symbol] :syntax (:html) The syntax to use, which can be
66
+ # `:html`, `:xml` or `:xhtml`, the latter two being the same.
67
+ #
65
68
# @option params [Hash] :colorizers ({}) A hash containing
66
69
# a mapping of programming languages (symbols, not strings) onto
67
70
# colorizers (symbols).
Original file line number Diff line number Diff line change @@ -144,4 +144,24 @@ def test_colorize_syntax_with_xhtml
144
144
end
145
145
end
146
146
147
+ def test_colorize_syntax_with_default_colorizer
148
+ if `which pygmentize` . strip . empty?
149
+ skip 'no pygmentize found, which is required for this test'
150
+ return
151
+ end
152
+
153
+ if_have 'nokogiri' do
154
+ # Create filter
155
+ filter = ::Nanoc3 ::Filters ::ColorizeSyntax . new
156
+
157
+ # Get input and expected output
158
+ input = '<pre><code class="language-ruby">puts "foo"</code></pre>'
159
+ expected_output = '<pre><code class="language-ruby"><span class="nb">puts</span> <span class="s2">"foo"</span></code></pre>'
160
+
161
+ # Run filter
162
+ actual_output = filter . run ( input , :default_colorizer => :pygmentize )
163
+ assert_equal ( expected_output , actual_output )
164
+ end
165
+ end
166
+
147
167
end
You can’t perform that action at this time.
0 commit comments