Skip to content

Commit

Permalink
add avs, bat, and sh to previewable usefiles
Browse files Browse the repository at this point in the history
we'll be relying on shipping official scripts for different things (mostly pcem), and previewing them makes it transparent for the users what they're downloading.

also added prism name fix for wiki by copying the file from forum engine. doesn't feel right tho.
  • Loading branch information
vadosnaprimer committed Sep 26, 2023
1 parent 981753c commit 7fb9c79
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TASVideos.WikiEngine/NewParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ private void ParseStartLine()
var e = new Element(_index, "code");
if (lang != "")
{
e.Attributes["class"] = "language-" + lang;
e.Attributes["class"] = "language-" + PrismNames.FixLanguage(lang);
}

e.Children.Add(new Text(_index, EatSrcEmbedText()) { CharEnd = _index });
Expand Down
15 changes: 15 additions & 0 deletions TASVideos.WikiEngine/PrismNames.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace TASVideos.WikiEngine;

public static class PrismNames
{
public static string FixLanguage(string s)
{
return s switch
{
"bat" => "batch",
"sh" => "shell",
"c++" => "cpp",
_ => s
};
}
}
2 changes: 1 addition & 1 deletion TASVideos/Pages/UserFiles/Info.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace TASVideos.Pages.UserFiles;
[AllowAnonymous]
public class InfoModel : BasePageModel
{
private static readonly string[] PreviewableExtensions = { "wch", "lua" };
private static readonly string[] PreviewableExtensions = { "avs", "bat", "lua", "sh", "wch" };

Check warning on line 14 in TASVideos/Pages/UserFiles/Info.cshtml.cs

View workflow job for this annotation

GitHub Actions / build

Code should not contain multiple whitespace characters in a row.

Check warning on line 14 in TASVideos/Pages/UserFiles/Info.cshtml.cs

View workflow job for this annotation

GitHub Actions / build

Code should not contain multiple whitespace characters in a row.

private readonly ApplicationDbContext _db;
private readonly IFileService _fileService;
Expand Down

0 comments on commit 7fb9c79

Please sign in to comment.