From b252b23f1659c2a81c252d7d9a7e0aef2aac91fb Mon Sep 17 00:00:00 2001 From: "j.yao.SUSE" Date: Tue, 7 Apr 2020 09:40:38 +0800 Subject: [PATCH] [feature] provide `OwnerName` field for README template (#10981) Co-Authored-By: 6543 <6543@obermui.de> Co-authored-by: techknowlogick --- docs/content/doc/advanced/customizing-gitea.en-us.md | 2 +- modules/repository/init.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md index f0ddc4698b..2c06de67b5 100644 --- a/docs/content/doc/advanced/customizing-gitea.en-us.md +++ b/docs/content/doc/advanced/customizing-gitea.en-us.md @@ -236,7 +236,7 @@ Locales may change between versions, so keeping track of your customized locales To add a custom Readme, add a markdown formatted file (without an `.md` extension) to `custom/options/readme` **NOTE:** readme templates support **variable expansion**. -currently there are `{Name}` (name of repository), `{Description}`, `{CloneURL.SSH}` and `{CloneURL.HTTPS}` +currently there are `{Name}` (name of repository), `{Description}`, `{CloneURL.SSH}`, `{CloneURL.HTTPS}` and `{OwnerName}` ### Reactions diff --git a/modules/repository/init.go b/modules/repository/init.go index 320fba53fc..f468ca0435 100644 --- a/modules/repository/init.go +++ b/modules/repository/init.go @@ -55,6 +55,7 @@ func prepareRepoCommit(ctx models.DBContext, repo *models.Repository, tmpDir, re "Description": repo.Description, "CloneURL.SSH": cloneLink.SSH, "CloneURL.HTTPS": cloneLink.HTTPS, + "OwnerName": repo.OwnerName, } if err = ioutil.WriteFile(filepath.Join(tmpDir, "README.md"), []byte(com.Expand(string(data), match)), 0644); err != nil {