Sha256: f9b5e9abeb212d24061d4c5352496b67c5c7e7bbcdb86e8ca65d743bdc775cdf

Contents?: true

Size: 1.01 KB

Versions: 54

Compression:

Stored size: 1.01 KB

Contents

#include <nokogiri.h>

static VALUE cNokogiriHtmlEntityLookup;

/*
 * call-seq:
 *  get(key)
 *
 * Get the HTML::EntityDescription for +key+
 */
static VALUE
get(VALUE _, VALUE rb_entity_name)
{
  VALUE cNokogiriHtmlEntityDescription;
  const htmlEntityDesc *c_entity_desc;
  VALUE rb_constructor_args[3];

  c_entity_desc = htmlEntityLookup((const xmlChar *)StringValueCStr(rb_entity_name));
  if (NULL == c_entity_desc) {
    return Qnil;
  }

  rb_constructor_args[0] = INT2NUM((long)c_entity_desc->value);
  rb_constructor_args[1] = NOKOGIRI_STR_NEW2(c_entity_desc->name);
  rb_constructor_args[2] = NOKOGIRI_STR_NEW2(c_entity_desc->desc);

  cNokogiriHtmlEntityDescription = rb_const_get_at(mNokogiriHtml, rb_intern("EntityDescription"));
  return rb_class_new_instance(3, rb_constructor_args, cNokogiriHtmlEntityDescription);
}

void
noko_init_html_entity_lookup()
{
  cNokogiriHtmlEntityLookup = rb_define_class_under(mNokogiriHtml, "EntityLookup", rb_cObject);

  rb_define_method(cNokogiriHtmlEntityLookup, "get", get, 1);
}

Version data entries

54 entries across 52 versions & 3 rubygems

Version Path
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.6-x86_64-linux/ext/nokogiri/html_entity_lookup.c
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.6-x86_64-linux/ext/nokogiri/html_entity_lookup.c
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.7-x86_64-linux/ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7 ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-x86_64-linux ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-x86_64-darwin ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-x86-mingw32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-x86-linux ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-x64-mingw32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-java ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.7-arm64-darwin ext/nokogiri/html_entity_lookup.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.6-x86_64-linux/ext/nokogiri/html_entity_lookup.c
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.6-x86_64-linux/ext/nokogiri/html_entity_lookup.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.3-x86_64-linux/ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.6 ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.6-x86_64-linux ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.6-x86_64-darwin ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.6-x86-mingw32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.6-x86-linux ext/nokogiri/html_entity_lookup.c
nokogiri-1.11.6-x64-mingw32 ext/nokogiri/html_entity_lookup.c