module Invidious::Frontend::Comments extend self def template_reddit(root, locale) String.build do |html| root.each do |child| if child.data.is_a?(RedditComment) child = child.data.as(RedditComment) body_html = HTML.unescape(child.body_html) replies_html = "" if child.replies.is_a?(RedditThing) replies = child.replies.as(RedditThing) replies_html = self.template_reddit(replies.data.as(RedditListing).children, locale) end if child.depth > 0 html << <<-END_HTML
END_HTML else html << <<-END_HTML
END_HTML end html << <<-END_HTML

[ − ] #{child.author} #{translate_count(locale, "comments_points_count", child.score, NumberFormatting::Separator)} #{translate(locale, "`x` ago", recode_date(child.created_utc, locale))} #{translate(locale, "permalink")}

#{body_html} #{replies_html}
END_HTML end end end end end