@@ -134,7 +134,7 @@ def test_context_is_carried_over_in_call
134134 assert_equal ( "<p><strong>yeH</strong>! I <em>think</em> <a href=\" /gjtorikian\" >@gjtorikian</a> is <del>great</del>!</p>" , result )
135135
136136 context = {
137- no_bolding : false ,
137+ bolded : false ,
138138 markdown : { extension : { strikethrough : false } } ,
139139 base_url : "http://your-domain.com" ,
140140 }
@@ -146,4 +146,52 @@ def test_context_is_carried_over_in_call
146146 # - mentions are linked
147147 assert_equal ( "<p>yeH! I <em>think</em> <a href=\" http://your-domain.com/gjtorikian\" >@gjtorikian</a> is ~great~!</p>" , result_with_context )
148148 end
149+
150+ def test_text_filter_instance_context_is_carried_over_in_call
151+ text = "yeH! I _think_ <marquee>@gjtorikian is ~great~</marquee>!"
152+
153+ pipeline = HTMLPipeline . new (
154+ text_filters : [ YehBolderFilter . new ( context : { bolded : false } ) ] ,
155+ convert_filter : HTMLPipeline ::ConvertFilter ::MarkdownFilter . new ,
156+ node_filters : [ HTMLPipeline ::NodeFilter ::MentionFilter . new ] ,
157+ )
158+
159+ result = pipeline . call ( text ) [ :output ]
160+
161+ # note:
162+ # - yeH is not bolded due to previous context
163+ assert_equal ( "<p>yeH! I <em>think</em> <a href=\" /gjtorikian\" >@gjtorikian</a> is <del>great</del>!</p>" , result )
164+ end
165+
166+ def test_convert_filter_instance_context_is_carried_over_in_call
167+ text = "yeH! I _think_ <marquee>@gjtorikian is ~great~</marquee>!"
168+
169+ pipeline = HTMLPipeline . new (
170+ text_filters : [ YehBolderFilter . new ] ,
171+ convert_filter : HTMLPipeline ::ConvertFilter ::MarkdownFilter . new ( context : { extension : { strikethrough : false } } ) ,
172+ node_filters : [ HTMLPipeline ::NodeFilter ::MentionFilter . new ] ,
173+ )
174+
175+ result = pipeline . call ( text ) [ :output ]
176+
177+ # note:
178+ # - strikethroughs are not rendered due to previous context
179+ assert_equal ( "<p><strong>yeH</strong>! I <em>think</em> <a href=\" /gjtorikian\" >@gjtorikian</a> is <del>great</del>!</p>" , result )
180+ end
181+
182+ def test_node_filter_instance_context_is_carried_over_in_call
183+ text = "yeH! I _think_ <marquee>@gjtorikian is ~great~</marquee>!"
184+
185+ pipeline = HTMLPipeline . new (
186+ text_filters : [ YehBolderFilter . new ] ,
187+ convert_filter : HTMLPipeline ::ConvertFilter ::MarkdownFilter . new ,
188+ node_filters : [ HTMLPipeline ::NodeFilter ::MentionFilter . new ( context : { base_url : "http://your-domain.com" } ) ] ,
189+ )
190+
191+ result = pipeline . call ( text ) [ :output ]
192+
193+ # note:
194+ # - mentions are linked
195+ assert_equal ( "<p><strong>yeH</strong>! I <em>think</em> <a href=\" http://your-domain.com/gjtorikian\" >@gjtorikian</a> is <del>great</del>!</p>" , result )
196+ end
149197end
0 commit comments