Пример #1
0
        public IEnumerable <Chunk> Load(ISparkTemplate template, IFubuApplicationFiles files)
        {
            if (template.RelativePath().IsEmpty())
            {
                throw new ArgumentOutOfRangeException("Invalid template path for file " + template.FilePath);
            }

            try
            {
                var viewLoader = _loaders[files.RootPath];
                var chunks     = viewLoader.Load(template.RelativePath());
                if (chunks == null)
                {
                    throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()));
                }

                return(chunks.ToList());
            }
            catch (Exception e)
            {
                if (e.Message.StartsWith("Unable to parse file"))
                {
                    throw;
                }

                throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e);
            }
        }
Пример #2
0
        public IEnumerable<Chunk> Load(ISparkTemplate template, IFubuApplicationFiles files)
        {
            if (template.RelativePath().IsEmpty())
            {
                throw new ArgumentOutOfRangeException("Invalid template path for file " + template.FilePath);
            }

            try
            {
                var viewLoader = _loaders[files.RootPath];
                var chunks = viewLoader.Load(template.RelativePath());
                if (chunks == null)
                {
                    throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()));
                }

                return chunks.ToList();
            }
            catch (Exception e)
            {
                if (e.Message.StartsWith("Unable to parse file")) throw;

                throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e);
            }
        }
Пример #3
0
        private static void appendMasterPage(SparkViewDescriptor descriptor, ISparkTemplate template)
        {
            if (template == null)
            {
                return;
            }

            descriptor.AddTemplate(template.ViewPath);
            appendMasterPage(descriptor, template.Master as ISparkTemplate);
        }
Пример #4
0
        public IEnumerable <Chunk> Load(ISparkTemplate template)
        {
            try
            {
                var viewLoader = _loaders[template.RootPath];
                var chunks     = viewLoader.Load(template.RelativePath());
                if (chunks == null)
                {
                    throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()));
                }

                return(chunks.ToList());
            }
            catch (Exception e)
            {
                if (e.Message.StartsWith("Unable to parse file"))
                {
                    throw;
                }

                throw new Exception("Unable to parse file '{0}'".ToFormat(template.RelativePath()), e);
            }
        }
Пример #5
0
 public void AddBinding(ISparkTemplate template)
 {
     _bindings.Add(template);
 }
Пример #6
0
 public static bool IsSparkView(this ISparkTemplate template)
 {
     return(Path.GetExtension(template.FilePath).EqualsIgnoreCase(Constants.DotSpark) || Path.GetExtension(template.FilePath).EqualsIgnoreCase(Constants.DotShade));
 }
Пример #7
0
 public static bool IsXml(this ISparkTemplate template)
 {
     return(Path.GetExtension(template.FilePath).EqualsIgnoreCase(".xml"));
 }