You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
922 B

9 years ago
9 years ago
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2020 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package models
  6. import (
  7. "path/filepath"
  8. "strings"
  9. "github.com/unknwon/com"
  10. )
  11. // WikiCloneLink returns clone URLs of repository wiki.
  12. func (repo *Repository) WikiCloneLink() *CloneLink {
  13. return repo.cloneLink(true)
  14. }
  15. // WikiPath returns wiki data path by given user and repository name.
  16. func WikiPath(userName, repoName string) string {
  17. return filepath.Join(UserPath(userName), strings.ToLower(repoName)+".wiki.git")
  18. }
  19. // WikiPath returns wiki data path for given repository.
  20. func (repo *Repository) WikiPath() string {
  21. return WikiPath(repo.OwnerName, repo.Name)
  22. }
  23. // HasWiki returns true if repository has wiki.
  24. func (repo *Repository) HasWiki() bool {
  25. return com.IsDir(repo.WikiPath())
  26. }