Sha256: 522dc2da5daad744edb64a7fd3b2881fac06653050d7856a8bdd54e7ff1158b0

Contents?: true

Size: 811 Bytes

Versions: 16

Compression:

Stored size: 811 Bytes

Contents

#include <html_entity_lookup.h>

/*
 * call-seq:
 *  get(key)
 *
 * Get the HTML::EntityDescription for +key+
 */
static VALUE get(VALUE self, VALUE key)
{
  const htmlEntityDesc * desc =
    htmlEntityLookup((const xmlChar *)StringValuePtr(key));

  if(NULL == desc) return Qnil;
  VALUE klass = rb_const_get(mNokogiriHtml, rb_intern("EntityDescription"));

  VALUE args[3];
  args[0] = INT2NUM((long)desc->value);
  args[1] = NOKOGIRI_STR_NEW2(desc->name);
  args[2] = NOKOGIRI_STR_NEW2(desc->desc);

  return rb_class_new_instance(3, args, klass);
}

void init_html_entity_lookup()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE html = rb_define_module_under(nokogiri, "HTML");
  VALUE klass = rb_define_class_under(html, "EntityLookup", rb_cObject);

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

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
rubyjedi-nokogiri_java-1.4.0.20100513161003-java ext/nokogiri/html_entity_lookup.c
jwagener-nokogiri-1.4.1 ext/nokogiri/html_entity_lookup.c
revo-nokogiri-1.4.1-java ext/nokogiri/html_entity_lookup.c
revo-nokogiri-1.4.0.3-java ext/nokogiri/html_entity_lookup.c
revo-nokogiri-1.4.0-java ext/nokogiri/html_entity_lookup.c
revo-nokogiri-1.4.0.20100202165440-java ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.1-x86-mswin32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.1-x86-mingw32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.1-java ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.1 ext/nokogiri/html_entity_lookup.c
superfeedr-nokogiri-1.4.0.20091116183308 ext/nokogiri/html_entity_lookup.c
caring-nokogiri-1.4.1.pre1 ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.0-java ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.0-x86-mswin32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.0-x86-mingw32 ext/nokogiri/html_entity_lookup.c
nokogiri-1.4.0 ext/nokogiri/html_entity_lookup.c