nokolexbor 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (486) hide show
  1. checksums.yaml +7 -0
  2. data/ext/nokolexbor/config.h +186 -0
  3. data/ext/nokolexbor/extconf.rb +131 -0
  4. data/ext/nokolexbor/libxml/HTMLparser.h +320 -0
  5. data/ext/nokolexbor/libxml/SAX2.h +173 -0
  6. data/ext/nokolexbor/libxml/chvalid.h +230 -0
  7. data/ext/nokolexbor/libxml/debugXML.h +217 -0
  8. data/ext/nokolexbor/libxml/dict.h +81 -0
  9. data/ext/nokolexbor/libxml/encoding.h +232 -0
  10. data/ext/nokolexbor/libxml/entities.h +153 -0
  11. data/ext/nokolexbor/libxml/globals.h +529 -0
  12. data/ext/nokolexbor/libxml/hash.h +236 -0
  13. data/ext/nokolexbor/libxml/list.h +137 -0
  14. data/ext/nokolexbor/libxml/parser.h +1264 -0
  15. data/ext/nokolexbor/libxml/parserInternals.h +641 -0
  16. data/ext/nokolexbor/libxml/pattern.h +100 -0
  17. data/ext/nokolexbor/libxml/threads.h +94 -0
  18. data/ext/nokolexbor/libxml/tree.h +1315 -0
  19. data/ext/nokolexbor/libxml/uri.h +94 -0
  20. data/ext/nokolexbor/libxml/valid.h +448 -0
  21. data/ext/nokolexbor/libxml/xmlIO.h +369 -0
  22. data/ext/nokolexbor/libxml/xmlautomata.h +146 -0
  23. data/ext/nokolexbor/libxml/xmlerror.h +919 -0
  24. data/ext/nokolexbor/libxml/xmlexports.h +79 -0
  25. data/ext/nokolexbor/libxml/xmlmemory.h +226 -0
  26. data/ext/nokolexbor/libxml/xmlregexp.h +222 -0
  27. data/ext/nokolexbor/libxml/xmlstring.h +140 -0
  28. data/ext/nokolexbor/libxml/xmlversion.h +526 -0
  29. data/ext/nokolexbor/libxml/xpath.h +575 -0
  30. data/ext/nokolexbor/libxml/xpathInternals.h +632 -0
  31. data/ext/nokolexbor/libxml/xpointer.h +137 -0
  32. data/ext/nokolexbor/libxml.h +76 -0
  33. data/ext/nokolexbor/memory.c +39 -0
  34. data/ext/nokolexbor/nl_document.c +51 -0
  35. data/ext/nokolexbor/nl_node.c +790 -0
  36. data/ext/nokolexbor/nl_node_set.c +368 -0
  37. data/ext/nokolexbor/nl_xpath_context.c +200 -0
  38. data/ext/nokolexbor/nokolexbor.c +63 -0
  39. data/ext/nokolexbor/nokolexbor.h +37 -0
  40. data/ext/nokolexbor/private/buf.h +70 -0
  41. data/ext/nokolexbor/private/dict.h +11 -0
  42. data/ext/nokolexbor/private/enc.h +17 -0
  43. data/ext/nokolexbor/private/error.h +21 -0
  44. data/ext/nokolexbor/private/globals.h +9 -0
  45. data/ext/nokolexbor/private/memory.h +9 -0
  46. data/ext/nokolexbor/private/parser.h +27 -0
  47. data/ext/nokolexbor/private/string.h +9 -0
  48. data/ext/nokolexbor/private/threads.h +50 -0
  49. data/ext/nokolexbor/private/tree.h +18 -0
  50. data/ext/nokolexbor/private/xpath.h +7 -0
  51. data/ext/nokolexbor/timsort.h +601 -0
  52. data/ext/nokolexbor/xml_SAX2.c +80 -0
  53. data/ext/nokolexbor/xml_buf.c +363 -0
  54. data/ext/nokolexbor/xml_chvalid.c +334 -0
  55. data/ext/nokolexbor/xml_dict.c +1264 -0
  56. data/ext/nokolexbor/xml_encoding.c +124 -0
  57. data/ext/nokolexbor/xml_error.c +134 -0
  58. data/ext/nokolexbor/xml_globals.c +1085 -0
  59. data/ext/nokolexbor/xml_hash.c +1141 -0
  60. data/ext/nokolexbor/xml_memory.c +203 -0
  61. data/ext/nokolexbor/xml_parser.c +127 -0
  62. data/ext/nokolexbor/xml_parserInternals.c +338 -0
  63. data/ext/nokolexbor/xml_pattern.c +2375 -0
  64. data/ext/nokolexbor/xml_string.c +1051 -0
  65. data/ext/nokolexbor/xml_threads.c +881 -0
  66. data/ext/nokolexbor/xml_tree.c +148 -0
  67. data/ext/nokolexbor/xml_xpath.c +14743 -0
  68. data/lib/nokolexbor/attribute.rb +18 -0
  69. data/lib/nokolexbor/document.rb +6 -0
  70. data/lib/nokolexbor/node.rb +264 -0
  71. data/lib/nokolexbor/node_set.rb +124 -0
  72. data/lib/nokolexbor/version.rb +5 -0
  73. data/lib/nokolexbor/xpath_context.rb +14 -0
  74. data/lib/nokolexbor.rb +17 -0
  75. data/patches/0001-lexbor-support-text-pseudo-element.patch +137 -0
  76. data/patches/0002-lexbor-match-id-class-case-sensitive.patch +22 -0
  77. data/patches/0003-lexbor-attach-template-content-to-self.patch +13 -0
  78. data/vendor/lexbor/CMakeLists.txt +331 -0
  79. data/vendor/lexbor/config.cmake +890 -0
  80. data/vendor/lexbor/feature.cmake +134 -0
  81. data/vendor/lexbor/source/lexbor/core/array.c +208 -0
  82. data/vendor/lexbor/source/lexbor/core/array.h +100 -0
  83. data/vendor/lexbor/source/lexbor/core/array_obj.c +216 -0
  84. data/vendor/lexbor/source/lexbor/core/array_obj.h +134 -0
  85. data/vendor/lexbor/source/lexbor/core/avl.c +442 -0
  86. data/vendor/lexbor/source/lexbor/core/avl.h +82 -0
  87. data/vendor/lexbor/source/lexbor/core/base.h +86 -0
  88. data/vendor/lexbor/source/lexbor/core/bst.c +468 -0
  89. data/vendor/lexbor/source/lexbor/core/bst.h +108 -0
  90. data/vendor/lexbor/source/lexbor/core/bst_map.c +238 -0
  91. data/vendor/lexbor/source/lexbor/core/bst_map.h +87 -0
  92. data/vendor/lexbor/source/lexbor/core/config.cmake +12 -0
  93. data/vendor/lexbor/source/lexbor/core/conv.c +203 -0
  94. data/vendor/lexbor/source/lexbor/core/conv.h +53 -0
  95. data/vendor/lexbor/source/lexbor/core/core.h +35 -0
  96. data/vendor/lexbor/source/lexbor/core/def.h +57 -0
  97. data/vendor/lexbor/source/lexbor/core/diyfp.c +153 -0
  98. data/vendor/lexbor/source/lexbor/core/diyfp.h +258 -0
  99. data/vendor/lexbor/source/lexbor/core/dobject.c +187 -0
  100. data/vendor/lexbor/source/lexbor/core/dobject.h +92 -0
  101. data/vendor/lexbor/source/lexbor/core/dtoa.c +404 -0
  102. data/vendor/lexbor/source/lexbor/core/dtoa.h +28 -0
  103. data/vendor/lexbor/source/lexbor/core/fs.h +60 -0
  104. data/vendor/lexbor/source/lexbor/core/hash.c +476 -0
  105. data/vendor/lexbor/source/lexbor/core/hash.h +218 -0
  106. data/vendor/lexbor/source/lexbor/core/in.c +267 -0
  107. data/vendor/lexbor/source/lexbor/core/in.h +172 -0
  108. data/vendor/lexbor/source/lexbor/core/lexbor.h +35 -0
  109. data/vendor/lexbor/source/lexbor/core/mem.c +228 -0
  110. data/vendor/lexbor/source/lexbor/core/mem.h +141 -0
  111. data/vendor/lexbor/source/lexbor/core/mraw.c +428 -0
  112. data/vendor/lexbor/source/lexbor/core/mraw.h +114 -0
  113. data/vendor/lexbor/source/lexbor/core/perf.h +45 -0
  114. data/vendor/lexbor/source/lexbor/core/plog.c +73 -0
  115. data/vendor/lexbor/source/lexbor/core/plog.h +102 -0
  116. data/vendor/lexbor/source/lexbor/core/print.c +168 -0
  117. data/vendor/lexbor/source/lexbor/core/print.h +39 -0
  118. data/vendor/lexbor/source/lexbor/core/sbst.h +59 -0
  119. data/vendor/lexbor/source/lexbor/core/serialize.c +27 -0
  120. data/vendor/lexbor/source/lexbor/core/serialize.h +32 -0
  121. data/vendor/lexbor/source/lexbor/core/shs.c +118 -0
  122. data/vendor/lexbor/source/lexbor/core/shs.h +82 -0
  123. data/vendor/lexbor/source/lexbor/core/str.c +617 -0
  124. data/vendor/lexbor/source/lexbor/core/str.h +247 -0
  125. data/vendor/lexbor/source/lexbor/core/str_res.h +369 -0
  126. data/vendor/lexbor/source/lexbor/core/strtod.c +326 -0
  127. data/vendor/lexbor/source/lexbor/core/strtod.h +28 -0
  128. data/vendor/lexbor/source/lexbor/core/types.h +39 -0
  129. data/vendor/lexbor/source/lexbor/core/utils.c +43 -0
  130. data/vendor/lexbor/source/lexbor/core/utils.h +36 -0
  131. data/vendor/lexbor/source/lexbor/css/base.h +44 -0
  132. data/vendor/lexbor/source/lexbor/css/config.cmake +2 -0
  133. data/vendor/lexbor/source/lexbor/css/css.h +25 -0
  134. data/vendor/lexbor/source/lexbor/css/log.c +336 -0
  135. data/vendor/lexbor/source/lexbor/css/log.h +103 -0
  136. data/vendor/lexbor/source/lexbor/css/node.h +29 -0
  137. data/vendor/lexbor/source/lexbor/css/parser.c +473 -0
  138. data/vendor/lexbor/source/lexbor/css/parser.h +368 -0
  139. data/vendor/lexbor/source/lexbor/css/selectors/base.h +48 -0
  140. data/vendor/lexbor/source/lexbor/css/selectors/pseudo.c +91 -0
  141. data/vendor/lexbor/source/lexbor/css/selectors/pseudo.h +66 -0
  142. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_const.h +109 -0
  143. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_res.h +302 -0
  144. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.c +279 -0
  145. data/vendor/lexbor/source/lexbor/css/selectors/pseudo_state.h +85 -0
  146. data/vendor/lexbor/source/lexbor/css/selectors/selector.c +927 -0
  147. data/vendor/lexbor/source/lexbor/css/selectors/selector.h +200 -0
  148. data/vendor/lexbor/source/lexbor/css/selectors/selectors.c +340 -0
  149. data/vendor/lexbor/source/lexbor/css/selectors/selectors.h +137 -0
  150. data/vendor/lexbor/source/lexbor/css/selectors/state.c +1718 -0
  151. data/vendor/lexbor/source/lexbor/css/selectors/state.h +79 -0
  152. data/vendor/lexbor/source/lexbor/css/stylesheet.h +37 -0
  153. data/vendor/lexbor/source/lexbor/css/syntax/anb.c +443 -0
  154. data/vendor/lexbor/source/lexbor/css/syntax/anb.h +45 -0
  155. data/vendor/lexbor/source/lexbor/css/syntax/base.h +33 -0
  156. data/vendor/lexbor/source/lexbor/css/syntax/parser.c +9 -0
  157. data/vendor/lexbor/source/lexbor/css/syntax/parser.h +25 -0
  158. data/vendor/lexbor/source/lexbor/css/syntax/res.h +48 -0
  159. data/vendor/lexbor/source/lexbor/css/syntax/state.c +2603 -0
  160. data/vendor/lexbor/source/lexbor/css/syntax/state.h +140 -0
  161. data/vendor/lexbor/source/lexbor/css/syntax/state_res.h +273 -0
  162. data/vendor/lexbor/source/lexbor/css/syntax/syntax.c +67 -0
  163. data/vendor/lexbor/source/lexbor/css/syntax/token.c +618 -0
  164. data/vendor/lexbor/source/lexbor/css/syntax/token.h +298 -0
  165. data/vendor/lexbor/source/lexbor/css/syntax/token_res.h +68 -0
  166. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.c +30 -0
  167. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer/error.h +58 -0
  168. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.c +278 -0
  169. data/vendor/lexbor/source/lexbor/css/syntax/tokenizer.h +121 -0
  170. data/vendor/lexbor/source/lexbor/dom/base.h +32 -0
  171. data/vendor/lexbor/source/lexbor/dom/collection.c +97 -0
  172. data/vendor/lexbor/source/lexbor/dom/collection.h +112 -0
  173. data/vendor/lexbor/source/lexbor/dom/config.cmake +3 -0
  174. data/vendor/lexbor/source/lexbor/dom/dom.h +29 -0
  175. data/vendor/lexbor/source/lexbor/dom/exception.c +18 -0
  176. data/vendor/lexbor/source/lexbor/dom/exception.h +73 -0
  177. data/vendor/lexbor/source/lexbor/dom/interface.c +110 -0
  178. data/vendor/lexbor/source/lexbor/dom/interface.h +88 -0
  179. data/vendor/lexbor/source/lexbor/dom/interfaces/attr.c +445 -0
  180. data/vendor/lexbor/source/lexbor/dom/interfaces/attr.h +152 -0
  181. data/vendor/lexbor/source/lexbor/dom/interfaces/attr_const.h +62 -0
  182. data/vendor/lexbor/source/lexbor/dom/interfaces/attr_res.h +143 -0
  183. data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.c +55 -0
  184. data/vendor/lexbor/source/lexbor/dom/interfaces/cdata_section.h +38 -0
  185. data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.c +110 -0
  186. data/vendor/lexbor/source/lexbor/dom/interfaces/character_data.h +51 -0
  187. data/vendor/lexbor/source/lexbor/dom/interfaces/comment.c +64 -0
  188. data/vendor/lexbor/source/lexbor/dom/interfaces/comment.h +42 -0
  189. data/vendor/lexbor/source/lexbor/dom/interfaces/document.c +536 -0
  190. data/vendor/lexbor/source/lexbor/dom/interfaces/document.h +243 -0
  191. data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.c +36 -0
  192. data/vendor/lexbor/source/lexbor/dom/interfaces/document_fragment.h +36 -0
  193. data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.c +125 -0
  194. data/vendor/lexbor/source/lexbor/dom/interfaces/document_type.h +108 -0
  195. data/vendor/lexbor/source/lexbor/dom/interfaces/element.c +1411 -0
  196. data/vendor/lexbor/source/lexbor/dom/interfaces/element.h +319 -0
  197. data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.c +32 -0
  198. data/vendor/lexbor/source/lexbor/dom/interfaces/event_target.h +34 -0
  199. data/vendor/lexbor/source/lexbor/dom/interfaces/node.c +661 -0
  200. data/vendor/lexbor/source/lexbor/dom/interfaces/node.h +192 -0
  201. data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.c +87 -0
  202. data/vendor/lexbor/source/lexbor/dom/interfaces/processing_instruction.h +66 -0
  203. data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.c +36 -0
  204. data/vendor/lexbor/source/lexbor/dom/interfaces/shadow_root.h +44 -0
  205. data/vendor/lexbor/source/lexbor/dom/interfaces/text.c +63 -0
  206. data/vendor/lexbor/source/lexbor/dom/interfaces/text.h +42 -0
  207. data/vendor/lexbor/source/lexbor/encoding/base.h +218 -0
  208. data/vendor/lexbor/source/lexbor/encoding/big5.c +42839 -0
  209. data/vendor/lexbor/source/lexbor/encoding/config.cmake +12 -0
  210. data/vendor/lexbor/source/lexbor/encoding/const.h +65 -0
  211. data/vendor/lexbor/source/lexbor/encoding/decode.c +3193 -0
  212. data/vendor/lexbor/source/lexbor/encoding/decode.h +370 -0
  213. data/vendor/lexbor/source/lexbor/encoding/encode.c +1931 -0
  214. data/vendor/lexbor/source/lexbor/encoding/encode.h +377 -0
  215. data/vendor/lexbor/source/lexbor/encoding/encoding.c +252 -0
  216. data/vendor/lexbor/source/lexbor/encoding/encoding.h +475 -0
  217. data/vendor/lexbor/source/lexbor/encoding/euc_kr.c +53883 -0
  218. data/vendor/lexbor/source/lexbor/encoding/gb18030.c +47905 -0
  219. data/vendor/lexbor/source/lexbor/encoding/iso_2022_jp_katakana.c +159 -0
  220. data/vendor/lexbor/source/lexbor/encoding/jis0208.c +22477 -0
  221. data/vendor/lexbor/source/lexbor/encoding/jis0212.c +15787 -0
  222. data/vendor/lexbor/source/lexbor/encoding/multi.h +53 -0
  223. data/vendor/lexbor/source/lexbor/encoding/range.c +71 -0
  224. data/vendor/lexbor/source/lexbor/encoding/range.h +34 -0
  225. data/vendor/lexbor/source/lexbor/encoding/res.c +222 -0
  226. data/vendor/lexbor/source/lexbor/encoding/res.h +34 -0
  227. data/vendor/lexbor/source/lexbor/encoding/single.c +13748 -0
  228. data/vendor/lexbor/source/lexbor/encoding/single.h +116 -0
  229. data/vendor/lexbor/source/lexbor/html/base.h +44 -0
  230. data/vendor/lexbor/source/lexbor/html/config.cmake +3 -0
  231. data/vendor/lexbor/source/lexbor/html/encoding.c +574 -0
  232. data/vendor/lexbor/source/lexbor/html/encoding.h +106 -0
  233. data/vendor/lexbor/source/lexbor/html/html.h +107 -0
  234. data/vendor/lexbor/source/lexbor/html/interface.c +165 -0
  235. data/vendor/lexbor/source/lexbor/html/interface.h +186 -0
  236. data/vendor/lexbor/source/lexbor/html/interface_res.h +4449 -0
  237. data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.c +36 -0
  238. data/vendor/lexbor/source/lexbor/html/interfaces/anchor_element.h +34 -0
  239. data/vendor/lexbor/source/lexbor/html/interfaces/area_element.c +36 -0
  240. data/vendor/lexbor/source/lexbor/html/interfaces/area_element.h +34 -0
  241. data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.c +36 -0
  242. data/vendor/lexbor/source/lexbor/html/interfaces/audio_element.h +34 -0
  243. data/vendor/lexbor/source/lexbor/html/interfaces/base_element.c +36 -0
  244. data/vendor/lexbor/source/lexbor/html/interfaces/base_element.h +34 -0
  245. data/vendor/lexbor/source/lexbor/html/interfaces/body_element.c +36 -0
  246. data/vendor/lexbor/source/lexbor/html/interfaces/body_element.h +34 -0
  247. data/vendor/lexbor/source/lexbor/html/interfaces/br_element.c +36 -0
  248. data/vendor/lexbor/source/lexbor/html/interfaces/br_element.h +34 -0
  249. data/vendor/lexbor/source/lexbor/html/interfaces/button_element.c +36 -0
  250. data/vendor/lexbor/source/lexbor/html/interfaces/button_element.h +34 -0
  251. data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.c +36 -0
  252. data/vendor/lexbor/source/lexbor/html/interfaces/canvas_element.h +34 -0
  253. data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.c +36 -0
  254. data/vendor/lexbor/source/lexbor/html/interfaces/d_list_element.h +34 -0
  255. data/vendor/lexbor/source/lexbor/html/interfaces/data_element.c +36 -0
  256. data/vendor/lexbor/source/lexbor/html/interfaces/data_element.h +34 -0
  257. data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.c +36 -0
  258. data/vendor/lexbor/source/lexbor/html/interfaces/data_list_element.h +34 -0
  259. data/vendor/lexbor/source/lexbor/html/interfaces/details_element.c +36 -0
  260. data/vendor/lexbor/source/lexbor/html/interfaces/details_element.h +34 -0
  261. data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.c +36 -0
  262. data/vendor/lexbor/source/lexbor/html/interfaces/dialog_element.h +34 -0
  263. data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.c +36 -0
  264. data/vendor/lexbor/source/lexbor/html/interfaces/directory_element.h +34 -0
  265. data/vendor/lexbor/source/lexbor/html/interfaces/div_element.c +36 -0
  266. data/vendor/lexbor/source/lexbor/html/interfaces/div_element.h +34 -0
  267. data/vendor/lexbor/source/lexbor/html/interfaces/document.c +444 -0
  268. data/vendor/lexbor/source/lexbor/html/interfaces/document.h +256 -0
  269. data/vendor/lexbor/source/lexbor/html/interfaces/element.c +64 -0
  270. data/vendor/lexbor/source/lexbor/html/interfaces/element.h +54 -0
  271. data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.c +36 -0
  272. data/vendor/lexbor/source/lexbor/html/interfaces/embed_element.h +34 -0
  273. data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.c +36 -0
  274. data/vendor/lexbor/source/lexbor/html/interfaces/field_set_element.h +34 -0
  275. data/vendor/lexbor/source/lexbor/html/interfaces/font_element.c +36 -0
  276. data/vendor/lexbor/source/lexbor/html/interfaces/font_element.h +34 -0
  277. data/vendor/lexbor/source/lexbor/html/interfaces/form_element.c +36 -0
  278. data/vendor/lexbor/source/lexbor/html/interfaces/form_element.h +34 -0
  279. data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.c +36 -0
  280. data/vendor/lexbor/source/lexbor/html/interfaces/frame_element.h +34 -0
  281. data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.c +36 -0
  282. data/vendor/lexbor/source/lexbor/html/interfaces/frame_set_element.h +34 -0
  283. data/vendor/lexbor/source/lexbor/html/interfaces/head_element.c +36 -0
  284. data/vendor/lexbor/source/lexbor/html/interfaces/head_element.h +34 -0
  285. data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.c +36 -0
  286. data/vendor/lexbor/source/lexbor/html/interfaces/heading_element.h +34 -0
  287. data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.c +36 -0
  288. data/vendor/lexbor/source/lexbor/html/interfaces/hr_element.h +34 -0
  289. data/vendor/lexbor/source/lexbor/html/interfaces/html_element.c +36 -0
  290. data/vendor/lexbor/source/lexbor/html/interfaces/html_element.h +34 -0
  291. data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.c +36 -0
  292. data/vendor/lexbor/source/lexbor/html/interfaces/iframe_element.h +34 -0
  293. data/vendor/lexbor/source/lexbor/html/interfaces/image_element.c +36 -0
  294. data/vendor/lexbor/source/lexbor/html/interfaces/image_element.h +34 -0
  295. data/vendor/lexbor/source/lexbor/html/interfaces/input_element.c +36 -0
  296. data/vendor/lexbor/source/lexbor/html/interfaces/input_element.h +34 -0
  297. data/vendor/lexbor/source/lexbor/html/interfaces/label_element.c +36 -0
  298. data/vendor/lexbor/source/lexbor/html/interfaces/label_element.h +34 -0
  299. data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.c +36 -0
  300. data/vendor/lexbor/source/lexbor/html/interfaces/legend_element.h +34 -0
  301. data/vendor/lexbor/source/lexbor/html/interfaces/li_element.c +36 -0
  302. data/vendor/lexbor/source/lexbor/html/interfaces/li_element.h +34 -0
  303. data/vendor/lexbor/source/lexbor/html/interfaces/link_element.c +36 -0
  304. data/vendor/lexbor/source/lexbor/html/interfaces/link_element.h +34 -0
  305. data/vendor/lexbor/source/lexbor/html/interfaces/map_element.c +36 -0
  306. data/vendor/lexbor/source/lexbor/html/interfaces/map_element.h +34 -0
  307. data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.c +36 -0
  308. data/vendor/lexbor/source/lexbor/html/interfaces/marquee_element.h +34 -0
  309. data/vendor/lexbor/source/lexbor/html/interfaces/media_element.c +36 -0
  310. data/vendor/lexbor/source/lexbor/html/interfaces/media_element.h +34 -0
  311. data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.c +36 -0
  312. data/vendor/lexbor/source/lexbor/html/interfaces/menu_element.h +34 -0
  313. data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.c +36 -0
  314. data/vendor/lexbor/source/lexbor/html/interfaces/meta_element.h +34 -0
  315. data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.c +36 -0
  316. data/vendor/lexbor/source/lexbor/html/interfaces/meter_element.h +34 -0
  317. data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.c +36 -0
  318. data/vendor/lexbor/source/lexbor/html/interfaces/mod_element.h +34 -0
  319. data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.c +36 -0
  320. data/vendor/lexbor/source/lexbor/html/interfaces/o_list_element.h +34 -0
  321. data/vendor/lexbor/source/lexbor/html/interfaces/object_element.c +36 -0
  322. data/vendor/lexbor/source/lexbor/html/interfaces/object_element.h +34 -0
  323. data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.c +36 -0
  324. data/vendor/lexbor/source/lexbor/html/interfaces/opt_group_element.h +34 -0
  325. data/vendor/lexbor/source/lexbor/html/interfaces/option_element.c +36 -0
  326. data/vendor/lexbor/source/lexbor/html/interfaces/option_element.h +34 -0
  327. data/vendor/lexbor/source/lexbor/html/interfaces/output_element.c +36 -0
  328. data/vendor/lexbor/source/lexbor/html/interfaces/output_element.h +34 -0
  329. data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.c +36 -0
  330. data/vendor/lexbor/source/lexbor/html/interfaces/paragraph_element.h +34 -0
  331. data/vendor/lexbor/source/lexbor/html/interfaces/param_element.c +36 -0
  332. data/vendor/lexbor/source/lexbor/html/interfaces/param_element.h +34 -0
  333. data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.c +36 -0
  334. data/vendor/lexbor/source/lexbor/html/interfaces/picture_element.h +34 -0
  335. data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.c +36 -0
  336. data/vendor/lexbor/source/lexbor/html/interfaces/pre_element.h +34 -0
  337. data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.c +36 -0
  338. data/vendor/lexbor/source/lexbor/html/interfaces/progress_element.h +34 -0
  339. data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.c +36 -0
  340. data/vendor/lexbor/source/lexbor/html/interfaces/quote_element.h +34 -0
  341. data/vendor/lexbor/source/lexbor/html/interfaces/script_element.c +36 -0
  342. data/vendor/lexbor/source/lexbor/html/interfaces/script_element.h +34 -0
  343. data/vendor/lexbor/source/lexbor/html/interfaces/select_element.c +36 -0
  344. data/vendor/lexbor/source/lexbor/html/interfaces/select_element.h +34 -0
  345. data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.c +36 -0
  346. data/vendor/lexbor/source/lexbor/html/interfaces/slot_element.h +34 -0
  347. data/vendor/lexbor/source/lexbor/html/interfaces/source_element.c +36 -0
  348. data/vendor/lexbor/source/lexbor/html/interfaces/source_element.h +34 -0
  349. data/vendor/lexbor/source/lexbor/html/interfaces/span_element.c +36 -0
  350. data/vendor/lexbor/source/lexbor/html/interfaces/span_element.h +34 -0
  351. data/vendor/lexbor/source/lexbor/html/interfaces/style_element.c +36 -0
  352. data/vendor/lexbor/source/lexbor/html/interfaces/style_element.h +34 -0
  353. data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.c +36 -0
  354. data/vendor/lexbor/source/lexbor/html/interfaces/table_caption_element.h +34 -0
  355. data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.c +36 -0
  356. data/vendor/lexbor/source/lexbor/html/interfaces/table_cell_element.h +34 -0
  357. data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.c +36 -0
  358. data/vendor/lexbor/source/lexbor/html/interfaces/table_col_element.h +34 -0
  359. data/vendor/lexbor/source/lexbor/html/interfaces/table_element.c +36 -0
  360. data/vendor/lexbor/source/lexbor/html/interfaces/table_element.h +34 -0
  361. data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.c +36 -0
  362. data/vendor/lexbor/source/lexbor/html/interfaces/table_row_element.h +34 -0
  363. data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.c +36 -0
  364. data/vendor/lexbor/source/lexbor/html/interfaces/table_section_element.h +34 -0
  365. data/vendor/lexbor/source/lexbor/html/interfaces/template_element.c +46 -0
  366. data/vendor/lexbor/source/lexbor/html/interfaces/template_element.h +38 -0
  367. data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.c +36 -0
  368. data/vendor/lexbor/source/lexbor/html/interfaces/text_area_element.h +34 -0
  369. data/vendor/lexbor/source/lexbor/html/interfaces/time_element.c +36 -0
  370. data/vendor/lexbor/source/lexbor/html/interfaces/time_element.h +34 -0
  371. data/vendor/lexbor/source/lexbor/html/interfaces/title_element.c +133 -0
  372. data/vendor/lexbor/source/lexbor/html/interfaces/title_element.h +42 -0
  373. data/vendor/lexbor/source/lexbor/html/interfaces/track_element.c +36 -0
  374. data/vendor/lexbor/source/lexbor/html/interfaces/track_element.h +34 -0
  375. data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.c +36 -0
  376. data/vendor/lexbor/source/lexbor/html/interfaces/u_list_element.h +34 -0
  377. data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.c +36 -0
  378. data/vendor/lexbor/source/lexbor/html/interfaces/unknown_element.h +34 -0
  379. data/vendor/lexbor/source/lexbor/html/interfaces/video_element.c +36 -0
  380. data/vendor/lexbor/source/lexbor/html/interfaces/video_element.h +34 -0
  381. data/vendor/lexbor/source/lexbor/html/interfaces/window.c +36 -0
  382. data/vendor/lexbor/source/lexbor/html/interfaces/window.h +34 -0
  383. data/vendor/lexbor/source/lexbor/html/node.c +14 -0
  384. data/vendor/lexbor/source/lexbor/html/node.h +67 -0
  385. data/vendor/lexbor/source/lexbor/html/parser.c +469 -0
  386. data/vendor/lexbor/source/lexbor/html/parser.h +170 -0
  387. data/vendor/lexbor/source/lexbor/html/serialize.c +1510 -0
  388. data/vendor/lexbor/source/lexbor/html/serialize.h +93 -0
  389. data/vendor/lexbor/source/lexbor/html/tag.h +103 -0
  390. data/vendor/lexbor/source/lexbor/html/tag_res.h +2262 -0
  391. data/vendor/lexbor/source/lexbor/html/token.c +386 -0
  392. data/vendor/lexbor/source/lexbor/html/token.h +130 -0
  393. data/vendor/lexbor/source/lexbor/html/token_attr.c +44 -0
  394. data/vendor/lexbor/source/lexbor/html/token_attr.h +67 -0
  395. data/vendor/lexbor/source/lexbor/html/tokenizer/error.c +28 -0
  396. data/vendor/lexbor/source/lexbor/html/tokenizer/error.h +141 -0
  397. data/vendor/lexbor/source/lexbor/html/tokenizer/res.h +4956 -0
  398. data/vendor/lexbor/source/lexbor/html/tokenizer/state.c +2171 -0
  399. data/vendor/lexbor/source/lexbor/html/tokenizer/state.h +225 -0
  400. data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.c +489 -0
  401. data/vendor/lexbor/source/lexbor/html/tokenizer/state_comment.h +27 -0
  402. data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.c +1654 -0
  403. data/vendor/lexbor/source/lexbor/html/tokenizer/state_doctype.h +27 -0
  404. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.c +303 -0
  405. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rawtext.h +32 -0
  406. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.c +311 -0
  407. data/vendor/lexbor/source/lexbor/html/tokenizer/state_rcdata.h +32 -0
  408. data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.c +1209 -0
  409. data/vendor/lexbor/source/lexbor/html/tokenizer/state_script.h +32 -0
  410. data/vendor/lexbor/source/lexbor/html/tokenizer.c +499 -0
  411. data/vendor/lexbor/source/lexbor/html/tokenizer.h +343 -0
  412. data/vendor/lexbor/source/lexbor/html/tree/active_formatting.c +241 -0
  413. data/vendor/lexbor/source/lexbor/html/tree/active_formatting.h +117 -0
  414. data/vendor/lexbor/source/lexbor/html/tree/error.c +26 -0
  415. data/vendor/lexbor/source/lexbor/html/tree/error.h +114 -0
  416. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_body.c +62 -0
  417. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_after_frameset.c +63 -0
  418. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_body.c +82 -0
  419. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_frameset.c +88 -0
  420. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/after_head.c +222 -0
  421. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_head.c +144 -0
  422. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/before_html.c +166 -0
  423. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/foreign_content.c +358 -0
  424. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_body.c +1974 -0
  425. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_caption.c +158 -0
  426. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_cell.c +187 -0
  427. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_column_group.c +194 -0
  428. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_frameset.c +149 -0
  429. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head.c +374 -0
  430. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_head_noscript.c +121 -0
  431. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_row.c +211 -0
  432. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select.c +341 -0
  433. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_select_in_table.c +115 -0
  434. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table.c +451 -0
  435. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_body.c +208 -0
  436. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_table_text.c +127 -0
  437. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/in_template.c +189 -0
  438. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/initial.c +411 -0
  439. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode/text.c +61 -0
  440. data/vendor/lexbor/source/lexbor/html/tree/insertion_mode.h +135 -0
  441. data/vendor/lexbor/source/lexbor/html/tree/open_elements.c +251 -0
  442. data/vendor/lexbor/source/lexbor/html/tree/open_elements.h +105 -0
  443. data/vendor/lexbor/source/lexbor/html/tree/template_insertion.c +10 -0
  444. data/vendor/lexbor/source/lexbor/html/tree/template_insertion.h +100 -0
  445. data/vendor/lexbor/source/lexbor/html/tree.c +1726 -0
  446. data/vendor/lexbor/source/lexbor/html/tree.h +431 -0
  447. data/vendor/lexbor/source/lexbor/html/tree_res.h +111 -0
  448. data/vendor/lexbor/source/lexbor/ns/base.h +32 -0
  449. data/vendor/lexbor/source/lexbor/ns/config.cmake +2 -0
  450. data/vendor/lexbor/source/lexbor/ns/const.h +37 -0
  451. data/vendor/lexbor/source/lexbor/ns/ns.c +154 -0
  452. data/vendor/lexbor/source/lexbor/ns/ns.h +66 -0
  453. data/vendor/lexbor/source/lexbor/ns/res.h +97 -0
  454. data/vendor/lexbor/source/lexbor/ports/posix/config.cmake +11 -0
  455. data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/fs.c +236 -0
  456. data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/memory.c +33 -0
  457. data/vendor/lexbor/source/lexbor/ports/posix/lexbor/core/perf.c +158 -0
  458. data/vendor/lexbor/source/lexbor/ports/windows_nt/config.cmake +18 -0
  459. data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/fs.c +239 -0
  460. data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/memory.c +33 -0
  461. data/vendor/lexbor/source/lexbor/ports/windows_nt/lexbor/core/perf.c +81 -0
  462. data/vendor/lexbor/source/lexbor/selectors/base.h +30 -0
  463. data/vendor/lexbor/source/lexbor/selectors/config.cmake +2 -0
  464. data/vendor/lexbor/source/lexbor/selectors/selectors.c +1591 -0
  465. data/vendor/lexbor/source/lexbor/selectors/selectors.h +71 -0
  466. data/vendor/lexbor/source/lexbor/tag/base.h +32 -0
  467. data/vendor/lexbor/source/lexbor/tag/config.cmake +2 -0
  468. data/vendor/lexbor/source/lexbor/tag/const.h +225 -0
  469. data/vendor/lexbor/source/lexbor/tag/res.h +562 -0
  470. data/vendor/lexbor/source/lexbor/tag/tag.c +144 -0
  471. data/vendor/lexbor/source/lexbor/tag/tag.h +123 -0
  472. data/vendor/lexbor/source/lexbor/utils/base.h +32 -0
  473. data/vendor/lexbor/source/lexbor/utils/config.cmake +2 -0
  474. data/vendor/lexbor/source/lexbor/utils/http.c +534 -0
  475. data/vendor/lexbor/source/lexbor/utils/http.h +90 -0
  476. data/vendor/lexbor/source/lexbor/utils/utils.h +15 -0
  477. data/vendor/lexbor/source/lexbor/utils/warc.c +817 -0
  478. data/vendor/lexbor/source/lexbor/utils/warc.h +126 -0
  479. data/vendor/lexbor/utils/lexbor/css/selectors/pseudo.py +231 -0
  480. data/vendor/lexbor/utils/lexbor/css/selectors/tmp/const.h +21 -0
  481. data/vendor/lexbor/utils/lexbor/css/selectors/tmp/res.h +26 -0
  482. data/vendor/lexbor/utils/lexbor/css/syntax/definitions.py +49 -0
  483. data/vendor/lexbor/utils/lexbor/css/syntax/token_res.py +54 -0
  484. data/vendor/lexbor/utils/lexbor/css/syntax/tokenizer_code_map.py +36 -0
  485. data/vendor/lexbor/version +1 -0
  486. metadata +542 -0
