Exemplo n.º 1
0
 static Program()
 {
     PegCombinator.Parser.Debugging = false;
     Parser   = new MarkdownToHtml("\n");
     Timing   = new Stopwatch();
     Pipeline = new MarkdownPipelineBuilder().Build();
 }
        public void SetUp()
        {
            this.RootAppData            = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RHEA_Group");
            this.PathDocumentationIndex = Path.Combine(TestContext.CurrentContext.TestDirectory, @"Documentation\book.json");
            this.markdownToHtml         = new MarkdownToHtml(this.RootAppData);
            this.PathMarkdownTestFile   = this.markdownToHtml.CreateAbsolutePathFile(this.PathDocumentationIndex, "Test.md");

            var bookFileHandler = new BookFileHandler();

            this.book = bookFileHandler.DeserializeJsonBook(this.PathDocumentationIndex);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update the view model from  the new Documentation directory.
        /// </summary>
        public void ReactOnPathDocumentationIndexChange()
        {
            if (this.IsDocumentationLoaded)
            {
                return;
            }

            if (!File.Exists(this.PathDocumentationIndex))
            {
                throw new FileNotFoundException(string.Format("Could not find the index file at the path : '{0}'", this.pathDocumentationIndex));
            }

            this.FirstsRowSections.Clear();
            this.markdownToHtml = new MarkdownToHtml(this.RootAppData);

            var bookFileHandler = new BookFileHandler();

            this.Book = bookFileHandler.DeserializeJsonBook(this.PathDocumentationIndex);

            if (this.UpdateIndexation)
            {
                this.markdownToHtml.TransformTheWholeDocumentationIntoHtml(this.Book, this.PathDocumentationIndex);
            }

            this.DocumentationSearches = new DocumentationSearches(this.PathDocumentationIndex, this.RootAppData, this.Book, this.UpdateIndexation);

            this.BookTitle = this.Book.Title ?? "Table of Contents";

            if (this.Book.Sections.Count >= 1)
            {
                foreach (var section in this.Book.Sections)
                {
                    var sectionViewModel = new SectionRowViewModel(section, null);
                    this.FirstsRowSections.Add(sectionViewModel);
                }
            }

            this.WhenAnyValue(vm => vm.SelectedSection).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ => this.ReactOnSelectionChange());

            this.LoadBookMainPage();
            this.IsDocumentationLoaded = true;

            this.WhenAnyValue(vm => vm.SearchText)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => this.ReactOnSearchTextChange());

            this.WhenAnyValue(vm => vm.SuggestedPageSelected)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => this.ReactOnSuggestedPageSelected());
        }
Exemplo n.º 4
0
        public void GenerateSite(Configuration configuration, FilesystemRepository filesystemRepository)
        {
            var contentGenerator     = new ContentGenerator();
            var extractor            = new TagsExtractor(filesystemRepository);
            var htmlTransformer      = new MarkdownToHtml();
            var expandTagsToMarkdown = new ExpandTagsToMarkdown(filesystemRepository);
            var readMdAndWriteHtml   = new ReadMdAndWriteHtml(filesystemRepository, contentGenerator, htmlTransformer, expandTagsToMarkdown);

            var siteGenerator = new SiteGenerator(
                contentGenerator,
                filesystemRepository,
                extractor,
                readMdAndWriteHtml,
                htmlTransformer);

            siteGenerator.Execute(configuration, baseUrl, editBaseUrl);
        }
Exemplo n.º 5
0
 static TestBase()
 {
     Parser = new MarkdownToHtml("\n");
 }