| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. groonga-command |
| 4 |
.. database: functions_html_untag |
| 5 |
|
| 6 |
``html_untag`` |
| 7 |
============== |
| 8 |
|
| 9 |
Summary |
| 10 |
------- |
| 11 |
|
| 12 |
``html_untag`` strips HTML tags from HTML and outputs plain text. |
| 13 |
|
| 14 |
``html_untag`` is used in ``--output_columns`` described at |
| 15 |
:ref:`select-output-columns`. |
| 16 |
|
| 17 |
Syntax |
| 18 |
------ |
| 19 |
|
| 20 |
``html_untag`` requires only one argument. It is ``html``. |
| 21 |
|
| 22 |
:: |
| 23 |
|
| 24 |
html_untag(html) |
| 25 |
|
| 26 |
Requirements |
| 27 |
------------ |
| 28 |
|
| 29 |
``html_untag`` requires Groonga 3.0.5 or later. |
| 30 |
|
| 31 |
``html_untag`` requires :doc:`/reference/command/command_version` 2 or |
| 32 |
later. |
| 33 |
|
| 34 |
Usage |
| 35 |
----- |
| 36 |
|
| 37 |
Here are a schema definition and sample data to show usage. |
| 38 |
|
| 39 |
Sample schema: |
| 40 |
|
| 41 |
.. groonga-command |
| 42 |
.. include:: ../../example/reference/functions/html_untag/usage_setup_schema.log |
| 43 |
.. table_create WebClips TABLE_HASH_KEY ShortText |
| 44 |
.. column_create WebClips content COLUMN_SCALAR ShortText |
| 45 |
|
| 46 |
Sample data: |
| 47 |
|
| 48 |
.. groonga-command |
| 49 |
.. include:: ../../example/reference/functions/html_untag/usage_setup_data.log |
| 50 |
.. load --table WebClips |
| 51 |
.. [ |
| 52 |
.. {"_key": "http://groonga.org", "content": "groonga is <span class='emphasize'>fast</span>"}, |
| 53 |
.. {"_key": "http://mroonga.org", "content": "mroonga is <span class=\"emphasize\">fast</span>"}, |
| 54 |
.. ] |
| 55 |
|
| 56 |
Here is the simple usage of ``html_untag`` function which strips HTML tags from content of column. |
| 57 |
|
| 58 |
.. groonga-command |
| 59 |
.. include:: ../../example/reference/functions/html_untag/usage_html_untag.log |
| 60 |
.. select WebClips --output_columns "html_untag(content)" --command_version 2 |
| 61 |
|
| 62 |
When executing the above query, you can see "span" tag with "class" attribute is stripped. |
| 63 |
Note that you must specify ``--command_version 2`` to use ``html_untag`` function. |
| 64 |
|
| 65 |
Parameters |
| 66 |
---------- |
| 67 |
|
| 68 |
There is only one required parameter. |
| 69 |
|
| 70 |
``html`` |
| 71 |
^^^^^^^^ |
| 72 |
|
| 73 |
Specifies HTML text to be untagged. |
| 74 |
|
| 75 |
Return value |
| 76 |
------------ |
| 77 |
|
| 78 |
``html_untag`` returns plain text which is stripped HTML tags from HTML text. |