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.

wiki.go 873B

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