Shortcode parser in C#

梦想的初衷 提交于 2019-12-12 06:49:36

问题


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

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

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.


回答1:


This seems what you need: https://github.com/aolde/shortcoder.

You can also install it via NuGet.



来源:https://stackoverflow.com/questions/44815192/shortcode-parser-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!