/// <summary>
        /// Gets the RazorCodeLanguage registered for the specified file extension
        /// </summary>
        /// <param name="fileExtension">The extension, with or without a "."</param>
        /// <returns>The language registered for that extension</returns>
        public static RazorCodeLanguage GetLanguageByExtension(string fileExtension)
        {
            RazorCodeLanguage service = null;

            Languages.TryGetValue(fileExtension.TrimStart('.'), out service);
            return(service);
        }
Exemple #2
0
 public RazorEngineHost(
     [NotNull] RazorCodeLanguage codeLanguage,
     [NotNull] Func <ParserBase> markupParserFactory)
     : this()
 {
     CodeLanguage         = codeLanguage;
     _markupParserFactory = markupParserFactory;
 }
Exemple #3
0
 /// <summary>
 /// Creates a host which uses the specified code language and the HTML markup language
 /// </summary>
 /// <param name="codeLanguage">The code language to use</param>
 public RazorEngineHost(RazorCodeLanguage codeLanguage)
     : this(codeLanguage, () => new HtmlMarkupParser())
 {
     if (codeLanguage == null)
     {
         throw new ArgumentNullException(nameof(codeLanguage));
     }
 }
 /// <summary>
 /// Creates a host which uses the specified code language and the HTML markup language
 /// </summary>
 /// <param name="codeLanguage">The code language to use</param>
 public RazorEngineHost(RazorCodeLanguage codeLanguage)
     : this(codeLanguage, () => new HtmlMarkupParser())
 {
     if (codeLanguage == null)
     {
         throw new ArgumentNullException(nameof(codeLanguage));
     }
 }
Exemple #5
0
        public RazorEngineHost(RazorCodeLanguage codeLanguage, Func <ParserBase> markupParserFactory)
            : this()
        {
            if (codeLanguage == null)
            {
                throw new ArgumentNullException("codeLanguage");
            }
            if (markupParserFactory == null)
            {
                throw new ArgumentNullException("markupParserFactory");
            }

            CodeLanguage         = codeLanguage;
            _markupParserFactory = markupParserFactory;
        }
Exemple #6
0
        public RazorEngineHost(RazorCodeLanguage codeLanguage, Func<ParserBase> markupParserFactory)
            : this()
        {
            if (codeLanguage == null)
            {
                throw new ArgumentNullException("codeLanguage");
            }
            if (markupParserFactory == null)
            {
                throw new ArgumentNullException("markupParserFactory");
            }

            CodeLanguage = codeLanguage;
            _markupParserFactory = markupParserFactory;
        }
Exemple #7
0
 /// <summary>
 /// Creates a host which uses the specified code language and the HTML markup language
 /// </summary>
 /// <param name="codeLanguage">The code language to use</param>
 public RazorEngineHost(RazorCodeLanguage codeLanguage)
     : this(codeLanguage, () => new HtmlMarkupParser())
 {
 }
Exemple #8
0
 /// <summary>
 /// Creates a host which uses the specified code language and the HTML markup language
 /// </summary>
 /// <param name="codeLanguage">The code language to use</param>
 public RazorEngineHost(RazorCodeLanguage codeLanguage)
     : this(codeLanguage, () => new HtmlMarkupParser())
 {
 }