Skip to content

Commit ce421a7

Browse files
authored
Merge pull request #7 from git-pkgs/fix-rdoc-stdin
Render RDoc input through pipe mode
2 parents b7247b9 + 0aefc12 commit ce421a7

4 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
- name: Install external renderers
2626
run: |
2727
sudo apt-get update
28-
sudo apt-get install -y asciidoctor python3-docutils perl
28+
sudo apt-get install -y asciidoctor python3-docutils perl ruby
29+
rdoc --version
2930
3031
- name: Build
3132
run: go build -v ./...

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The default registry comes with all supported formats pre-configured. Native for
3737
| Textile | .textile | consumer-provided (external) |
3838
| MediaWiki | .mediawiki, .wiki | consumer-provided (external) |
3939
| Creole | .creole | consumer-provided (external) |
40-
| RDoc | .rdoc | consumer-provided (external) |
40+
| RDoc | .rdoc | rdoc (external) |
4141

4242
## Format detection
4343

@@ -85,6 +85,7 @@ The native formats (Markdown, Org-mode) need no external tools. For the others:
8585
| asciidoctor | `gem install asciidoctor` | AsciiDoc |
8686
| rst2html | `pip install docutils` or `apt install python3-docutils` | reStructuredText |
8787
| pod2html | Included with Perl | Pod |
88+
| rdoc | Included with Ruby | RDoc |
8889

8990
## Benchmarks
9091

‎markup.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func NewDefaultRegistry() *Registry {
157157

158158
r.Register(FormatRDoc, NewExternalRenderer(ExternalConfig{
159159
Command: "rdoc",
160+
Args: []string{"--pipe"},
160161
}), ".rdoc")
161162

162163
return r

‎markup_test.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,26 @@ func TestRenderRDoc(t *testing.T) {
586586
t.Skip("rdoc renderer not installed")
587587
}
588588
content := readTestdata(t, "README.rdoc")
589+
t.Chdir(t.TempDir())
589590
result, err := r.Render("README.rdoc", content)
590591
if err != nil {
591592
t.Fatalf("unexpected error: %v", err)
592593
}
593594
if result.Format != FormatRDoc {
594595
t.Errorf("Format = %v, want FormatRDoc", result.Format)
595596
}
597+
for _, want := range []string{"<ul>", "<li>", "<p>One</p>", `<a href="http://github.com">absolute link</a>`, `<a href="rawr.html">relative link</a>`} {
598+
if !strings.Contains(result.HTML, want) {
599+
t.Errorf("expected %q in HTML, got: %s", want, result.HTML)
600+
}
601+
}
602+
entries, err := os.ReadDir(".")
603+
if err != nil {
604+
t.Fatal(err)
605+
}
606+
if len(entries) != 0 {
607+
t.Errorf("renderer created files: %v", entries)
608+
}
596609
}
597610

598611
// --- Input size limit ---

0 commit comments

Comments
 (0)