fix: tags in essay card and essay page.
All checks were successful
Build blog docker image / Build-Blog-Image (push) Successful in 2m30s

This commit is contained in:
2024-08-14 00:01:12 +08:00
parent 759ffadd2e
commit fe0a804677
3 changed files with 12 additions and 17 deletions

View File

@@ -216,29 +216,20 @@ public partial class RendererService(
private uint GetWordCount(BlogContent content)
{
uint count = 0;
foreach (char c in content.FileContent)
{
if (char.IsControl(c) || char.IsSymbol(c)
|| char.IsSeparator(c))
{
continue;
}
count++;
}
int count = (from c in content.FileContent
where char.IsLetterOrDigit(c)
select c).Count();
logger.LogDebug("Word count of {} is {}", content.FileName,
count);
return count;
return (uint)count;
}
private static string CalculateReadTime(uint wordCount)
{
// 据说语文教学大纲规定,中国高中阅读现代文的速度是600字每分钟
// 据说语文教学大纲规定,中国高中阅读现代文的速度是600字每分钟
int second = (int)wordCount / 10;
TimeSpan span = new TimeSpan(0, 0, second);
TimeSpan span = new(0, 0, second);
return span.ToString("mm'分 'ss'秒'");
}