From e14ce54b5be8f1308b513229db31606433a1f307 Mon Sep 17 00:00:00 2001 From: Mark Appleton Date: Wed, 16 Apr 2025 16:18:19 +0100 Subject: [PATCH 1/4] #7 styling rss feed --- .../Controllers/RssController.cs | 10 ++++ .../cloudscribe.Syndication.Web.csproj | 21 ++++++- src/cloudscribe.Syndication.Web/rss-style.xsl | 46 +++++++++++++++ src/cloudscribe.Syndication.Web/rss.css | 59 +++++++++++++++++++ .../cloudscribe.Syndication.csproj | 4 -- 5 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 src/cloudscribe.Syndication.Web/rss-style.xsl create mode 100644 src/cloudscribe.Syndication.Web/rss.css diff --git a/src/cloudscribe.Syndication.Web/Controllers/RssController.cs b/src/cloudscribe.Syndication.Web/Controllers/RssController.cs index c60abc5..413cb75 100644 --- a/src/cloudscribe.Syndication.Web/Controllers/RssController.cs +++ b/src/cloudscribe.Syndication.Web/Controllers/RssController.cs @@ -7,25 +7,32 @@ using cloudscribe.Syndication.Models.Rss; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System.Collections.Generic; +using System.IO; using System.Threading.Tasks; +using System.Xml.Linq; namespace cloudscribe.Syndication.Web.Controllers { [ApiExplorerSettings(IgnoreApi = true)] public class RssController : Controller { + private readonly IWebHostEnvironment _env; + public RssController( ILogger logger, + IWebHostEnvironment env, IEnumerable channelProviders = null, IChannelProviderResolver channelResolver = null, IXmlFormatter xmlFormatter = null ) { Log = logger; + _env = env; ChannelProviders = channelProviders ?? new List(); if (channelProviders is List) { @@ -75,6 +82,9 @@ public virtual async Task Index() var xml = XmlFormatter.BuildXml(currentChannel); + var processingInstruction = new XProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"/rss-style.xsl\""); + xml.AddFirst(processingInstruction); + return new XmlResult(xml); } diff --git a/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj b/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj index 5b70651..e0a9b04 100644 --- a/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj +++ b/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj @@ -1,4 +1,4 @@ - + asp.netcore mvc controller for rss feeds @@ -13,6 +13,10 @@ git + + + + @@ -24,6 +28,17 @@ - - + + + + contentFiles/any/any/ + true + true + + + contentFiles/any/any/ + true + true + + diff --git a/src/cloudscribe.Syndication.Web/rss-style.xsl b/src/cloudscribe.Syndication.Web/rss-style.xsl new file mode 100644 index 0000000..51cd5e1 --- /dev/null +++ b/src/cloudscribe.Syndication.Web/rss-style.xsl @@ -0,0 +1,46 @@ + + + + + + + + <xsl:value-of select="/rss/channel/title"/> + + + + + + +
+

+ +

+

+ +

