public void Handle(string path)
        {
            var finalPath = GetFinalPath(path);
            _io.EnsureDirectoryExists(finalPath);

            var model = new Page(Path.Combine(_configuration.SourcePath, path));
            model.LoadFile(_configuration);

            var result = TemplateManager.Current.RenderPage(path, model);

            _io.WriteFile(finalPath, result);
            Logger.Current.Log(LoggingLevel.Debug, "HTML page: {0}", path);
        }
Esempio n. 2
0
        public void Handle(string path)
        {
            var page = new Page(Path.Combine(_configuration.SourcePath, path));
            var finalPath = GetFinalPath(path);
            _io.EnsureDirectoryExists(finalPath);
            page.LoadFile(_configuration);

            var template = page.Metadata["template"] ?? "_page";

            try
            {
                page.Body = TemplateManager.Current.RenderMarkdownPage(path, template, page);
            }
            catch (InvalidOperationException exception)
            {
                if (!exception.Message.StartsWith("No template exists")) throw;

                Logger.Current.LogError("{0}\n  No template exists with name '{1}'",
                    path, template);
            }

            _io.WriteFile(finalPath, page.Body);
            Logger.Current.Log(LoggingLevel.Debug, "Markdown page: {0}", path);
        }