Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] provide OwnerName field for README template #10356

Closed

Conversation

everhopingandwaiting
Copy link
Contributor

Provide more information to readme template

@everhopingandwaiting
Copy link
Contributor Author

found the Expand function just replace the reg string

 func Expand(template string, match map[string]string, subs ...string) string {
	var p []byte
	var i int
	for {
		i = strings.Index(template, "{")
		if i < 0 {
			break
		}
		p = append(p, template[:i]...)
		template = template[i+1:]
		i = strings.Index(template, "}")
		if s, ok := match[template[:i]]; ok {
			p = append(p, s...)
		} else {
			j, _ := strconv.Atoi(template[:i])
			if j >= len(subs) {
				p = append(p, []byte("Missing")...)
			} else {
				p = append(p, subs[j]...)
			}
		}
		template = template[i+1:]
	}
	p = append(p, template...)
	return string(p)
}

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 19, 2020
@jolheiser
Copy link
Member

Have you considered a template repository for your use-case?
(Not blocking this PR, just wondering if it would maybe suit your need better)

@everhopingandwaiting
Copy link
Contributor Author

everhopingandwaiting commented Feb 19, 2020

@jolheiser

I want to custom define the README template , also need some extra model values

such as :

# {Name}

[![Build Status](http:https://120./api/badges/{OwnerName}/status.svg)](http:https://120.0/{OwnerName})

{Description}

{CloneURL.SSH}

{CloneURL.HTTPS}
{CloneURL}

{OwnerName} {Owner} {OwnerID}

{{ CloneURL.HTTPS substr ?? }}

@jolheiser jolheiser added the type/enhancement An improvement of existing functionality label Feb 19, 2020
@jolheiser jolheiser added this to the 1.12.0 milestone Feb 19, 2020
@jolheiser
Copy link
Member

Sure, fair enough. Just need to fix up CI gripes, then. 🙂

@everhopingandwaiting everhopingandwaiting changed the title [feature] provide OwnerName field for reame template [feature] provide OwnerName field for README template Feb 19, 2020
modules/repository/init.go Outdated Show resolved Hide resolved
@6543
Copy link
Member

6543 commented Apr 6, 2020

@everhopingandwaiting something went wrong while you have tryed to rebase: now patches for #10951 are included :/

@6543
Copy link
Member

6543 commented Apr 6, 2020

@everhopingandwaiting reason to close this?

@everhopingandwaiting
Copy link
Contributor Author

@everhopingandwaiting reason to close this?

I want to undo commit in #10951, because the in my master branch include two unmerged features , will pr again later

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants