Sha256: b1312dbd5f149d00452b545b952fbdb10b67873ac15ec9a6037cb5071683cb3f

Contents?: true

Size: 1.02 KB

Versions: 230

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] = UINT2NUM(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(void)
{
  cNokogiriHtml4EntityLookup = rb_define_class_under(mNokogiriHtml4, "EntityLookup", rb_cObject);

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

Version data entries

230 entries across 230 versions & 8 rubygems

Version Path
nokogiri-1.16.1-arm64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.1-arm-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.1-aarch64-linux ext/nokogiri/html4_entity_lookup.c
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/nokogiri-1.16.0-x86_64-darwin/ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-x86_64-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-x86_64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-x86-mingw32 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-x86-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-x64-mingw32 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-x64-mingw-ucrt ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-java ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-arm64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-arm-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0-aarch64-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0.rc1 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0.rc1-x86_64-linux ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0.rc1-x86_64-darwin ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0.rc1-x86-mingw32 ext/nokogiri/html4_entity_lookup.c
nokogiri-1.16.0.rc1-x86-linux ext/nokogiri/html4_entity_lookup.c