| 1 | /* |
| 2 | Copyright (C) 2009-2018 Brazil |
| 3 | Copyright (C) 2020-2023 Sutou Kouhei <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include "../grn_proc.h" |
| 21 | #include "../grn_expr.h" |
| 22 | |
| 23 | #include <groonga/plugin.h> |
| 24 | #include <string.h> |
| 25 | |
| 26 | static bool |
| 27 | highlight_validate_text_arg(grn_ctx *ctx, |
| 28 | grn_obj *arg, |
| 29 | const char *function_name, |
| 30 | const char *label) |
| 31 | { |
| 32 | if (grn_obj_is_text_family_bulk(ctx, arg)) { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | grn_obj inspected; |
| 37 | GRN_TEXT_INIT(&inspected, 0); |
| 38 | grn_inspect(ctx, &inspected, arg); |
| 39 | GRN_PLUGIN_ERROR(ctx, |
| 40 | GRN_INVALID_ARGUMENT, |
| 41 | "%s(): %s must be text: %.*s", |
| 42 | function_name, |
| 43 | label, |
| 44 | (int)GRN_TEXT_LEN(&inspected), |
| 45 | GRN_TEXT_VALUE(&inspected)); |
| 46 | GRN_OBJ_FIN(ctx, &inspected); |
| 47 | |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | static grn_obj * |
| 52 | func_highlight(grn_ctx *ctx, |
| 53 | int nargs, |
| 54 | grn_obj **args, |
| 55 | grn_user_data *user_data) |
| 56 | { |
| 57 | const char *tag = "[highlight]"; |
| 58 | const char *function_name = "highlight"; |
| 59 | grn_obj *highlighted = NULL; |
| 60 | |
| 61 | #define N_REQUIRED_ARGS 1 |
| 62 | if (nargs > N_REQUIRED_ARGS) { |
| 63 | grn_obj *string = args[0]; |
| 64 | grn_obj *end_arg = args[nargs - 1]; |
| 65 | int n_args_without_option = nargs; |
| 66 | |
| 67 | grn_obj cache_key; |
| 68 | GRN_TEXT_INIT(&cache_key, 0); |
| 69 | grn_proc_func_generate_cache_key(ctx, |
| 70 | function_name, |
| 71 | args + 1, |
| 72 | nargs - 1, |
| 73 | &cache_key); |
| 74 | |
| 75 | grn_obj *expression; |
| 76 | grn_proc_get_info(ctx, user_data, NULL, NULL, &expression); |
| 77 | |
| 78 | grn_highlighter *highlighter = NULL; |
| 79 | grn_obj *highlighter_ptr = NULL; |
| 80 | if (GRN_TEXT_LEN(&cache_key) <= GRN_TABLE_MAX_KEY_SIZE) { |
| 81 | highlighter_ptr = |
| 82 | grn_expr_get_var(ctx, |
| 83 | expression, |
| 84 | GRN_TEXT_VALUE(&cache_key), |
| 85 | (unsigned int)GRN_TEXT_LEN(&cache_key)); |
| 86 | if (highlighter_ptr) { |
| 87 | highlighter = (grn_highlighter *)GRN_PTR_VALUE(highlighter_ptr); |
| 88 | } else { |
| 89 | highlighter_ptr = |
| 90 | grn_expr_get_or_add_var(ctx, |
| 91 | expression, |
| 92 | GRN_TEXT_VALUE(&cache_key), |
| 93 | (unsigned int)GRN_TEXT_LEN(&cache_key)); |
| 94 | if (ctx->rc != GRN_SUCCESS) { |
| 95 | goto exit; |
| 96 | } |
| 97 | GRN_OBJ_FIN(ctx, highlighter_ptr); |
| 98 | GRN_PTR_INIT(highlighter_ptr, GRN_OBJ_OWN, GRN_DB_OBJECT); |
| 99 | } |
| 100 | } |
| 101 | GRN_OBJ_FIN(ctx, &cache_key); |
| 102 | |
| 103 | if (!highlighter) { |
| 104 | highlighter = grn_highlighter_open(ctx); |
| 105 | if (highlighter_ptr) { |
| 106 | GRN_PTR_SET(ctx, highlighter_ptr, highlighter); |
| 107 | } |
| 108 | |
| 109 | grn_highlighter_set_html_mode(ctx, highlighter, false); |
| 110 | |
| 111 | bool need_tag_in_variable_args = true; |
| 112 | |
| 113 | if (grn_obj_is_tiny_hash_table(ctx, end_arg)) { |
| 114 | n_args_without_option--; |
| 115 | |
| 116 | grn_raw_string normalizers; |
| 117 | GRN_RAW_STRING_SET_CSTRING(normalizers, "NormalizerAuto"); |
| 118 | bool html_mode = false; |
| 119 | grn_raw_string default_open_tag = {NULL, 0}; |
| 120 | grn_raw_string default_close_tag = {NULL, 0}; |
| 121 | bool sequential_class_tag_mode = false; |
| 122 | grn_proc_options_parse(ctx, |
| 123 | end_arg, |
| 124 | tag, |
| 125 | "normalizer", |
| 126 | GRN_PROC_OPTION_VALUE_RAW_STRING, |
| 127 | &normalizers, |
| 128 | "normalizers", |
| 129 | GRN_PROC_OPTION_VALUE_RAW_STRING, |
| 130 | &normalizers, |
| 131 | "html_escape", |
| 132 | GRN_PROC_OPTION_VALUE_BOOL, |
| 133 | &html_mode, |
| 134 | "html_mode", |
| 135 | GRN_PROC_OPTION_VALUE_BOOL, |
| 136 | &html_mode, |
| 137 | "default_open_tag", |
| 138 | GRN_PROC_OPTION_VALUE_RAW_STRING, |
| 139 | &default_open_tag, |
| 140 | "default_close_tag", |
| 141 | GRN_PROC_OPTION_VALUE_RAW_STRING, |
| 142 | &default_close_tag, |
| 143 | "sequential_class_tag_mode", |
| 144 | GRN_PROC_OPTION_VALUE_BOOL, |
| 145 | &sequential_class_tag_mode, |
| 146 | NULL); |
| 147 | if (ctx->rc != GRN_SUCCESS) { |
| 148 | goto exit; |
| 149 | } |
| 150 | |
| 151 | grn_highlighter_set_normalizers(ctx, |
| 152 | highlighter, |
| 153 | normalizers.value, |
| 154 | normalizers.length); |
| 155 | grn_highlighter_set_html_mode(ctx, highlighter, html_mode); |
| 156 | |
| 157 | if (default_open_tag.length > 0) { |
| 158 | need_tag_in_variable_args = false; |
| 159 | grn_highlighter_set_default_open_tag(ctx, |
| 160 | highlighter, |
| 161 | default_open_tag.value, |
| 162 | default_open_tag.length); |
| 163 | } |
| 164 | |
| 165 | if (default_close_tag.length > 0) { |
| 166 | need_tag_in_variable_args = false; |
| 167 | grn_highlighter_set_default_close_tag(ctx, |
| 168 | highlighter, |
| 169 | default_close_tag.value, |
| 170 | default_close_tag.length); |
| 171 | } |
| 172 | |
| 173 | if (sequential_class_tag_mode) { |
| 174 | need_tag_in_variable_args = false; |
| 175 | } |
| 176 | grn_highlighter_set_sequential_class_tag_mode( |
| 177 | ctx, |
| 178 | highlighter, |
| 179 | sequential_class_tag_mode); |
| 180 | } |
| 181 | |
| 182 | grn_obj **keyword_args = args + N_REQUIRED_ARGS; |
| 183 | uint32_t n_keyword_args = |
| 184 | (uint32_t)(n_args_without_option - N_REQUIRED_ARGS); |
| 185 | if (need_tag_in_variable_args) { |
| 186 | uint32_t i; |
| 187 | for (i = 0; i < n_keyword_args; i += 3) { |
| 188 | grn_obj *keyword = keyword_args[i]; |
| 189 | grn_obj *open_tag = keyword_args[i + 1]; |
| 190 | grn_obj *close_tag = keyword_args[i + 2]; |
| 191 | if (!highlight_validate_text_arg(ctx, |
| 192 | keyword, |
| 193 | function_name, |
| 194 | "keyword")) { |
| 195 | goto exit; |
| 196 | } |
| 197 | if (!highlight_validate_text_arg(ctx, |
| 198 | open_tag, |
| 199 | function_name, |
| 200 | "open tag")) { |
| 201 | goto exit; |
| 202 | } |
| 203 | if (!highlight_validate_text_arg(ctx, |
| 204 | close_tag, |
| 205 | function_name, |
| 206 | "close tag")) { |
| 207 | goto exit; |
| 208 | } |
| 209 | grn_highlighter_add_open_tag(ctx, |
| 210 | highlighter, |
| 211 | GRN_TEXT_VALUE(open_tag), |
| 212 | GRN_TEXT_LEN(open_tag)); |
| 213 | grn_highlighter_add_close_tag(ctx, |
| 214 | highlighter, |
| 215 | GRN_TEXT_VALUE(close_tag), |
| 216 | GRN_TEXT_LEN(close_tag)); |
| 217 | grn_highlighter_add_keyword(ctx, |
| 218 | highlighter, |
| 219 | GRN_TEXT_VALUE(keyword), |
| 220 | GRN_TEXT_LEN(keyword)); |
| 221 | } |
| 222 | } else { |
| 223 | uint32_t i; |
| 224 | for (i = 0; i < n_keyword_args; i++) { |
| 225 | grn_obj *keyword = keyword_args[i]; |
| 226 | if (!highlight_validate_text_arg(ctx, |
| 227 | keyword, |
| 228 | function_name, |
| 229 | "keyword")) { |
| 230 | goto exit; |
| 231 | } |
| 232 | grn_highlighter_add_keyword(ctx, |
| 233 | highlighter, |
| 234 | GRN_TEXT_VALUE(keyword), |
| 235 | GRN_TEXT_LEN(keyword)); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_TEXT, 0); |
| 241 | grn_highlighter_highlight(ctx, |
| 242 | highlighter, |
| 243 | GRN_TEXT_VALUE(string), |
| 244 | (int64_t)GRN_TEXT_LEN(string), |
| 245 | highlighted); |
| 246 | } |
| 247 | #undef N_REQUIRED_ARGS |
| 248 | |
| 249 | exit: |
| 250 | if (!highlighted) { |
| 251 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0); |
| 252 | } |
| 253 | |
| 254 | return highlighted; |
| 255 | } |
| 256 | |
| 257 | void |
| 258 | grn_proc_init_highlight(grn_ctx *ctx) |
| 259 | { |
| 260 | grn_proc_create(ctx, |
| 261 | "highlight", |
| 262 | -1, |
| 263 | GRN_PROC_FUNCTION, |
| 264 | func_highlight, |
| 265 | NULL, |
| 266 | NULL, |
| 267 | 0, |
| 268 | NULL); |
| 269 | } |
| 270 | |
| 271 | static grn_obj * |
| 272 | func_highlight_full(grn_ctx *ctx, |
| 273 | int nargs, |
| 274 | grn_obj **args, |
| 275 | grn_user_data *user_data) |
| 276 | { |
| 277 | const char *function_name = "highlight_full"; |
| 278 | grn_obj *highlighted = NULL; |
| 279 | |
| 280 | #define N_REQUIRED_ARGS 3 |
| 281 | #define KEYWORD_SET_SIZE 3 |
| 282 | if ((nargs >= (N_REQUIRED_ARGS + KEYWORD_SET_SIZE) && |
| 283 | (nargs - N_REQUIRED_ARGS) % KEYWORD_SET_SIZE == 0)) { |
| 284 | grn_obj *string = args[0]; |
| 285 | |
| 286 | grn_obj cache_key; |
| 287 | GRN_TEXT_INIT(&cache_key, 0); |
| 288 | grn_proc_func_generate_cache_key(ctx, |
| 289 | function_name, |
| 290 | args + 1, |
| 291 | nargs - 1, |
| 292 | &cache_key); |
| 293 | |
| 294 | grn_obj *expression; |
| 295 | grn_proc_get_info(ctx, user_data, NULL, NULL, &expression); |
| 296 | |
| 297 | grn_highlighter *highlighter = NULL; |
| 298 | grn_obj *highlighter_ptr = NULL; |
| 299 | if (GRN_TEXT_LEN(&cache_key) <= GRN_TABLE_MAX_KEY_SIZE) { |
| 300 | highlighter_ptr = |
| 301 | grn_expr_get_var(ctx, |
| 302 | expression, |
| 303 | GRN_TEXT_VALUE(&cache_key), |
| 304 | (unsigned int)GRN_TEXT_LEN(&cache_key)); |
| 305 | if (highlighter_ptr) { |
| 306 | highlighter = (grn_highlighter *)GRN_PTR_VALUE(highlighter_ptr); |
| 307 | } else { |
| 308 | highlighter_ptr = |
| 309 | grn_expr_get_or_add_var(ctx, |
| 310 | expression, |
| 311 | GRN_TEXT_VALUE(&cache_key), |
| 312 | (unsigned int)GRN_TEXT_LEN(&cache_key)); |
| 313 | if (ctx->rc != GRN_SUCCESS) { |
| 314 | goto exit; |
| 315 | } |
| 316 | GRN_OBJ_FIN(ctx, highlighter_ptr); |
| 317 | GRN_PTR_INIT(highlighter_ptr, GRN_OBJ_OWN, GRN_DB_OBJECT); |
| 318 | } |
| 319 | } |
| 320 | GRN_OBJ_FIN(ctx, &cache_key); |
| 321 | |
| 322 | if (!highlighter) { |
| 323 | grn_obj *normalizers = args[1]; |
| 324 | bool html_mode = GRN_BOOL_VALUE(args[2]); |
| 325 | |
| 326 | highlighter = grn_highlighter_open(ctx); |
| 327 | if (highlighter_ptr) { |
| 328 | GRN_PTR_SET(ctx, highlighter_ptr, highlighter); |
| 329 | } |
| 330 | |
| 331 | grn_highlighter_set_normalizers(ctx, |
| 332 | highlighter, |
| 333 | GRN_TEXT_VALUE(normalizers), |
| 334 | GRN_TEXT_LEN(normalizers)); |
| 335 | grn_highlighter_set_html_mode(ctx, highlighter, html_mode); |
| 336 | |
| 337 | grn_obj **keyword_set_args = args + N_REQUIRED_ARGS; |
| 338 | int n_keyword_args = nargs - N_REQUIRED_ARGS; |
| 339 | int n_keyword_sets = n_keyword_args / KEYWORD_SET_SIZE; |
| 340 | |
| 341 | int i; |
| 342 | for (i = 0; i < n_keyword_sets; i++) { |
| 343 | grn_obj *keyword = keyword_set_args[i * KEYWORD_SET_SIZE + 0]; |
| 344 | grn_obj *open_tag = keyword_set_args[i * KEYWORD_SET_SIZE + 1]; |
| 345 | grn_obj *close_tag = keyword_set_args[i * KEYWORD_SET_SIZE + 2]; |
| 346 | |
| 347 | if (!highlight_validate_text_arg(ctx, |
| 348 | keyword, |
| 349 | function_name, |
| 350 | "keyword")) { |
| 351 | goto exit; |
| 352 | } |
| 353 | if (!highlight_validate_text_arg(ctx, |
| 354 | open_tag, |
| 355 | function_name, |
| 356 | "open tag")) { |
| 357 | goto exit; |
| 358 | } |
| 359 | if (!highlight_validate_text_arg(ctx, |
| 360 | close_tag, |
| 361 | function_name, |
| 362 | "close tag")) { |
| 363 | goto exit; |
| 364 | } |
| 365 | |
| 366 | grn_highlighter_add_keyword(ctx, |
| 367 | highlighter, |
| 368 | GRN_TEXT_VALUE(keyword), |
| 369 | GRN_TEXT_LEN(keyword)); |
| 370 | grn_highlighter_add_open_tag(ctx, |
| 371 | highlighter, |
| 372 | GRN_TEXT_VALUE(open_tag), |
| 373 | GRN_TEXT_LEN(open_tag)); |
| 374 | grn_highlighter_add_close_tag(ctx, |
| 375 | highlighter, |
| 376 | GRN_TEXT_VALUE(close_tag), |
| 377 | GRN_TEXT_LEN(close_tag)); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_TEXT, 0); |
| 382 | grn_highlighter_highlight(ctx, |
| 383 | highlighter, |
| 384 | GRN_TEXT_VALUE(string), |
| 385 | (int64_t)GRN_TEXT_LEN(string), |
| 386 | highlighted); |
| 387 | } |
| 388 | #undef KEYWORD_SET_SIZE |
| 389 | #undef N_REQUIRED_ARGS |
| 390 | |
| 391 | exit: |
| 392 | if (!highlighted) { |
| 393 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0); |
| 394 | } |
| 395 | |
| 396 | return highlighted; |
| 397 | } |
| 398 | |
| 399 | void |
| 400 | grn_proc_init_highlight_full(grn_ctx *ctx) |
| 401 | { |
| 402 | grn_proc_create(ctx, |
| 403 | "highlight_full", |
| 404 | -1, |
| 405 | GRN_PROC_FUNCTION, |
| 406 | func_highlight_full, |
| 407 | NULL, |
| 408 | NULL, |
| 409 | 0, |
| 410 | NULL); |
| 411 | } |
| 412 | |
| 413 | static grn_obj * |
| 414 | func_highlight_html(grn_ctx *ctx, |
| 415 | int nargs, |
| 416 | grn_obj **args, |
| 417 | grn_user_data *user_data) |
| 418 | { |
| 419 | const char *tag = "[highlight-html]"; |
| 420 | const char *function_name = "highlight_html"; |
| 421 | |
| 422 | grn_obj *highlighted = NULL; |
| 423 | grn_highlighter *highlighter = NULL; |
| 424 | grn_obj *highlighter_ptr = NULL; |
| 425 | |
| 426 | if (!(1 <= nargs && nargs <= 2)) { |
| 427 | GRN_PLUGIN_ERROR( |
| 428 | ctx, |
| 429 | GRN_INVALID_ARGUMENT, |
| 430 | "highlight_html(): wrong number of arguments (%d for 1..3)", |
| 431 | nargs); |
| 432 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0); |
| 433 | return highlighted; |
| 434 | } |
| 435 | |
| 436 | grn_obj *string = args[0]; |
| 437 | |
| 438 | grn_obj cache_key; |
| 439 | GRN_TEXT_INIT(&cache_key, 0); |
| 440 | grn_proc_func_generate_cache_key(ctx, |
| 441 | function_name, |
| 442 | args + 1, |
| 443 | nargs - 1, |
| 444 | &cache_key); |
| 445 | |
| 446 | grn_obj *expression; |
| 447 | grn_proc_get_info(ctx, user_data, NULL, NULL, &expression); |
| 448 | |
| 449 | if (GRN_TEXT_LEN(&cache_key) <= GRN_TABLE_MAX_KEY_SIZE) { |
| 450 | highlighter_ptr = grn_expr_get_var(ctx, |
| 451 | expression, |
| 452 | GRN_TEXT_VALUE(&cache_key), |
| 453 | (unsigned int)GRN_TEXT_LEN(&cache_key)); |
| 454 | if (highlighter_ptr) { |
| 455 | highlighter = (grn_highlighter *)GRN_PTR_VALUE(highlighter_ptr); |
| 456 | } else { |
| 457 | highlighter_ptr = |
| 458 | grn_expr_get_or_add_var(ctx, |
| 459 | expression, |
| 460 | GRN_TEXT_VALUE(&cache_key), |
| 461 | (unsigned int)GRN_TEXT_LEN(&cache_key)); |
| 462 | if (ctx->rc != GRN_SUCCESS) { |
| 463 | goto exit; |
| 464 | } |
| 465 | GRN_OBJ_FIN(ctx, highlighter_ptr); |
| 466 | GRN_PTR_INIT(highlighter_ptr, GRN_OBJ_OWN, GRN_DB_OBJECT); |
| 467 | } |
| 468 | } |
| 469 | GRN_OBJ_FIN(ctx, &cache_key); |
| 470 | |
| 471 | if (!highlighter) { |
| 472 | highlighter = grn_highlighter_open(ctx); |
| 473 | if (highlighter_ptr) { |
| 474 | GRN_PTR_SET(ctx, highlighter_ptr, highlighter); |
| 475 | } |
| 476 | |
| 477 | grn_obj *condition = grn_expr_get_condition(ctx, expression); |
| 478 | for (; condition; condition = grn_expr_get_parent(ctx, condition)) { |
| 479 | uint32_t i, n_keywords; |
| 480 | grn_obj current_keywords; |
| 481 | GRN_TEXT_INIT(¤t_keywords, GRN_OBJ_VECTOR); |
| 482 | grn_expr_get_keywords(ctx, condition, ¤t_keywords); |
| 483 | |
| 484 | n_keywords = grn_vector_size(ctx, ¤t_keywords); |
| 485 | for (i = 0; i < n_keywords; i++) { |
| 486 | const char *keyword; |
| 487 | unsigned int keyword_size; |
| 488 | keyword_size = grn_vector_get_element(ctx, |
| 489 | ¤t_keywords, |
| 490 | i, |
| 491 | &keyword, |
| 492 | NULL, |
| 493 | NULL); |
| 494 | grn_highlighter_add_keyword(ctx, highlighter, keyword, keyword_size); |
| 495 | } |
| 496 | GRN_OBJ_FIN(ctx, ¤t_keywords); |
| 497 | } |
| 498 | |
| 499 | grn_obj *end_arg = args[nargs - 1]; |
| 500 | int n_args_without_option = nargs; |
| 501 | if (grn_obj_is_tiny_hash_table(ctx, end_arg)) { |
| 502 | n_args_without_option--; |
| 503 | |
| 504 | bool sequential_class_tag_mode = false; |
| 505 | grn_proc_options_parse(ctx, |
| 506 | end_arg, |
| 507 | tag, |
| 508 | "sequential_class_tag_mode", |
| 509 | GRN_PROC_OPTION_VALUE_BOOL, |
| 510 | &sequential_class_tag_mode, |
| 511 | NULL); |
| 512 | if (ctx->rc != GRN_SUCCESS) { |
| 513 | goto exit; |
| 514 | } |
| 515 | grn_highlighter_set_sequential_class_tag_mode(ctx, |
| 516 | highlighter, |
| 517 | sequential_class_tag_mode); |
| 518 | } |
| 519 | |
| 520 | if (n_args_without_option == 2) { |
| 521 | grn_obj *lexicon = args[1]; |
| 522 | grn_highlighter_set_lexicon(ctx, highlighter, lexicon); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_TEXT, 0); |
| 527 | grn_highlighter_highlight(ctx, |
| 528 | highlighter, |
| 529 | GRN_TEXT_VALUE(string), |
| 530 | (int64_t)GRN_TEXT_LEN(string), |
| 531 | highlighted); |
| 532 | |
| 533 | exit: |
| 534 | if (!highlighted) { |
| 535 | highlighted = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_VOID, 0); |
| 536 | } |
| 537 | |
| 538 | return highlighted; |
| 539 | } |
| 540 | |
| 541 | void |
| 542 | grn_proc_init_highlight_html(grn_ctx *ctx) |
| 543 | { |
| 544 | grn_proc_create(ctx, |
| 545 | "highlight_html", |
| 546 | -1, |
| 547 | GRN_PROC_FUNCTION, |
| 548 | func_highlight_html, |
| 549 | NULL, |
| 550 | NULL, |
| 551 | 0, |
| 552 | NULL); |
| 553 | } |