File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed
Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ grabbing the discount submodule into the root of the project and then running
1717the rake gather task to copy discount source files into the ext/ directory:
1818
1919 $ git submodule update --init
20- Submodule 'discount' (git:// github.com/davidfstr /discount.git) registered for path 'discount'
20+ Submodule 'discount' (git@ github.com:Orc /discount.git) registered for path 'discount'
2121 Cloning into discount...
2222 $ cd discount
2323 $ ./configure.sh
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ typedef struct {
1818 * - MKD_FENCEDCODE: Always set. (For compatibility with RDiscount 2.1.8 and earlier.)
1919 * - MKD_GITHUBTAGS: Always set. (For compatibility with RDiscount 2.1.8 and earlier.)
2020 * - MKD_NOPANTS: Set unless the "smart" accessor returns true.
21+ * - MKD_NOSTYLE: Set unless the "filter_styles" accessor returns true.
2122 *
2223 * See rb_rdiscount__get_flags() for the detailed implementation.
2324 */
@@ -53,6 +54,11 @@ int rb_rdiscount__get_flags(VALUE ruby_obj)
5354 if ( rb_funcall (ruby_obj , rb_intern ("smart" ), 0 ) != Qtrue ) {
5455 flags = flags | MKD_NOPANTS ;
5556 }
57+
58+ /* The "filter_styles" accessor turns OFF the MKD_NOSTYLE flag. */
59+ if ( rb_funcall (ruby_obj , rb_intern ("filter_styles" ), 0 ) != Qtrue ) {
60+ flags = flags | MKD_NOSTYLE ;
61+ }
5662
5763 /* Handle standard flags declared in ACCESSOR_2_FLAG */
5864 for ( entry = ACCESSOR_2_FLAG ; entry -> accessor_name ; entry ++ ) {
Original file line number Diff line number Diff line change @@ -183,10 +183,25 @@ def test_that_superscripts_can_be_escaped
183183 end
184184
185185 def test_that_style_tag_is_not_filtered_by_default
186- rd = RDiscount . new ( "Hello<style>p { margin: 5px; }</style>" )
187- assert_equal "<p>Hello<style>p { margin: 5px; }</style></p>\n " , rd . to_html
186+ rd = RDiscount . new ( <<EOS )
187+ Hello
188+ <style>
189+ p { margin: 5px; }
190+ </style>
191+ EOS
192+ assert_equal "<p>Hello</p>\n \n <style>\n p { margin: 5px; }\n </style>\n \n " , rd . to_html
188193 end
189194
195+ def test_that_style_tag_is_filtered_with_flag
196+ rd = RDiscount . new ( <<EOS , :filter_styles )
197+ Hello
198+ <style>
199+ p { margin: 5px; }
200+ </style>
201+ EOS
202+ assert_equal "<p>Hello</p>\n \n \n " , rd . to_html
203+ end
204+
190205 def test_that_tables_can_have_leading_and_trailing_pipes
191206 rd = RDiscount . new ( <<EOS )
192207| A | B |
You can’t perform that action at this time.
0 commit comments