diff options
author | crupest <crupest@outlook.com> | 2022-04-24 15:22:05 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-24 15:22:05 +0800 |
commit | 3bc8ee1de171f0bd8e226542d75c842c5b2e7175 (patch) | |
tree | 408cea3b767dc5768ad3c08d6e547c876ce1175e /BackEnd/Timeline/Services | |
parent | d8adfa6b141c8e3a8f11592b831c574dee8602b9 (diff) | |
download | timeline-3bc8ee1de171f0bd8e226542d75c842c5b2e7175.tar.gz timeline-3bc8ee1de171f0bd8e226542d75c842c5b2e7175.tar.bz2 timeline-3bc8ee1de171f0bd8e226542d75c842c5b2e7175.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Services')
-rw-r--r-- | BackEnd/Timeline/Services/Timeline/MarkdownProcessor.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/BackEnd/Timeline/Services/Timeline/MarkdownProcessor.cs b/BackEnd/Timeline/Services/Timeline/MarkdownProcessor.cs index ef8022c0..84b99915 100644 --- a/BackEnd/Timeline/Services/Timeline/MarkdownProcessor.cs +++ b/BackEnd/Timeline/Services/Timeline/MarkdownProcessor.cs @@ -1,4 +1,4 @@ -using Markdig;
+using Markdig;
using Markdig.Renderers.Normalize;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
@@ -8,7 +8,7 @@ using System.IO; using System.Linq;
using System.Text;
using Timeline.Controllers;
-
+ namespace Timeline.Services.Timeline
{
public class MarkdownProcessor
@@ -31,6 +31,7 @@ namespace Timeline.Services.Timeline return writer.ToString();
}
+ [Obsolete("Use overload with 'owner'.")]
/// <summary>Convert data url to true url with post id.</summary>
public string Process(string text, IUrlHelper url, string timeline, long post)
{
@@ -44,9 +45,28 @@ namespace Timeline.Services.Timeline );
}
+ [Obsolete("Use overload with 'owner'.")]
public byte[] Process(byte[] data, IUrlHelper url, string timeline, long post)
{
return Encoding.UTF8.GetBytes(Process(Encoding.UTF8.GetString(data), url, timeline, post));
+ } + + /// <summary>Convert data url to true url with post id.</summary>
+ public string Process(string text, IUrlHelper url, string owner, string timeline, long post)
+ {
+ return Process(
+ text,
+ dataIndex => url.ActionLink(
+ "DataGet",
+ "TimelinePostV2",
+ new { owner, timeline, post, data_index = dataIndex }
+ )!
+ );
+ }
+
+ public byte[] Process(byte[] data, IUrlHelper url, string owner, string timeline, long post)
+ {
+ return Encoding.UTF8.GetBytes(Process(Encoding.UTF8.GetString(data), url, owner, timeline, post));
}
}
}
|