• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / modo / 13179358125

06 Feb 2025 01:00PM CUT coverage: 74.08% (+2.0%) from 72.118%
13179358125

push

github

web-flow
More unit tests, utilities package (#211)

31 of 37 new or added lines in 6 files covered. (83.78%)

1772 of 2392 relevant lines covered (74.08%)

27.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.81
/internal/format/plain.go
1
package format
2

3
import (
4
        "fmt"
5
        "os"
6
        "path"
7
        "text/template"
8

9
        "github.com/mlange-42/modo/internal/document"
10
        "github.com/mlange-42/modo/internal/util"
11
)
12

13
const landingPageContentPlain = `# Landing page
14

15
JSON created by mojo doc should be placed next to this file.
16

17
Additional documentation files go here, too.
18
They will be processed for doc-tests and copied to folder 'site'.
19
`
20

21
type Plain struct{}
22

23
func (f *Plain) Accepts(files []string) error {
×
24
        return nil
×
25
}
×
26

27
func (f *Plain) ProcessMarkdown(element any, text string, proc *document.Processor) (string, error) {
×
28
        return text, nil
×
29
}
×
30

31
func (f *Plain) WriteAuxiliary(p *document.Package, dir string, proc *document.Processor) error {
×
32
        return nil
×
33
}
×
34

35
func (f *Plain) ToFilePath(p string, kind string) string {
6✔
36
        if kind == "package" || kind == "module" {
10✔
37
                return path.Join(p, "_index.md")
4✔
38
        }
4✔
39
        if len(p) == 0 {
2✔
40
                return p
×
41
        }
×
42
        return p + ".md"
2✔
43
}
44

45
func (f *Plain) ToLinkPath(p string, kind string) string {
3✔
46
        return f.ToFilePath(p, kind)
3✔
47
}
3✔
48

49
func (f *Plain) Input(in string, sources []document.PackageSource) string {
1✔
50
        return in
1✔
51
}
1✔
52

53
func (f *Plain) Output(out string) string {
1✔
54
        return out
1✔
55
}
1✔
56

57
func (f *Plain) GitIgnore(in, out string, sources []document.PackageSource) []string {
1✔
58
        return []string{
1✔
59
                "# files generated by 'mojo doc'",
1✔
60
                fmt.Sprintf("/%s/*.json", in),
1✔
61
                "# files generated by Modo",
1✔
62
                fmt.Sprintf("/%s/", out),
1✔
63
                "# test file generated by Modo",
1✔
64
                "/test/",
1✔
65
        }
1✔
66
}
1✔
67

68
func (f *Plain) CreateDirs(base, in, out string, sources []document.PackageSource, _ *template.Template) error {
1✔
69
        inDir, outDir := path.Join(base, in), path.Join(base, out)
1✔
70
        testDir := path.Join(base, "test")
1✔
71
        if err := util.MkDirs(inDir); err != nil {
1✔
72
                return err
×
73
        }
×
74
        if err := os.WriteFile(path.Join(inDir, "_index.md"), []byte(landingPageContentPlain), 0644); err != nil {
1✔
75
                return err
×
76
        }
×
77
        if err := util.MkDirs(outDir); err != nil {
1✔
78
                return err
×
79
        }
×
80
        return util.MkDirs(testDir)
1✔
81
}
82

83
func (f *Plain) Clean(out, tests string) error {
1✔
84
        if err := emptyDir(out); err != nil {
1✔
85
                return err
×
86
        }
×
87
        return emptyDir(tests)
1✔
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc