343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
|
# File 'ext/redcarpet/rc_render.c', line 343
static VALUE rb_redcarpet_html_init(int argc, VALUE *argv, VALUE self)
{
struct rb_redcarpet_rndr *rndr;
unsigned int render_flags = 0;
VALUE hash;
Data_Get_Struct(self, struct rb_redcarpet_rndr, rndr);
if (rb_scan_args(argc, argv, "01", &hash) == 1)
{
Check_Type(hash, T_HASH);
/* filter_html */
if (rb_hash_aref(hash, CSTR2SYM("filter_html")) == Qtrue)
render_flags |= HTML_SKIP_HTML;
/* no_image */
if (rb_hash_aref(hash, CSTR2SYM("no_images")) == Qtrue)
render_flags |= HTML_SKIP_IMAGES;
/* no_links */
if (rb_hash_aref(hash, CSTR2SYM("no_links")) == Qtrue)
render_flags |= HTML_SKIP_LINKS;
/* filter_style */
if (rb_hash_aref(hash, CSTR2SYM("no_styles")) == Qtrue)
render_flags |= HTML_SKIP_STYLE;
/* safelink */
if (rb_hash_aref(hash, CSTR2SYM("safe_links_only")) == Qtrue)
render_flags |= HTML_SAFELINK;
if (rb_hash_aref(hash, CSTR2SYM("with_toc_data")) == Qtrue)
render_flags |= HTML_TOC;
if (rb_hash_aref(hash, CSTR2SYM("hard_wrap")) == Qtrue)
render_flags |= HTML_HARD_WRAP;
if (rb_hash_aref(hash, CSTR2SYM("xhtml")) == Qtrue)
render_flags |= HTML_USE_XHTML;
}
sdhtml_renderer(&rndr->callbacks, (struct html_renderopt *)&rndr->options.html, render_flags);
rb_redcarpet__overload(self, rb_cRenderHTML);
return Qnil;
}
|