extends vibenews.web.layout

block title
	- import vibe.textfilter.markdown;
	- import vibe.textfilter.html;
	- import std.string : indexOf;

	- title = info.post.subject;

	- string obfuscateEmail(string email)
		- auto idx = email.indexOf('@');
		- if( idx < 0 ) return email;
		- return email[0 .. idx] ~ " /at/ " ~ email[idx+1 .. $];

block vibenews.navigation
	- import vibenews.webstrings;
	ul
		li
			a(href="../../../")= forumIndexNavCaption
		li
			a(href="../")= info.group.caption
		li
			a(href="../thread/#{info.thread.firstPost.number}/") Back to thread
		li
			a(href=".")= info.post.subject

block vibenews.body
	include vibenews.inc.gravatar
	
	.post.first
		.post-header
			h2.skeleton= info.post.subject
			.permalink Permalink: 
				a(href="#{info.post.number}") HTTP
				a(href="nntp://#{info.settings.hostName}/#{info.group.name}/#{info.post.number}") NNTP
		.post-body
			.post-info
				- mixinAvatarImage(info.post.poster.email, 120, false);

				.poster-name
					a(href="mailto:#{obfuscateEmail(info.post.poster.email)}")= info.post.poster.name

				.posting-info Posted #{info.post.date}
					- if (info.post.repliedToPoster.email.length)
						|  in reply to #[a(href="#{info.post.repliedToPostNumber}")= info.post.repliedToPoster.name]
				a.reply-link.link-button(href="../../post?group=#{info.group.name}&amp;thread=#{info.thread.firstPost.number}&amp;reply-to=#{info.post.number}") Reply
			.post-content
				!= filterMarkdown(info.post.message, MarkdownFlags.forumDefault)
