From: Thomas Geymayer Date: Fri, 13 Jun 2014 17:16:26 +0000 (+0200) Subject: Expose parse_markdown to Nasal. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4409c8cca6ec64fea8fe70b75cdf9ddc98273663;p=flightgear.git Expose parse_markdown to Nasal. --- diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 73c233372..cc56043d5 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -697,6 +698,19 @@ static naRef f_parsexml(naContext c, naRef me, int argc, naRef* args) return naStr_fromdata(naNewString(c), const_cast(file), strlen(file)); } +/** + * Parse very simple and small subset of markdown + * + * parse_markdown(src) + */ +static naRef f_parse_markdown(naContext c, naRef me, int argc, naRef* args) +{ + nasal::CallContext ctx(c, argc, args); + return ctx.to_nasal( + simgear::SimpleMarkdown::parse(ctx.requireArg(0)) + ); +} + // Return UNIX epoch time in seconds. static naRef f_systime(naContext c, naRef me, int argc, naRef* args) { @@ -735,6 +749,7 @@ static struct { const char* name; naCFunction func; } funcs[] = { { "resolvepath", f_resolveDataPath }, { "finddata", f_findDataDir }, { "parsexml", f_parsexml }, + { "parse_markdown", f_parse_markdown }, { "systime", f_systime }, { 0, 0 } };