}
}
void write_atom(std::ostream& ost,
const startgit::branch& branch,
const std::string& base_url)
{
using namespace hemplate; // NOLINT
ost << atom::feed();
ost << atom::title(args.title);
ost << atom::subtitle(args.description);
ost << atom::id(base_url + '/');
ost << atom::updated(atom::format_time_now());
ost << atom::author().add(atom::name(args.author));
ost << atom::link(" ", {{"rel", "self"}, {"href", base_url + "/atom.xml"}});
ost << atom::link(" ",
{{"href", args.resource_url},
{"rel", "alternate"},
{"type", "text/html"}});
for (const auto& commit : branch.get_commits()) {
const auto url =
std::format("{}/commit/{}.html", base_url, commit.get_id());
ost << atom::entry()
.add(atom::id(url))
.add(atom::updated(atom::format_time(commit.get_time_raw())))
.add(atom::title(commit.get_summary()))
.add(atom::link(" ").set("href", url))
.add(atom::author()
.add(atom::name(commit.get_author_name()))
.add(atom::email(commit.get_author_email())))
.add(atom::content(commit.get_message()));
}
ost << atom::feed();
}
void write_rss(std::ostream& ost,
const startgit::branch& branch,
const std::string& base_url)
{
using namespace hemplate; // NOLINT
ost << xml();
ost << rss::rss();
ost << rss::channel();
ost << rss::title(args.title);
ost << rss::description(args.description);
ost << rss::link(base_url + '/');
ost << rss::generator("startgit");
ost << rss::language("en-us");
ost << rss::atomLink().set("href", base_url + "/atom.xml");
for (const auto& commit : branch.get_commits()) {
const auto url =
std::format("{}/commit/{}.html", base_url, commit.get_id());
ost << rss::item()
.add(rss::title(commit.get_summary()))
.add(rss::link(url))
.add(rss::guid(url))
.add(rss::pubDate(rss::format_time(commit.get_time_raw())))
.add(rss::author(std::format("{} ({})",
commit.get_author_email(),
commit.get_author_name())));
}
ost << rss::channel();
ost << rss::rss();
}
int parse_opt(int key, const char* arg, poafloc::Parser* parser)
{
auto* l_args = static_cast<arguments_t*>(parser->input());