Sha256: b6cfea8b8d4f4abfb65de9366795126dc21ac348af8b5e7394f60eb6bdd6698f

Contents?: true

Size: 1.02 KB

Versions: 179

Compression:

Stored size: 1.02 KB

Contents

#include <nokogiri.h>

static VALUE cNokogiriHtml4EntityLookup;

/*
 * call-seq:
 *  get(key)
 *
 * Get the HTML4::EntityDescription for +key+
 */
static VALUE
get(VALUE _, VALUE rb_entity_name)
{
  VALUE cNokogiriHtml4EntityDescription;
  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);

  cNokogiriHtml4EntityDescription = rb_const_get_at(mNokogiriHtml4, rb_intern("EntityDescription"));
  return rb_class_new_instance(3, rb_constructor_args, cNokogiriHtml4EntityDescription);
}

void
noko_init_html_entity_lookup()
{
  cNokogiriHtml4EntityLookup = rb_define_class_under(mNokogiriHtml4, "EntityLookup", rb_cObject);

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

Version data entries

179 entries across 177 versions & 5 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/nokogiri-1.13.3-arm64-darwin/ext/nokogiri/html4_entity_lookup.c
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/nokogiri-1.13.8-arm64-darwin/ext/nokogiri/html4_entity_lookup.c
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/nokogiri-1.13.8-arm64-darwin/ext/nokogiri/html4_entity_lookup.c
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/nokogiri-1.13.3-arm64-darwin/ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-x86_64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-x86-mingw32 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-x86_64-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-arm64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-java ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-x64-mingw32 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-aarch64-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-x86-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.10-x64-mingw-ucrt ext/nokogiri/html4_entity_lookup.c
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/nokogiri-1.13.9-x86_64-linux/ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.9 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.9-x86_64-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.9-x86_64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.9-x86-mingw32 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.13.9-x86-linux ext/nokogiri/html4_entity_lookup.c