AllTopicsInOrder() public method

public AllTopicsInOrder ( ) : IEnumerable
return IEnumerable
Ejemplo n.º 1
0
        public void ExportTo(string directory, Topic root, Func<Topic, string> pathing)
        {
            var fileSystem = new FileSystem();

            string sourceContent = _settings.Root.AppendPath("content");
            if (fileSystem.DirectoryExists(sourceContent))
            {
                fileSystem.CopyToDirectory(sourceContent, directory.AppendPath("content"));
            }

            root.AllTopicsInOrder().Each(topic =>
            {
                var path = pathing(topic);
                var parentDirectory = path.ParentUrl();

                if (parentDirectory.IsNotEmpty())
                {
                    fileSystem.CreateDirectory(directory.AppendPath(parentDirectory));
                }
                

                var text = _generator.Generate(topic);

                // Hoakum
                topic.Substitutions.Each((key, value) =>
                {
                    text = text.Replace(key, value);
                });

                fileSystem.WriteStringToFile(directory.AppendPath(path), text);
            });
        }
Ejemplo n.º 2
0
        public void ReadTopics()
        {
            Topic = TopicLoader.LoadDirectory(_settings.Root);

            Topic.ParseAndOrder().Wait();

            _topicByUrl.ClearAll();
            Topic.AllTopicsInOrder().Each(x => _topicByUrl[x.Url] = x);
        }