ext/greenmat/gm_render.c in greenmat-3.2.0.2 vs ext/greenmat/gm_render.c in greenmat-3.2.2.0
- old
+ new
@@ -470,32 +470,27 @@
}
static VALUE rb_greenmat_htmltoc_init(int argc, VALUE *argv, VALUE self)
{
struct rb_greenmat_rndr *rndr;
- unsigned int render_flags = HTML_TOC;
- VALUE hash, nesting_level = Qnil;
+ int nesting_level = 6;
+ VALUE hash, key = Qnil;
Data_Get_Struct(self, struct rb_greenmat_rndr, rndr);
if (rb_scan_args(argc, argv, "01", &hash) == 1) {
Check_Type(hash, T_HASH);
- /* escape_html */
- if (rb_hash_aref(hash, CSTR2SYM("escape_html")) == Qtrue)
- render_flags |= HTML_ESCAPE;
+ key = CSTR2SYM("nesting_level");
- /* Nesting level */
- nesting_level = rb_hash_aref(hash, CSTR2SYM("nesting_level"));
+ if (RTEST(rb_hash_aref(hash, key))) {
+ Check_Type(rb_hash_aref(hash, key), T_FIXNUM);
+ nesting_level = NUM2INT(rb_hash_aref(hash, key));
+ }
}
- sdhtml_toc_renderer(&rndr->callbacks, (struct html_renderopt *)&rndr->options.html, render_flags);
+ sdhtml_toc_renderer(&rndr->callbacks, (struct html_renderopt *)&rndr->options.html, nesting_level);
rb_greenmat__overload(self, rb_cRenderHTML_TOC);
-
- if (!(NIL_P(nesting_level)))
- rndr->options.html.toc_data.nesting_level = NUM2INT(nesting_level);
- else
- rndr->options.html.toc_data.nesting_level = 6;
return Qnil;
}
static VALUE rb_greenmat_smartypants_render(VALUE self, VALUE text)