routes/util.go (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
package routes import ( "fmt" "os" "path/filepath" "strings" "git.icyphox.sh/legit/git" ) func isGoModule(gr *git.GitRepo) bool { _, err := gr.FileContent("go.mod", false) return err == nil } func getDescription(path string) (desc string) { db, err := os.ReadFile(filepath.Join(path, "description")) if err == nil { desc = string(db) } else { desc = "" } return } func transformRelativeURLs(html, repoName, mainBranch string) string { return strings.ReplaceAll( html, "=\"./", fmt.Sprintf("=\"/%s/raw/%s/", repoName, mainBranch)) } func (d *deps) isIgnored(name string) bool { for _, i := range d.c.Repo.Ignore { if name == i { return true } } return false } |