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

mlange-42 / modo / 12916744138

22 Jan 2025 08:44PM CUT coverage: 61.572%. Remained the same
12916744138

push

github

web-flow
Package for commands, extend CLI help (#100)

* move commands to package
* improve file structure
* remove commented out code
* add guide link to CLI help
* tweak user guide

987 of 1603 relevant lines covered (61.57%)

29.41 hits per line

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

0.0
/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 HugoFormatter struct{}
12

13
func (f *HugoFormatter) Render(docs *document.Docs, config *document.Config) error {
×
14
        return document.Render(docs, config, f)
×
15
}
×
16

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

28
func (f *HugoFormatter) WriteAuxiliary(p *document.Package, dir string, proc *document.Processor) error {
×
29
        return nil
×
30
}
×
31

32
func (f *HugoFormatter) ToFilePath(p string, kind string) (string, error) {
×
33
        if kind == "package" || kind == "module" {
×
34
                return path.Join(p, "_index.md"), nil
×
35
        }
×
36
        return p + ".md", nil
×
37
}
38

39
func (f *HugoFormatter) ToLinkPath(p string, kind string) (string, error) {
×
40
        p, err := f.ToFilePath(p, kind)
×
41
        if err != nil {
×
42
                return "", err
×
43
        }
×
44
        return fmt.Sprintf("{{< ref \"%s\" >}}", p), nil
×
45
}
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