Esempio n. 1
0
 /// <summary>
 /// Calls the indicated custom Front-Matter field and returns the resulting value/object to be used into documents/templates
 /// </summary>
 /// <param name="sourceName">The name of the FM source to call. Case insensitive.</param>
 /// <param name="srcParams">a list of params in test form</param>
 /// <returns></returns>
 public static object GetFieldValueFromFMSource(string sourceName, MIISFile file, params string[] srcParams)
 {
     sourceName = sourceName.ToLowerInvariant();
     if (_FMSources.ContainsKey(sourceName))
     {
         //Instantiate a new class of this type
         IFMSource fms = (IFMSource)Activator.CreateInstance(_FMSources[sourceName]);
         return(fms.GetValue(file, srcParams));
     }
     else
     {
         throw new Exception($"The custom Front-Matter source '{sourceName}' does not exist!!");
     }
 }
Esempio n. 2
0
 //Constructor
 internal MDFieldsResolver(MarkdownFile mdFile)
 {
     _parentFile = mdFile;
     _mdProxy    = new MIISFile(_parentFile);
     _ctx        = HttpContext.Current;
 }