aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/HtmlSearch.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/HtmlSearch.c b/src/HtmlSearch.c
index 89ee326..03d7e3a 100644
--- a/src/HtmlSearch.c
+++ b/src/HtmlSearch.c
@@ -329,22 +329,6 @@ static int html_parse_callback(HtmlParser *html_parser, HtmlParseType parse_type
return 0;
}
-QuickMediaStringView quickmedia_html_node_get_attribute_value(QuickMediaMatchNode *self, const char *attribute_name) {
- QuickMediaStringView attr_name;
- attr_name.data = attribute_name;
- attr_name.size = strlen(attribute_name);
-
- QuickMediaHtmlAttribute *attr = get_attribute_by_name(self->node, attr_name);
- if(attr) {
- return attr->value;
- } else {
- QuickMediaStringView attr_value;
- attr_value.data = NULL;
- attr_value.size = 0;
- return attr_value;
- }
-}
-
static int is_whitespace(int c) {
switch(c) {
case ' ':
@@ -384,6 +368,24 @@ static void strip(const char *str, size_t size, const char **output_str, size_t
rstrip(*output_str, *output_size, output_size, strip_filter_func);
}
+QuickMediaStringView quickmedia_html_node_get_attribute_value(QuickMediaMatchNode *self, const char *attribute_name) {
+ QuickMediaStringView attr_name;
+ attr_name.data = attribute_name;
+ attr_name.size = strlen(attribute_name);
+
+ QuickMediaHtmlAttribute *attr = get_attribute_by_name(self->node, attr_name);
+ if(attr) {
+ QuickMediaStringView attr_value = attr->value;
+ strip(attr_value.data, attr_value.size, &attr_value.data, &attr_value.size, is_whitespace);
+ return attr_value;
+ } else {
+ QuickMediaStringView attr_value;
+ attr_value.data = NULL;
+ attr_value.size = 0;
+ return attr_value;
+ }
+}
+
static int merge_inner_text(QuickMediaHtmlNode *node, QuickMediaString *str) {
if(node->is_tag) {
int newline = 0;