diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-16 14:48:47 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-16 14:48:47 +0100 |
commit | 310cada28d15cc629e7c4c73fe5a842e2af851ae (patch) | |
tree | d805e7e5f6fa13df795a440807b165bc552dcc70 | |
parent | fb55acaa1aa930df113936aef303345932168997 (diff) | |
download | rspamd-310cada28d15cc629e7c4c73fe5a842e2af851ae.tar.gz rspamd-310cada28d15cc629e7c4c73fe5a842e2af851ae.zip |
[Minor] Implement C++ function to get tag id by name
-rw-r--r-- | src/libserver/html/html.cxx | 12 | ||||
-rw-r--r-- | src/libserver/html/html.hxx | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 139c59bd2..5c5157740 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -1726,6 +1726,18 @@ html_debug_structure(const html_content &hc) -> std::string return output; } +auto html_tag_by_name(const std::string_view &name) + -> std::optional<tag_id_t> +{ + const auto *td = rspamd::html::html_tags_defs.by_name(name); + + if (td != nullptr) { + return td->id; + } + + return std::nullopt; +} + /* * Tests part */ diff --git a/src/libserver/html/html.hxx b/src/libserver/html/html.hxx index d4a2fb58b..368155d81 100644 --- a/src/libserver/html/html.hxx +++ b/src/libserver/html/html.hxx @@ -125,6 +125,8 @@ private: }; +auto html_tag_by_name(const std::string_view &name) -> std::optional<tag_id_t>; + } #endif //RSPAMD_HTML_HXX |