diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4da5ffa..6413fbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,8 @@ jobs: - name: Install external renderers run: | sudo apt-get update - sudo apt-get install -y asciidoctor python3-docutils perl + sudo apt-get install -y asciidoctor python3-docutils perl ruby + rdoc --version - name: Build run: go build -v ./... diff --git a/README.md b/README.md index 8cfe6ac..f726e7c 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The default registry comes with all supported formats pre-configured. Native for | Textile | .textile | consumer-provided (external) | | MediaWiki | .mediawiki, .wiki | consumer-provided (external) | | Creole | .creole | consumer-provided (external) | -| RDoc | .rdoc | consumer-provided (external) | +| RDoc | .rdoc | rdoc (external) | ## Format detection @@ -85,6 +85,7 @@ The native formats (Markdown, Org-mode) need no external tools. For the others: | asciidoctor | `gem install asciidoctor` | AsciiDoc | | rst2html | `pip install docutils` or `apt install python3-docutils` | reStructuredText | | pod2html | Included with Perl | Pod | +| rdoc | Included with Ruby | RDoc | ## Benchmarks diff --git a/markup.go b/markup.go index 9cd7532..b70f1b0 100644 --- a/markup.go +++ b/markup.go @@ -157,6 +157,7 @@ func NewDefaultRegistry() *Registry { r.Register(FormatRDoc, NewExternalRenderer(ExternalConfig{ Command: "rdoc", + Args: []string{"--pipe"}, }), ".rdoc") return r diff --git a/markup_test.go b/markup_test.go index 011d008..ec9ad69 100644 --- a/markup_test.go +++ b/markup_test.go @@ -586,6 +586,7 @@ func TestRenderRDoc(t *testing.T) { t.Skip("rdoc renderer not installed") } content := readTestdata(t, "README.rdoc") + t.Chdir(t.TempDir()) result, err := r.Render("README.rdoc", content) if err != nil { t.Fatalf("unexpected error: %v", err) @@ -593,6 +594,18 @@ func TestRenderRDoc(t *testing.T) { if result.Format != FormatRDoc { t.Errorf("Format = %v, want FormatRDoc", result.Format) } + for _, want := range []string{"
One
", `absolute link`, `relative link`} { + if !strings.Contains(result.HTML, want) { + t.Errorf("expected %q in HTML, got: %s", want, result.HTML) + } + } + entries, err := os.ReadDir(".") + if err != nil { + t.Fatal(err) + } + if len(entries) != 0 { + t.Errorf("renderer created files: %v", entries) + } } // --- Input size limit ---