Refactoring

pull/17636/head
Salih 1 year ago
parent 31e086b000
commit 26ccdf0cf7

@ -5,6 +5,8 @@ using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
using Volo.CmsKit.Reactions;
using Volo.CmsKit.Web.Icons;
using Markdig;
using Microsoft.Extensions.DependencyInjection;
namespace Volo.CmsKit.Web;
@ -32,6 +34,14 @@ public class CmsKitCommonWebModule : AbpModule
options.ReactionIcons[StandardReactions.Victory] = new LocalizableIconDictionary("fas fa-hand-peace text-warning");
options.ReactionIcons[StandardReactions.Rock] = new LocalizableIconDictionary("fas fa-hand-rock text-warning");
});
context.Services
.AddSingleton(_ => new MarkdownPipelineBuilder()
.UseAutoLinks()
.UseBootstrap()
.UseGridTables()
.UsePipeTables()
.Build());
Configure<AbpVirtualFileSystemOptions>(options =>
{

@ -78,7 +78,7 @@ public class ContentParser : ITransientDependency
{
content = Regex.Replace(content, @"=\s*""", @"=""");
content = Regex.Replace(content, @"""\s*=", @"""=");
var widgets = Regex.Matches(content, @"(?<=\[Widget)(.*?)(?=\])").Cast<Match>().Select(p => p.Value).ToList();
var widgets = Regex.Matches(content, @"(?<=\[Widget)(.*?)(?=\])").Select(p => p.Value).ToList();
for (int i = 0, k = 0; i < parsedList.Count; i++)
{
if (parsedList[i] == Delimeter)
@ -86,9 +86,9 @@ public class ContentParser : ITransientDependency
if (widgets.Count > k)
{
var preparedContent = string.Join("", widgets[k]);
var keys = Regex.Matches(preparedContent, @"(?<=\s)(.*?)(?==\s*"")").Cast<Match>()
var keys = Regex.Matches(preparedContent, @"(?<=\s)(.*?)(?==\s*"")")
.Select(p => p.Value).Where(p => p != string.Empty).ToList();
var values = Regex.Matches(preparedContent, @"(?<=\s*[a-zA-Z]*=\s*"")(.*?)(?="")").Cast<Match>()
var values = Regex.Matches(preparedContent, @"(?<=\s*[a-zA-Z]*=\s*"")(.*?)(?="")")
.Select(p => p.Value).ToList();
var widgetTypeIndex = keys.IndexOf("Type");
@ -98,7 +98,7 @@ public class ContentParser : ITransientDependency
var name = _options.WidgetConfigs.Where(p => p.Key == widgetType).Select(p => p.Value.Name).FirstOrDefault();
if (name is not null && widgets.Count > k)
{
values[0] = name;
values[widgetTypeIndex] = name;
var contentFragment = new ContentFragment() { Type = Widget };
contentFragments.Add(contentFragment);
for (int kv = 0; kv < values.Count; kv++)

@ -1,5 +1,4 @@
using Markdig;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.Localization;
@ -65,14 +64,6 @@ public class CmsKitPublicWebModule : AbpModule
options.AddMaps<CmsKitPublicWebModule>(validate: true);
});
context.Services
.AddSingleton(_ => new MarkdownPipelineBuilder()
.UseAutoLinks()
.UseBootstrap()
.UseGridTables()
.UsePipeTables()
.Build());
Configure<DynamicJavaScriptProxyOptions>(options =>
{
options.DisableModule(CmsKitPublicRemoteServiceConsts.ModuleName);

Loading…
Cancel
Save