C#中的简码解析器 [英] Shortcode parser in C#

查看:110
本文介绍了C#中的简码解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能是之前提出的,但是没有适当的解决方案,至少我找不到.

This question was probably asked before but there are no proper solutions, at least I am unable to find one.

我在C#中拥有一个CMS,该文章保存在数据库中,并且在加载该文章时需要它,它应该解析可用的短代码,例如Wordpress.

I have a CMS in C#, the article is saved in the database and what I need it while loading the article it should parse available shortcodes like Wordpress.

string str = "Hello there, show my name as [shortcodeX val="Garth"]";

我需要的是一些帮助,可以根据所调用的短代码来解析它.

What I need is some help to parse it based on the shortcode called.

public string shortcodeX(string val)
{
    return "hi" + val;
}

string str = ParseStringForShortCode(str);

我希望我能够在这里解释要求并寻求帮助

I hope I am able to explain the requirement here and looking for some help

PS:我在 Shortcode的PHP中找到了一些东西自己的自定义cms插件,例如wordpress短代码插件,但由于我不了解PHP,因此我很难理解.

P.S.: I found something in PHP at Shortcode plugins for own custom cms like wordpress shortcode plugins but since I dont know PHP, its hard for me to understand.

推荐答案

这似乎是您需要的: https://github.com/aolde/shortcoder .

您也可以通过NuGet安装它.

You can also install it via NuGet.

这篇关于C#中的简码解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