aboutsummaryrefslogtreecommitdiff
path: root/libtxt/html.c
blob: 0c073236c1d2e2539b4404627bb38eaa840b2994 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// MIT License, Copyright (c) 2020 Marvin Borner
// HTML parsing is mainly based on the XML parser

#include <print.h>
#include <str.h>

int html_self_closing(const char *tag)
{
	// TODO: Add 'meta'?
	const char *void_elements[] = { "area",	 "base", "br",	  "col",    "embed", "hr", "img",
					"input", "link", "param", "source", "track", "wbr" };

	for (u32 i = 0; i < sizeof(void_elements) / sizeof(void_elements[0]); ++i) {
		if (!strcmp(void_elements[i], tag))
			return 1;
	}
	return 0;
}