import std.cstream, std.regexp, std.stream;

unittest
{
	auto re = new RegExp(`\<.+\>`, `g`);
	assert("bbaaaabb" == re.replace("<hoge>aaaa</hoge>", "bb"));
}

void main(string[] args)
{
	dout.writefln(`<a href="%s">%s</a>`, args[1], args[1]);
	dout.writeLine("<ul>");
	auto re = new RegExp(`\<.+\>`, `g`);
	scope file = new BufferedFile(args[1], FileMode.In);
	while (!file.eof)
	{
		auto line = file.readLine();
		if (line.find("<big>class") != -1 || line.find("<big>struct") != -1)
		{
			auto name = line.split("<u>")[1].split("</u>")[0];
			auto line2 = re.replace(line, "");
			dout.writefln(
				`<li><a href="%s#%s">%s</a></li>`,
				args[1],
				name,
				line2
			);
		}
	}
	dout.writeLine("</ul>");
}
