diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-09 15:37:17 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-09 15:37:17 -0400 |
commit | 6e0dcddeb8dd5bcc51e92a4dead42c6757e543e1 (patch) | |
tree | 052bc047d8df591e3190ed5ebc8c1468ed371a1f /src | |
parent | 1ae1a2620ea0a9bda730b9b1a92145a9e255f9b3 (diff) | |
download | SMAPI-6e0dcddeb8dd5bcc51e92a4dead42c6757e543e1.tar.gz SMAPI-6e0dcddeb8dd5bcc51e92a4dead42c6757e543e1.tar.bz2 SMAPI-6e0dcddeb8dd5bcc51e92a4dead42c6757e543e1.zip |
strip 'noinclude' blocks from release descriptions serverside
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI.Web/Controllers/IndexController.cs | 14 | ||||
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/css/index.css | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs index a24b470c..f4ade7de 100644 --- a/src/SMAPI.Web/Controllers/IndexController.cs +++ b/src/SMAPI.Web/Controllers/IndexController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; +using HtmlAgilityPack; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; using StardewModdingAPI.Toolkit; @@ -94,6 +95,19 @@ namespace StardewModdingAPI.Web.Controllers } } + // strip 'noinclude' blocks from release descriptions + foreach (GitRelease release in new[] { stableRelease, betaRelease }) + { + if (release == null) + continue; + + HtmlDocument doc = new HtmlDocument(); + doc.LoadHtml(release.Body); + foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//*[@class='noinclude']")?.ToArray() ?? new HtmlNode[0]) + node.Remove(); + release.Body = doc.DocumentNode.InnerHtml.Trim(); + } + // get versions ReleaseVersion[] stableVersions = this.ParseReleaseVersions(stableRelease).ToArray(); ReleaseVersion[] betaVersions = this.ParseReleaseVersions(betaRelease).ToArray(); diff --git a/src/SMAPI.Web/wwwroot/Content/css/index.css b/src/SMAPI.Web/wwwroot/Content/css/index.css index 06cd6fb4..6340ed87 100644 --- a/src/SMAPI.Web/wwwroot/Content/css/index.css +++ b/src/SMAPI.Web/wwwroot/Content/css/index.css @@ -48,10 +48,6 @@ h1 { padding-left: 1em; } -.github-description .noinclude { - display: none; -} - #support-links li small { display: block; width: 50em; |