Compare commits
9 Commits
26b022f7ba
...
4e032c3aa5
Author | SHA1 | Date | |
---|---|---|---|
4e032c3aa5 | |||
738bf1f3ba | |||
5c55318577 | |||
0b9841a724 | |||
190e247067 | |||
e3b40a94c0 | |||
290d261771 | |||
42d1115df4 | |||
a138c38009 |
2
OliverBooth/Pages/Blog/RawArticle.cshtml
Normal file
2
OliverBooth/Pages/Blog/RawArticle.cshtml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
@page "/blog/{year:int}/{month:int}/{day:int}/{slug}/raw"
|
||||||
|
@model OliverBooth.Pages.Blog.RawArticle
|
52
OliverBooth/Pages/Blog/RawArticle.cshtml.cs
Normal file
52
OliverBooth/Pages/Blog/RawArticle.cshtml.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using Cysharp.Text;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using OliverBooth.Data.Blog;
|
||||||
|
using OliverBooth.Services;
|
||||||
|
|
||||||
|
namespace OliverBooth.Pages.Blog;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the page model for the <c>RawArticle</c> page.
|
||||||
|
/// </summary>
|
||||||
|
public class RawArticle : PageModel
|
||||||
|
{
|
||||||
|
private readonly BlogService _blogService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="RawArticle" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="blogService">The <see cref="BlogService" />.</param>
|
||||||
|
public RawArticle(BlogService blogService)
|
||||||
|
{
|
||||||
|
_blogService = blogService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the requested blog post.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The requested blog post.</value>
|
||||||
|
public BlogPost Post { get; private set; } = null!;
|
||||||
|
|
||||||
|
public IActionResult OnGet(int year, int month, int day, string slug)
|
||||||
|
{
|
||||||
|
if (!_blogService.TryGetBlogPost(year, month, day, slug, out BlogPost? post))
|
||||||
|
{
|
||||||
|
Response.StatusCode = 404;
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder();
|
||||||
|
builder.AppendLine("# " + post.Title);
|
||||||
|
if (_blogService.TryGetAuthor(post, out Author? author))
|
||||||
|
builder.AppendLine($"Author: {author.Name}");
|
||||||
|
|
||||||
|
builder.AppendLine($"Published: {post.Published:R}");
|
||||||
|
if (post.Updated.HasValue)
|
||||||
|
builder.AppendLine($"Updated: {post.Updated:R}");
|
||||||
|
|
||||||
|
builder.AppendLine();
|
||||||
|
builder.AppendLine(post.Body);
|
||||||
|
return Content(builder.ToString(), "text/plain");
|
||||||
|
}
|
||||||
|
}
|
@ -59,7 +59,11 @@
|
|||||||
|
|
||||||
<footer class="footer text-muted">
|
<footer class="footer text-muted">
|
||||||
<div class="container text-center">
|
<div class="container text-center">
|
||||||
© @DateTime.UtcNow.Year • <a asp-area="" asp-page="/privacy/index">Privacy</a>
|
© @DateTime.UtcNow.Year
|
||||||
|
•
|
||||||
|
<a asp-area="" asp-page="/privacy/index">Privacy</a>
|
||||||
|
•
|
||||||
|
<a href="https://mastodon.olivr.me/@@oliver" rel="me">Mastodon</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
@ -16,19 +16,11 @@ builder.Services.AddSingleton<ConfigurationService>();
|
|||||||
builder.Services.AddSingleton<TemplateService>();
|
builder.Services.AddSingleton<TemplateService>();
|
||||||
|
|
||||||
builder.Services.AddSingleton(provider => new MarkdownPipelineBuilder()
|
builder.Services.AddSingleton(provider => new MarkdownPipelineBuilder()
|
||||||
.UseAbbreviations()
|
.Use(new TemplateExtension(provider.GetRequiredService<TemplateService>()))
|
||||||
.UseAdvancedExtensions()
|
.UseAdvancedExtensions()
|
||||||
.UseBootstrap()
|
.UseBootstrap()
|
||||||
.UseCitations()
|
.UseEmojiAndSmiley()
|
||||||
.UseDiagrams()
|
.UseSmartyPants()
|
||||||
.UseFigures()
|
|
||||||
.UseFooters()
|
|
||||||
.UseFootnotes()
|
|
||||||
.UseGlobalization()
|
|
||||||
.UseMathematics()
|
|
||||||
.UseAutoIdentifiers()
|
|
||||||
.UseAutoLinks()
|
|
||||||
.Use(new TemplateExtension(provider.GetRequiredService<TemplateService>()))
|
|
||||||
.Build());
|
.Build());
|
||||||
|
|
||||||
builder.Services.AddDbContextFactory<BlogContext>();
|
builder.Services.AddDbContextFactory<BlogContext>();
|
||||||
|
@ -136,6 +136,18 @@ nav {
|
|||||||
}
|
}
|
||||||
|
|
||||||
article {
|
article {
|
||||||
|
background: #333333;
|
||||||
|
padding: 20px;
|
||||||
|
|
||||||
|
*:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
border-left: 2px solid #f03;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
p > img.img-fluid {
|
p > img.img-fluid {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
@ -149,6 +161,11 @@ article {
|
|||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
margin: 50px 0;
|
margin: 50px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abbr {
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: 1px dotted #ffffff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.blog-card {
|
.blog-card {
|
||||||
@ -157,6 +174,11 @@ article {
|
|||||||
&:hover {
|
&:hover {
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
article {
|
||||||
|
background: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
@ -180,11 +202,6 @@ code[class*="language-"] {
|
|||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
}
|
}
|
||||||
|
|
||||||
article blockquote {
|
|
||||||
border-left: 2px solid #f03;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.alert *:last-child {
|
div.alert *:last-child {
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
@ -26,7 +26,6 @@ declare const katex: any;
|
|||||||
const list = document.querySelectorAll('[data-bs-toggle="tooltip"]');
|
const list = document.querySelectorAll('[data-bs-toggle="tooltip"]');
|
||||||
list.forEach((el: Element) => new bootstrap.Tooltip(el));
|
list.forEach((el: Element) => new bootstrap.Tooltip(el));
|
||||||
|
|
||||||
window.onload = function () {
|
|
||||||
const tex = document.getElementsByClassName("math");
|
const tex = document.getElementsByClassName("math");
|
||||||
Array.prototype.forEach.call(tex, function (el) {
|
Array.prototype.forEach.call(tex, function (el) {
|
||||||
let content = el.textContent.trim();
|
let content = el.textContent.trim();
|
||||||
@ -35,5 +34,4 @@ declare const katex: any;
|
|||||||
|
|
||||||
katex.render(content, el);
|
katex.render(content, el);
|
||||||
});
|
});
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user