コード例 #1
0
        public void HighlightGenerator_ReturnsHighlightCommand()
        {
            // Given
            var generator = new HighlightPandocCommandOptionsGenerator(new PandocCommandGenerator(), "style.theme");

            // When
            var command = generator.GetCommand("test.md");

            // Then
            Assert.Equal("-f markdown \"test.md\" --highlight-style \"style.theme\"", command);
        }
コード例 #2
0
ファイル: PandocCli.cs プロジェクト: Ombrelin/pandoc-gui
        public IPandocCommandGenerator BuildGenerator(PandocParameters parameters)
        {
            Log.Information($"Building generator with parameters : {parameters}");
            var validationResult = new PandocParametersValidator().Validate(parameters);

            if (!validationResult.IsValid)
            {
                Log.Error("Invalid Parameters !");
                throw new ArgumentException("Invalid parameters");
            }

            IPandocCommandGenerator generator = new PandocCommandGenerator();

            if (parameters.HighlightTheme)
            {
                generator = new HighlightPandocCommandOptionsGenerator(generator, parameters.HighlightThemeSource);
            }

            if (parameters.NumberedHeader)
            {
                generator = new NumberedHeaderPandocCommandOptionsGenerator(generator);
            }

            if (parameters.CustomFont)
            {
                generator = new FontPandocCommandGenerator(generator, parameters.CustomFontName);
            }

            generator = new GeometryPandocCommandGenerator(generator, "a4paper");

            if (parameters.CustomMargin)
            {
                generator = new MarginPandocCommandGenerator(generator, parameters.CustomMarginValue);
            }

            if (parameters.CustomPdfEngine)
            {
                generator = new PdfEnginePandocCommandGenerator(generator, parameters.CustomPdfEngineValue);
            }

            if (parameters.TableOfContents)
            {
                generator = new ContentTablePandocCommandGenerator(generator);
            }

            if (parameters.LogToFile)
            {
                generator = new LogsFileCommandGenerator(generator, parameters.LogFilePath);
            }

            return(generator);
        }