Parse() защищенный статический Метод

Parses and returns the blocks represented by the specified template markup.
protected static Parse ( string source, string markup ) : List
source string
markup string
Результат List
Пример #1
0
        /// <summary>
        /// Loads and caches the template at the specified path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static IEnumerable <Template> Load(string path)
        {
            IEnumerable <Template> t;

            if (templates.TryGetValue(path.ToLower(), out t))
            {
                return(t);
            }

            t = Block.Parse(Path.GetFileName(path), File.ReadAllText(path)).OfType <Template>().ToArray();
            templates[path.ToLower()] = t;
            string directory = Path.GetDirectoryName(path).ToLower();

            if (!watchers.ContainsKey(directory))
            {
                var watcher = new FileSystemWatcher(directory);
                watcher.Changed            += (s, e) => templates.Remove(e.FullPath.ToLower());
                watcher.EnableRaisingEvents = true;
                watchers[directory]         = watcher;
            }
            return(t);
        }
Пример #2
0
 public override IEnumerable <ITemplate> ParseTemplates(string source, string template)
 {
     return(Block.Parse(source, template).OfType <ITemplate>());
 }