@@ -0,0 +1,790 @@
1
+ #include "nokolexbor.h"
2
+
3
+ #define SORT_NAME css_result
4
+ #define SORT_TYPE lxb_dom_node_t *
5
+ #define SORT_CMP(x, y) (x->user >= y->user ? (x->user == y->user ? 0 : 1) : -1)
6
+ #include "timsort.h"
7
+
8
+ extern VALUE mNokolexbor;
9
+ extern VALUE cNokolexborDocument;
10
+ extern VALUE cNokolexborNodeSet;
11
+ extern VALUE eLexborError;
12
+ VALUE cNokolexborNode;
13
+
14
+ extern rb_data_type_t nl_document_type;
15
+
16
+ static const rb_data_type_t nl_node_type = {
17
+ "Nokolexbor::Node",
18
+ {
19
+ 0,
20
+ 0,
21
+ },
22
+ 0,
23
+ 0,
24
+ RUBY_TYPED_FREE_IMMEDIATELY,
25
+ };
26
+
27
+ VALUE
28
+ nl_rb_node_create(lxb_dom_node_t *node, VALUE rb_document)
29
+ {
30
+ if (node == NULL)
31
+ {
32
+ rb_raise(rb_eArgError, "Cannot create Nokolexbor::Node with null pointer");
33
+ }
34
+
35
+ VALUE ret = TypedData_Wrap_Struct(cNokolexborNode, &nl_node_type, node);
36
+ rb_iv_set(ret, "@document", rb_document);
37
+ return ret;
38
+ }
39
+
40
+ inline lxb_dom_node_t *
41
+ nl_rb_node_unwrap(VALUE rb_node)
42
+ {
43
+ lxb_dom_node_t *node;
44
+ if (rb_obj_class(rb_node) == cNokolexborDocument)
45
+ {
46
+ TypedData_Get_Struct(rb_node, lxb_dom_document_t, &nl_document_type, node);
47
+ }
48
+ else
49
+ {
50
+ TypedData_Get_Struct(rb_node, lxb_dom_node_t, &nl_node_type, node);
51
+ }
52
+ return node;
53
+ }
54
+
55
+ static VALUE
56
+ nl_node_content(VALUE self)
57
+ {
58
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
59
+
60
+ size_t str_len = 0;
61
+ lxb_char_t *text = lxb_dom_node_text_content(node, &str_len);
62
+ if (text == NULL)
63
+ {
64
+ return rb_str_new("", 0);
65
+ }
66
+ VALUE rb_str = rb_utf8_str_new(text, str_len);
67
+ lxb_dom_document_destroy_text(node->owner_document, text);
68
+
69
+ return rb_str;
70
+ }
71
+
72
+ static VALUE
73
+ nl_node_get_attr(VALUE self, VALUE rb_attr)
74
+ {
75
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
76
+
77
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
78
+ {
79
+ return Qnil;
80
+ }
81
+
82
+ VALUE rb_attr_s = rb_String(rb_attr);
83
+ const char *attr_c = RSTRING_PTR(rb_attr_s);
84
+ int attr_len = RSTRING_LEN(rb_attr_s);
85
+
86
+ lxb_dom_element_t *element = lxb_html_interface_element(node);
87
+
88
+ if (!lxb_dom_element_has_attribute(element, attr_c, attr_len))
89
+ {
90
+ return Qnil;
91
+ }
92
+
93
+ size_t attr_value_len;
94
+ char *attr_value = lxb_dom_element_get_attribute(element, attr_c, attr_len, &attr_value_len);
95
+
96
+ return rb_utf8_str_new(attr_value, attr_value_len);
97
+ }
98
+
99
+ static VALUE
100
+ nl_node_set_attr(VALUE self, VALUE rb_attr, VALUE rb_value)
101
+ {
102
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
103
+
104
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
105
+ {
106
+ return Qnil;
107
+ }
108
+
109
+ VALUE rb_attr_s = rb_String(rb_attr);
110
+ VALUE rb_value_s = rb_String(rb_value);
111
+
112
+ const char *attr_c = RSTRING_PTR(rb_attr_s);
113
+ int attr_len = RSTRING_LEN(rb_attr_s);
114
+ const char *value_c = RSTRING_PTR(rb_value_s);
115
+ int value_len = RSTRING_LEN(rb_value_s);
116
+
117
+ lxb_dom_element_t *element = lxb_html_interface_element(node);
118
+
119
+ lxb_dom_element_set_attribute(element, attr_c, attr_len, value_c, value_len);
120
+
121
+ return rb_value;
122
+ }
123
+
124
+ static VALUE
125
+ nl_node_remove_attr(VALUE self, VALUE rb_attr)
126
+ {
127
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
128
+
129
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
130
+ {
131
+ return Qnil;
132
+ }
133
+
134
+ VALUE rb_attr_s = rb_String(rb_attr);
135
+
136
+ const char *attr_c = RSTRING_PTR(rb_attr_s);
137
+ int attr_len = RSTRING_LEN(rb_attr_s);
138
+
139
+ lxb_dom_element_t *element = lxb_html_interface_element(node);
140
+
141
+ return lxb_dom_element_remove_attribute(element, attr_c, attr_len) == LXB_STATUS_OK ? Qtrue : Qfalse;
142
+ }
143
+
144
+ static lxb_status_t
145
+ nl_node_at_css_callback(lxb_dom_node_t *node, lxb_css_selector_specificity_t *spec, void *ctx)
146
+ {
147
+ lexbor_array_t *array = (lexbor_array_t *)ctx;
148
+ lxb_status_t status = lexbor_array_push_unique(array, node);
149
+ if (status != LXB_STATUS_OK && status != LXB_STATUS_STOPPED)
150
+ {
151
+ nl_raise_lexbor_error(status);
152
+ }
153
+ // Stop at first result
154
+ return LXB_STATUS_STOP;
155
+ }
156
+
157
+ static lxb_status_t
158
+ nl_node_css_callback(lxb_dom_node_t *node, lxb_css_selector_specificity_t *spec, void *ctx)
159
+ {
160
+ lexbor_array_t *array = (lexbor_array_t *)ctx;
161
+ lxb_status_t status = lexbor_array_push_unique(array, node);
162
+ if (status != LXB_STATUS_OK && status != LXB_STATUS_STOPPED)
163
+ {
164
+ nl_raise_lexbor_error(status);
165
+ }
166
+ return LXB_STATUS_OK;
167
+ }
168
+
169
+ static void
170
+ nl_node_find(VALUE self, VALUE selector, lxb_selectors_cb_f cb, void *ctx)
171
+ {
172
+ const char *selector_c = StringValuePtr(selector);
173
+ int selector_len = RSTRING_LEN(selector);
174
+
175
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
176
+
177
+ /* Create CSS parser. */
178
+ lxb_css_parser_t *parser = lxb_css_parser_create();
179
+ lxb_status_t status = lxb_css_parser_init(parser, NULL, NULL);
180
+ if (status != LXB_STATUS_OK)
181
+ {
182
+ nl_raise_lexbor_error(status);
183
+ }
184
+
185
+ /* Selectors. */
186
+ lxb_selectors_t *selectors = lxb_selectors_create();
187
+ status = lxb_selectors_init(selectors);
188
+ if (status != LXB_STATUS_OK)
189
+ {
190
+ nl_raise_lexbor_error(status);
191
+ }
192
+
193
+ /* Parse and get the log. */
194
+ // TODO: Cache the list for reuse, improves performance
195
+ lxb_css_selector_list_t *list = lxb_css_selectors_parse_relative_list(parser, selector_c, selector_len);
196
+ if (parser->status != LXB_STATUS_OK)
197
+ {
198
+ nl_raise_lexbor_error(parser->status);
199
+ }
200
+
201
+ /* Find HTML nodes by CSS Selectors. */
202
+ status = lxb_selectors_find(selectors, node, list, cb, ctx);
203
+ if (status != LXB_STATUS_OK)
204
+ {
205
+ nl_raise_lexbor_error(status);
206
+ }
207
+
208
+ /* Destroy Selectors object. */
209
+ (void)lxb_selectors_destroy(selectors, true);
210
+
211
+ /* Destroy resources for CSS Parser. */
212
+ (void)lxb_css_parser_destroy(parser, true);
213
+
214
+ /* Destroy all object for all CSS Selector List. */
215
+ lxb_css_selector_list_destroy_memory(list);
216
+ }
217
+
218
+ static void
219
+ mark_node_orders(lxb_dom_node_t *root)
220
+ {
221
+ int count = 1;
222
+ root->user = count;
223
+ lxb_dom_node_t *node = root;
224
+ do
225
+ {
226
+ if (node->first_child != NULL)
227
+ {
228
+ node = node->first_child;
229
+ node->user = ++count;
230
+ }
231
+ else
232
+ {
233
+ while (node != root && node->next == NULL)
234
+ {
235
+ node = node->parent;
236
+ }
237
+
238
+ if (node == root)
239
+ {
240
+ break;
241
+ }
242
+
243
+ node = node->next;
244
+ node->user = ++count;
245
+ }
246
+
247
+ } while (true);
248
+ }
249
+
250
+ // Sort nodes in document traversal order (the same as Nokorigi)
251
+ void sort_nodes_if_necessary(VALUE selector, lxb_dom_document_t *doc, lexbor_array_t *array)
252
+ {
253
+ // No need to sort if there's only one selector, the results are natually in document traversal order
254
+ if (strnstr(RSTRING_PTR(selector), ",", RSTRING_LEN(selector)) != NULL)
255
+ {
256
+ int need_order = 0;
257
+ // Check if we have already markded orders, note that
258
+ // we need to order again if new nodes are added to the document
259
+ for (int i = 0; i < array->length; i++)
260
+ {
261
+ if (((lxb_dom_node_t *)array->list[i])->user == 0)
262
+ {
263
+ need_order = 1;
264
+ break;
265
+ }
266
+ }
267
+ if (need_order)
268
+ {
269
+ mark_node_orders(doc);
270
+ }
271
+ css_result_tim_sort(&array->list[0], array->length);
272
+ }
273
+ }
274
+
275
+ VALUE
276
+ nl_node_at_css(VALUE self, VALUE selector)
277
+ {
278
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
279
+ lexbor_array_t *array = lexbor_array_create();
280
+
281
+ nl_node_find(self, selector, nl_node_at_css_callback, array);
282
+
283
+ if (array->length == 0)
284
+ {
285
+ return Qnil;
286
+ }
287
+
288
+ sort_nodes_if_necessary(selector, node->owner_document, array);
289
+
290
+ return nl_rb_node_create(array->list[0], nl_rb_document_get(self));
291
+ }
292
+
293
+ VALUE
294
+ nl_node_css(VALUE self, VALUE selector)
295
+ {
296
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
297
+ lexbor_array_t *array = lexbor_array_create();
298
+
299
+ nl_node_find(self, selector, nl_node_css_callback, array);
300
+
301
+ sort_nodes_if_necessary(selector, node->owner_document, array);
302
+
303
+ return nl_rb_node_set_create_with_data(array, nl_rb_document_get(self));
304
+ }
305
+
306
+ static VALUE
307
+ nl_node_inner_html(VALUE self)
308
+ {
309
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
310
+ lexbor_str_t str = {0};
311
+ lxb_status_t status = lxb_html_serialize_deep_str(node, &str);
312
+ if (status != LXB_STATUS_OK)
313
+ {
314
+ if (str.data != NULL)
315
+ {
316
+ lexbor_str_destroy(&str, node->owner_document->text, false);
317
+ }
318
+ nl_raise_lexbor_error(status);
319
+ }
320
+
321
+ if (str.data != NULL)
322
+ {
323
+ VALUE ret = rb_utf8_str_new(str.data, str.length);
324
+ lexbor_str_destroy(&str, node->owner_document->text, false);
325
+ return ret;
326
+ }
327
+
328
+ return Qnil;
329
+ }
330
+
331
+ static VALUE
332
+ nl_node_outer_html(VALUE self)
333
+ {
334
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
335
+ lexbor_str_t str = {0};
336
+ lxb_status_t status = lxb_html_serialize_tree_str(node, &str);
337
+ if (status != LXB_STATUS_OK)
338
+ {
339
+ if (str.data != NULL)
340
+ {
341
+ lexbor_str_destroy(&str, node->owner_document->text, false);
342
+ }
343
+ nl_raise_lexbor_error(status);
344
+ }
345
+
346
+ if (str.data != NULL)
347
+ {
348
+ VALUE ret = rb_utf8_str_new(str.data, str.length);
349
+ lexbor_str_destroy(&str, node->owner_document->text, false);
350
+ return ret;
351
+ }
352
+
353
+ return Qnil;
354
+ }
355
+
356
+ static VALUE
357
+ nl_node_has_key(VALUE self, VALUE rb_attr)
358
+ {
359
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
360
+
361
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
362
+ {
363
+ return Qfalse;
364
+ }
365
+
366
+ VALUE rb_attr_s = rb_String(rb_attr);
367
+ const char *attr_c = RSTRING_PTR(rb_attr_s);
368
+ int attr_len = RSTRING_LEN(rb_attr_s);
369
+
370
+ lxb_dom_element_t *element = lxb_html_interface_element(node);
371
+
372
+ return lxb_dom_element_has_attribute(element, attr_c, attr_len) ? Qtrue : Qfalse;
373
+ }
374
+
375
+ static VALUE
376
+ nl_node_keys(VALUE self)
377
+ {
378
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
379
+ VALUE ary_keys = rb_ary_new();
380
+
381
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
382
+ {
383
+ return ary_keys;
384
+ }
385
+
386
+ lxb_dom_attr_t *attr = lxb_dom_element_first_attribute(lxb_html_interface_element(node));
387
+
388
+ while (attr != NULL)
389
+ {
390
+ size_t tmp_len;
391
+ lxb_char_t *tmp = lxb_dom_attr_qualified_name(attr, &tmp_len);
392
+ rb_ary_push(ary_keys, rb_utf8_str_new(tmp, tmp_len));
393
+
394
+ attr = lxb_dom_element_next_attribute(attr);
395
+ }
396
+
397
+ return ary_keys;
398
+ }
399
+
400
+ static VALUE
401
+ nl_node_values(VALUE self)
402
+ {
403
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
404
+ VALUE ary_values = rb_ary_new();
405
+
406
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
407
+ {
408
+ return ary_values;
409
+ }
410
+
411
+ lxb_dom_attr_t *attr = lxb_dom_element_first_attribute(lxb_html_interface_element(node));
412
+
413
+ while (attr != NULL)
414
+ {
415
+ size_t tmp_len;
416
+ lxb_char_t *tmp = lxb_dom_attr_value(attr, &tmp_len);
417
+ if (tmp != NULL)
418
+ {
419
+ rb_ary_push(ary_values, rb_utf8_str_new(tmp, tmp_len));
420
+ }
421
+
422
+ attr = lxb_dom_element_next_attribute(attr);
423
+ }
424
+
425
+ return ary_values;
426
+ }
427
+
428
+ static VALUE
429
+ nl_node_attrs(VALUE self)
430
+ {
431
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
432
+ VALUE rb_hash = rb_hash_new();
433
+
434
+ if (node->type != LXB_DOM_NODE_TYPE_ELEMENT)
435
+ {
436
+ return rb_hash;
437
+ }
438
+
439
+ lxb_dom_attr_t *attr = lxb_dom_element_first_attribute(lxb_html_interface_element(node));
440
+
441
+ while (attr != NULL)
442
+ {
443
+ size_t tmp_len;
444
+ lxb_char_t *tmp = lxb_dom_attr_qualified_name(attr, &tmp_len);
445
+ VALUE rb_key = rb_utf8_str_new(tmp, tmp_len);
446
+
447
+ tmp = lxb_dom_attr_value(attr, &tmp_len);
448
+ VALUE rb_value = tmp != NULL ? rb_utf8_str_new(tmp, tmp_len) : Qnil;
449
+
450
+ rb_hash_aset(rb_hash, rb_key, rb_value);
451
+
452
+ attr = lxb_dom_element_next_attribute(attr);
453
+ }
454
+
455
+ return rb_hash;
456
+ }
457
+
458
+ static VALUE
459
+ nl_node_parent(VALUE self)
460
+ {
461
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
462
+ return node->parent ? nl_rb_node_create(node->parent, nl_rb_document_get(self)) : Qnil;
463
+ }
464
+
465
+ static VALUE
466
+ nl_node_previous(VALUE self)
467
+ {
468
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
469
+ return node->prev ? nl_rb_node_create(node->prev, nl_rb_document_get(self)) : Qnil;
470
+ }
471
+
472
+ static VALUE
473
+ nl_node_previous_element(VALUE self)
474
+ {
475
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
476
+ while (node->prev != NULL)
477
+ {
478
+ node = node->prev;
479
+ if (node->type == LXB_DOM_NODE_TYPE_ELEMENT)
480
+ {
481
+ return nl_rb_node_create(node, nl_rb_document_get(self));
482
+ }
483
+ }
484
+ return Qnil;
485
+ }
486
+
487
+ static VALUE
488
+ nl_node_next(VALUE self)
489
+ {
490
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
491
+ return node->next ? nl_rb_node_create(node->next, nl_rb_document_get(self)) : Qnil;
492
+ }
493
+
494
+ static VALUE
495
+ nl_node_next_element(VALUE self)
496
+ {
497
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
498
+ while (node->next != NULL)
499
+ {
500
+ node = node->next;
501
+ if (node->type == LXB_DOM_NODE_TYPE_ELEMENT)
502
+ {
503
+ return nl_rb_node_create(node, nl_rb_document_get(self));
504
+ }
505
+ }
506
+ return Qnil;
507
+ }
508
+
509
+ static VALUE
510
+ nl_node_children(VALUE self)
511
+ {
512
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
513
+ lxb_dom_node_t *child = node->first_child;
514
+ lexbor_array_t *array = lexbor_array_create();
515
+
516
+ while (child != NULL)
517
+ {
518
+ lexbor_array_push(array, child);
519
+ child = child->next;
520
+ }
521
+
522
+ return nl_rb_node_set_create_with_data(array, nl_rb_document_get(self));
523
+ }
524
+
525
+ static VALUE
526
+ nl_node_child(VALUE self)
527
+ {
528
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
529
+ lxb_dom_node_t *child = node->first_child;
530
+ return child ? nl_rb_node_create(child, nl_rb_document_get(self)) : Qnil;
531
+ }
532
+
533
+ static VALUE
534
+ nl_node_remove(VALUE self)
535
+ {
536
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
537
+ lxb_dom_node_remove(node);
538
+ return Qnil;
539
+ }
540
+
541
+ static VALUE
542
+ nl_node_destroy(VALUE self)
543
+ {
544
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
545
+ lxb_dom_node_destroy(node);
546
+ return Qnil;
547
+ }
548
+
549
+ static VALUE
550
+ nl_node_equals(VALUE self, VALUE other)
551
+ {
552
+ lxb_dom_node_t *node1 = nl_rb_node_unwrap(self);
553
+ lxb_dom_node_t *node2 = nl_rb_node_unwrap(other);
554
+ return node1 == node2 ? Qtrue : Qfalse;
555
+ }
556
+
557
+ const lxb_char_t *
558
+ lxb_dom_node_name_qualified(lxb_dom_node_t *node, size_t *len)
559
+ {
560
+ if (node->type == LXB_DOM_NODE_TYPE_ELEMENT)
561
+ {
562
+ return lxb_dom_element_qualified_name(lxb_dom_interface_element(node),
563
+ len);
564
+ }
565
+ return lxb_dom_node_name(node, len);
566
+ }
567
+
568
+ static VALUE
569
+ nl_node_name(VALUE self)
570
+ {
571
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
572
+ size_t len;
573
+ lxb_char_t *name = lxb_dom_node_name_qualified(node, &len);
574
+ return rb_utf8_str_new(name, len);
575
+ }
576
+
577
+ static VALUE
578
+ nl_node_add_sibling(VALUE self, VALUE next_or_previous, VALUE new)
579
+ {
580
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
581
+ lxb_dom_document_t *doc = node->owner_document;
582
+
583
+ int insert_after;
584
+ if (rb_eql(rb_String(next_or_previous), rb_str_new_literal("next")))
585
+ {
586
+ insert_after = 1;
587
+ }
588
+ else if (rb_eql(rb_String(next_or_previous), rb_str_new_literal("previous")))
589
+ {
590
+ insert_after = 0;
591
+ }
592
+ else
593
+ {
594
+ rb_raise(rb_eArgError, "Unsupported inserting position");
595
+ }
596
+
597
+ if (TYPE(new) == T_STRING)
598
+ {
599
+ size_t tag_name_len;
600
+ lxb_char_t *tag_name = lxb_tag_name_by_id(lxb_html_document_tags(doc), LXB_TAG__UNDEF, &tag_name_len);
601
+ if (tag_name == NULL)
602
+ {
603
+ rb_raise(rb_eRuntimeError, "Error getting tag name");
604
+ }
605
+ lxb_dom_element_t *element = lxb_dom_document_create_element(doc, tag_name, tag_name_len, NULL);
606
+ if (element == NULL)
607
+ {
608
+ rb_raise(rb_eRuntimeError, "Error creating element");
609
+ }
610
+ lxb_dom_node_t *frag_root = lxb_html_document_parse_fragment(doc, element, RSTRING_PTR(new), RSTRING_LEN(new));
611
+ if (frag_root == NULL)
612
+ {
613
+ rb_raise(rb_eArgError, "Error parsing HTML");
614
+ }
615
+
616
+ while (frag_root->first_child != NULL)
617
+ {
618
+ lxb_dom_node_t *child = frag_root->first_child;
619
+ lxb_dom_node_remove(child);
620
+ insert_after ? lxb_dom_node_insert_after(node, child) : lxb_dom_node_insert_before(node, child);
621
+ }
622
+ lxb_dom_node_destroy(frag_root);
623
+ }
624
+ else if (rb_obj_class(new) == cNokolexborNode)
625
+ {
626
+ lxb_dom_node_t *node_new = nl_rb_node_unwrap(new);
627
+ insert_after ? lxb_dom_node_insert_after(node, node_new) : lxb_dom_node_insert_before(node, node_new);
628
+ }
629
+ else
630
+ {
631
+ rb_raise(rb_eArgError, "Unsupported node type");
632
+ }
633
+ return Qnil;
634
+ }
635
+
636
+ static VALUE
637
+ nl_node_add_child(VALUE self, VALUE new)
638
+ {
639
+ lxb_dom_node_t *node = nl_rb_node_unwrap(self);
640
+ lxb_dom_document_t *doc = node->owner_document;
641
+
642
+ if (TYPE(new) == T_STRING)
643
+ {
644
+ size_t tag_name_len;
645
+ lxb_char_t *tag_name = lxb_tag_name_by_id(lxb_html_document_tags(doc), LXB_TAG__UNDEF, &tag_name_len);
646
+ if (tag_name == NULL)
647
+ {
648
+ rb_raise(rb_eRuntimeError, "Error getting tag name");
649
+ }
650
+ lxb_dom_element_t *element = lxb_dom_document_create_element(doc, tag_name, tag_name_len, NULL);
651
+ if (element == NULL)
652
+ {
653
+ rb_raise(rb_eRuntimeError, "Error creating element");
654
+ }
655
+ lxb_dom_node_t *frag_root = lxb_html_document_parse_fragment(doc, element, RSTRING_PTR(new), RSTRING_LEN(new));
656
+ if (frag_root == NULL)
657
+ {
658
+ rb_raise(rb_eArgError, "Error parsing HTML");
659
+ }
660
+
661
+ while (frag_root->first_child != NULL)
662
+ {
663
+ lxb_dom_node_t *child = frag_root->first_child;
664
+ lxb_dom_node_remove(child);
665
+ lxb_dom_node_insert_child(node, child);
666
+ }
667
+ lxb_dom_node_destroy(frag_root);
668
+ }
669
+ else if (rb_obj_class(new) == cNokolexborNode)
670
+ {
671
+ lxb_dom_node_t *node_new = nl_rb_node_unwrap(new);
672
+ lxb_dom_node_remove(node_new);
673
+ lxb_dom_node_insert_child(node, node_new);
674
+ }
675
+ else
676
+ {
677
+ rb_raise(rb_eArgError, "Unsupported node type");
678
+ }
679
+ return Qnil;
680
+ }
681
+
682
+ static VALUE
683
+ nl_node_get_type(VALUE self)
684
+ {
685
+ return INT2NUM(nl_rb_node_unwrap(self)->type);
686
+ }
687
+
688
+ static VALUE
689
+ nl_node_first_element_child(VALUE self)
690
+ {
691
+ lxb_dom_node_t *parent = nl_rb_node_unwrap(self);
692
+ lxb_dom_node_t *cur;
693
+
694
+ if (parent == NULL)
695
+ {
696
+ return Qnil;
697
+ }
698
+ switch (parent->type)
699
+ {
700
+ case LXB_DOM_NODE_TYPE_ELEMENT:
701
+ case LXB_DOM_NODE_TYPE_ENTITY:
702
+ case LXB_DOM_NODE_TYPE_DOCUMENT:
703
+ cur = parent->first_child;
704
+ break;
705
+ default:
706
+ return Qnil;
707
+ }
708
+ while (cur != NULL)
709
+ {
710
+ if (cur->type == LXB_DOM_NODE_TYPE_ELEMENT)
711
+ {
712
+ return nl_rb_node_create(cur, nl_rb_document_get(self));
713
+ }
714
+ cur = cur->next;
715
+ }
716
+ return Qnil;
717
+ }
718
+
719
+ static VALUE
720
+ nl_node_last_element_child(VALUE self)
721
+ {
722
+ lxb_dom_node_t *parent = nl_rb_node_unwrap(self);
723
+ lxb_dom_node_t *cur;
724
+
725
+ if (parent == NULL)
726
+ {
727
+ return Qnil;
728
+ }
729
+ switch (parent->type)
730
+ {
731
+ case LXB_DOM_NODE_TYPE_ELEMENT:
732
+ case LXB_DOM_NODE_TYPE_ENTITY:
733
+ case LXB_DOM_NODE_TYPE_DOCUMENT:
734
+ cur = parent->last_child;
735
+ break;
736
+ default:
737
+ return Qnil;
738
+ }
739
+ while (cur != NULL)
740
+ {
741
+ if (cur->type == LXB_DOM_NODE_TYPE_ELEMENT)
742
+ {
743
+ return nl_rb_node_create(cur, nl_rb_document_get(self));
744
+ }
745
+ cur = cur->prev;
746
+ }
747
+ return Qnil;
748
+ }
749
+
750
+ void Init_nl_node(void)
751
+ {
752
+ cNokolexborNode = rb_define_class_under(mNokolexbor, "Node", rb_cObject);
753
+ rb_define_method(cNokolexborNode, "content", nl_node_content, 0);
754
+ rb_define_method(cNokolexborNode, "[]", nl_node_get_attr, 1);
755
+ rb_define_method(cNokolexborNode, "[]=", nl_node_set_attr, 2);
756
+ rb_define_method(cNokolexborNode, "remove_attr", nl_node_remove_attr, 1);
757
+ rb_define_method(cNokolexborNode, "==", nl_node_equals, 1);
758
+ rb_define_method(cNokolexborNode, "css_impl", nl_node_css, 1);
759
+ rb_define_method(cNokolexborNode, "at_css_impl", nl_node_at_css, 1);
760
+ rb_define_method(cNokolexborNode, "inner_html", nl_node_inner_html, 0);
761
+ rb_define_method(cNokolexborNode, "outer_html", nl_node_outer_html, 0);
762
+ rb_define_method(cNokolexborNode, "key?", nl_node_has_key, 1);
763
+ rb_define_method(cNokolexborNode, "keys", nl_node_keys, 0);
764
+ rb_define_method(cNokolexborNode, "values", nl_node_values, 0);
765
+ rb_define_method(cNokolexborNode, "parent", nl_node_parent, 0);
766
+ rb_define_method(cNokolexborNode, "previous", nl_node_previous, 0);
767
+ rb_define_method(cNokolexborNode, "previous_element", nl_node_previous_element, 0);
768
+ rb_define_method(cNokolexborNode, "next", nl_node_next, 0);
769
+ rb_define_method(cNokolexborNode, "next_element", nl_node_next_element, 0);
770
+ rb_define_method(cNokolexborNode, "children", nl_node_children, 0);
771
+ rb_define_method(cNokolexborNode, "child", nl_node_child, 0);
772
+ rb_define_method(cNokolexborNode, "remove", nl_node_remove, 0);
773
+ rb_define_method(cNokolexborNode, "destroy", nl_node_destroy, 0);
774
+ rb_define_method(cNokolexborNode, "attrs", nl_node_attrs, 0);
775
+ rb_define_method(cNokolexborNode, "name", nl_node_name, 0);
776
+ rb_define_method(cNokolexborNode, "add_sibling", nl_node_add_sibling, 2);
777
+ rb_define_method(cNokolexborNode, "add_child", nl_node_add_child, 1);
778
+ rb_define_method(cNokolexborNode, "node_type", nl_node_get_type, 0);
779
+ rb_define_method(cNokolexborNode, "first_element_child", nl_node_first_element_child, 0);
780
+ rb_define_method(cNokolexborNode, "last_element_child", nl_node_last_element_child, 0);
781
+
782
+ rb_define_alias(cNokolexborNode, "attr", "[]");
783
+ rb_define_alias(cNokolexborNode, "set_attr", "[]=");
784
+ rb_define_alias(cNokolexborNode, "text", "content");
785
+ rb_define_alias(cNokolexborNode, "inner_text", "content");
786
+ rb_define_alias(cNokolexborNode, "to_str", "content");
787
+ rb_define_alias(cNokolexborNode, "to_html", "outer_html");
788
+ rb_define_alias(cNokolexborNode, "to_s", "outer_html");
789
+ rb_define_alias(cNokolexborNode, "type", "node_type");
790
+ }