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

mlange-42 / modo / 12978042620

26 Jan 2025 08:23PM CUT coverage: 65.241% (+3.1%) from 62.103%
12978042620

Pull #123

github

web-flow
Merge 32c19e408 into 39fbafe7b
Pull Request #123: Unit tests for formatter

19 of 26 new or added lines in 5 files covered. (73.08%)

1 existing line in 1 file now uncovered.

1098 of 1683 relevant lines covered (65.24%)

30.99 hits per line

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

59.26
/format/hugo.go
1
package format
2

3
import (
4
        "fmt"
5
        "path"
6
        "strings"
7

8
        "github.com/mlange-42/modo/document"
9
)
10

11
type Hugo struct{}
12

13
func (f *Hugo) Accepts(files []string) error {
×
14
        return nil
×
15
}
×
16

17
func (f *Hugo) Render(docs *document.Docs, config *document.Config, subdir string) error {
×
18
        return document.Render(docs, config, f, subdir)
×
19
}
×
20

21
func (f *Hugo) ProcessMarkdown(element any, text string, proc *document.Processor) (string, error) {
1✔
22
        b := strings.Builder{}
1✔
23
        err := proc.Template.ExecuteTemplate(&b, "hugo_front_matter.md", element)
1✔
24
        if err != nil {
1✔
25
                return "", err
×
26
        }
×
27
        b.WriteRune('\n')
1✔
28
        b.WriteString(text)
1✔
29
        return b.String(), nil
1✔
30
}
31

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

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

43
func (f *Hugo) ToLinkPath(p string, kind string) string {
3✔
44
        p = f.ToFilePath(p, kind)
3✔
45
        return fmt.Sprintf("{{< ref \"%s\" >}}", p)
3✔
46
}
3✔
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