Skip to content

Commit

Permalink
Forum: Remap some file extensions to prism languages (#1380)
Browse files Browse the repository at this point in the history
* Remap some file extensions to prism languages

* change byte mark to stylecop standard, use a switch expression because I like them more, and maybe is cleaner

Co-authored-by: adelikat <adelikat@tasvideos.org>
  • Loading branch information
nattthebear and adelikat committed Jul 21, 2022
1 parent e244d17 commit f1dc372
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TASVideos.ForumEngine/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public async Task WriteHtml(HtmlWriter w, IWriterHelper h)

// "text" is not a supported language for prism,
// so it will just get the same text formatting as languages, but no syntax highlighting.
var lang = osplit.Length > 0 ? osplit[^1] : "text";
var lang = PrismNames.FixLanguage(osplit.Length > 0 ? osplit[^1] : "text");

if (lang != "text")
{
Expand Down
15 changes: 15 additions & 0 deletions TASVideos.ForumEngine/PrismNames.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace TASVideos.ForumEngine;

public static class PrismNames
{
public static string FixLanguage(string s)
{
return s switch
{
"bat" => "batch",
"sh" => "shell",
"c++" => "cpp",
_ => s
};
}
}

0 comments on commit f1dc372

Please sign in to comment.