/// <summary> /// Gets the relative path of the template to use with the current file taking into account all the possible parameters/fields that control this setting /// </summary> /// <returns></returns> private static string GetCurrentTemplateFile(MarkdownFile md) { //Get the template name that is going to be used (Front Matter or configuration), if any. string templateName = md.TemplateName; if (string.IsNullOrEmpty(templateName) || templateName.ToLowerInvariant() == "none") { return(string.Empty); //Use the default basic HTML5 template } if (templateName.ToLowerInvariant() == "raw") { return("raw"); //Use raw contents, without any wrapping HTML tags } //The name (or sub-path) for the layout file (.html normaly) to be used string layoutName = md.Layout; if (string.IsNullOrEmpty(layoutName)) { return(string.Empty); //Use the default basic HTML5 template } //If both the template folder and the layout are established, then get the base folder for the templates //This base path for the templates parameter is only available through Web.config. NOT in the file Front Matter (we're skipping the file in the following call) string basePath = FieldValuesHelper.GetFieldValue("TemplatesBasePath", null, "~/Templates/"); return(VirtualPathUtility.AppendTrailingSlash(basePath) + VirtualPathUtility.AppendTrailingSlash(templateName) + layoutName); }
private static readonly string FILE_FRAGMENT_PREFIX = "*"; //How to identify fragments placeholders in content files #endregion #region Constructor static Renderer() { //Dynamically setup and add to DotLiquid template processor all the new custom tags, filters and FM sources RegisterCustomExtensions(); //Configure DotLiquid (once) //Check if the CSharp Naming convention is to be used (RubyNamingConvention by default) //naming: csharp in the root web.config //(this is only set once for the whole application because it's an static property //of the DotLiquid template rendering engine) if (FieldValuesHelper.GetFieldValue("naming", null, "ruby") == "csharp") { Template.NamingConvention = new DotLiquid.NamingConventions.CSharpNamingConvention(); } else { Template.NamingConvention = new DotLiquid.NamingConventions.RubyNamingConvention(); } //Check which date formatting to use (Ruby/strftime or C#, C# by default) //DateFormat parameter Liquid.UseRubyDateFormat = (FieldValuesHelper.GetFieldValue("dateformat", null, "csharp") == "ruby"); }