+
+
+ + + +
+ + +
+
\ No newline at end of file diff --git a/src/cloudscribe.Syndication.Web/rss.css b/src/cloudscribe.Syndication.Web/rss.css new file mode 100644 index 0000000..ecb197d --- /dev/null +++ b/src/cloudscribe.Syndication.Web/rss.css @@ -0,0 +1,59 @@ +* { + box-sizing: border-box; + font-family: sans-serif; + line-height: 1.4; + margin: 0; + padding: 0; +} + +html { + background: #FFFFFF; + color: #212529; +} + +body { + padding: 1.5rem; +} + +a { + color: #337ab7; +} + +a:hover { + color: #296292; +} + +main, header { + margin-block-end: 3rem; + margin-inline: auto; + max-inline-size: 80ch; +} + +article { + margin-block-end: 3rem; +} + +h1 { + font-size: 2.5rem; + line-height: 1.2; + margin-block: 1rem; +} + +h2 { + font-size: 2rem; + margin-block: 2rem; +} + +h3 { + font-size: 1.75rem; + margin-block: 1rem; +} + +p { + font-size: 1.25rem; + margin-block-end: 1rem; +} + +small { + font-size: 1rem; +} diff --git a/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj b/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj index 97b4b53..aac6603 100644 --- a/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj +++ b/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj @@ -18,11 +18,7 @@ - - - -
From ec215067851a6c779cfa8ab7982e578408149d77 Mon Sep 17 00:00:00 2001 From: Mark Appleton Date: Wed, 16 Apr 2025 16:21:40 +0100 Subject: [PATCH 2/4] #7 removing unused webhost import --- src/cloudscribe.Syndication.Web/Controllers/RssController.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/cloudscribe.Syndication.Web/Controllers/RssController.cs b/src/cloudscribe.Syndication.Web/Controllers/RssController.cs index 413cb75..2ec7fc3 100644 --- a/src/cloudscribe.Syndication.Web/Controllers/RssController.cs +++ b/src/cloudscribe.Syndication.Web/Controllers/RssController.cs @@ -7,7 +7,6 @@ using cloudscribe.Syndication.Models.Rss; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -21,18 +20,14 @@ namespace cloudscribe.Syndication.Web.Controllers [ApiExplorerSettings(IgnoreApi = true)] public class RssController : Controller { - private readonly IWebHostEnvironment _env; - public RssController( ILogger logger, - IWebHostEnvironment env, IEnumerable channelProviders = null, IChannelProviderResolver channelResolver = null, IXmlFormatter xmlFormatter = null ) { Log = logger; - _env = env; ChannelProviders = channelProviders ?? new List(); if (channelProviders is List) { From 836efcb193a60a9bafd68e10400445888991f807 Mon Sep 17 00:00:00 2001 From: Mark Appleton Date: Tue, 22 Apr 2025 13:52:52 +0100 Subject: [PATCH 3/4] Changes to ensure the rss css and xsl files work when pulled into a project and when created using the template --- .../cloudscribe.Syndication.Web.targets | 17 +++++++++++++++++ .../{ => buildTransitive}/rss-style.xsl | 0 .../{ => buildTransitive}/rss.css | 8 ++++---- .../cloudscribe.Syndication.Web.csproj | 19 ++++--------------- 4 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 src/cloudscribe.Syndication.Web/buildTransitive/cloudscribe.Syndication.Web.targets rename src/cloudscribe.Syndication.Web/{ => buildTransitive}/rss-style.xsl (100%) rename src/cloudscribe.Syndication.Web/{ => buildTransitive}/rss.css (93%) diff --git a/src/cloudscribe.Syndication.Web/buildTransitive/cloudscribe.Syndication.Web.targets b/src/cloudscribe.Syndication.Web/buildTransitive/cloudscribe.Syndication.Web.targets new file mode 100644 index 0000000..b506286 --- /dev/null +++ b/src/cloudscribe.Syndication.Web/buildTransitive/cloudscribe.Syndication.Web.targets @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/cloudscribe.Syndication.Web/rss-style.xsl b/src/cloudscribe.Syndication.Web/buildTransitive/rss-style.xsl similarity index 100% rename from src/cloudscribe.Syndication.Web/rss-style.xsl rename to src/cloudscribe.Syndication.Web/buildTransitive/rss-style.xsl diff --git a/src/cloudscribe.Syndication.Web/rss.css b/src/cloudscribe.Syndication.Web/buildTransitive/rss.css similarity index 93% rename from src/cloudscribe.Syndication.Web/rss.css rename to src/cloudscribe.Syndication.Web/buildTransitive/rss.css index ecb197d..145910c 100644 --- a/src/cloudscribe.Syndication.Web/rss.css +++ b/src/cloudscribe.Syndication.Web/buildTransitive/rss.css @@ -19,9 +19,9 @@ a { color: #337ab7; } -a:hover { - color: #296292; -} + a:hover { + color: #296292; + } main, header { margin-block-end: 3rem; @@ -56,4 +56,4 @@ p { small { font-size: 1rem; -} +} \ No newline at end of file diff --git a/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj b/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj index e0a9b04..7b36cdf 100644 --- a/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj +++ b/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj @@ -13,10 +13,6 @@ git - - - - @@ -30,15 +26,8 @@ - - contentFiles/any/any/ - true - true - - - contentFiles/any/any/ - true - true - - + + + + From 9b1fcfb6540f6a091fb6f3a46cfcd808299d4f3f Mon Sep 17 00:00:00 2001 From: Jim Kerslake <39943820+JimKerslake@users.noreply.github.com> Date: Fri, 22 Aug 2025 09:31:56 +0100 Subject: [PATCH 4/4] v8.5 dev --- .../cloudscribe.Syndication.Web.csproj | 2 +- src/cloudscribe.Syndication/cloudscribe.Syndication.csproj | 2 +- update_version.ps1 | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj b/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj index 7bca513..d2e79a8 100644 --- a/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj +++ b/src/cloudscribe.Syndication.Web/cloudscribe.Syndication.Web.csproj @@ -2,7 +2,7 @@ asp.netcore mvc controller for rss feeds - 8.4.0 + 8.5.0 net8.0 Joe Audette cloudscribe;syndication;rss;atom;feed diff --git a/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj b/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj index 0c34ca8..2fb3475 100644 --- a/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj +++ b/src/cloudscribe.Syndication/cloudscribe.Syndication.csproj @@ -2,7 +2,7 @@ cloudscribe.Syndication Class Library - 8.4.0 + 8.5.0 net8.0 Joe Audette cloudscribe;syndication;rss;atom;feed;xml diff --git a/update_version.ps1 b/update_version.ps1 index 0ed4dd0..e38bfec 100644 --- a/update_version.ps1 +++ b/update_version.ps1 @@ -16,9 +16,9 @@ $directory = "src" # Define the old & new versions -$oldVersion = '8\.3' # slash needed ! -$newVersion = "8.4.0" -$newWildcardVersion = "8.4.*" +$oldVersion = '8\.4' # slash needed ! +$newVersion = "8.5.0" +$newWildcardVersion = "8.5.*" # Get all .csproj files in the directory and subdirectories