| 
7 | 7 | 	"context"  | 
8 | 8 | 	"fmt"  | 
9 | 9 | 	"html/template"  | 
 | 10 | +	"maps"  | 
10 | 11 | 	"net"  | 
11 | 12 | 	"net/url"  | 
12 | 13 | 	"path/filepath"  | 
@@ -165,10 +166,10 @@ type Repository struct {  | 
165 | 166 | 
 
  | 
166 | 167 | 	Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0"`  | 
167 | 168 | 
 
  | 
168 |  | -	RenderingMetas         map[string]string `xorm:"-"`  | 
169 |  | -	DocumentRenderingMetas map[string]string `xorm:"-"`  | 
170 |  | -	Units                  []*RepoUnit       `xorm:"-"`  | 
171 |  | -	PrimaryLanguage        *LanguageStat     `xorm:"-"`  | 
 | 169 | +	commonRenderingMetas map[string]string `xorm:"-"`  | 
 | 170 | + | 
 | 171 | +	Units           []*RepoUnit   `xorm:"-"`  | 
 | 172 | +	PrimaryLanguage *LanguageStat `xorm:"-"`  | 
172 | 173 | 
 
  | 
173 | 174 | 	IsFork                          bool               `xorm:"INDEX NOT NULL DEFAULT false"`  | 
174 | 175 | 	ForkID                          int64              `xorm:"INDEX"`  | 
@@ -473,9 +474,8 @@ func (repo *Repository) MustOwner(ctx context.Context) *user_model.User {  | 
473 | 474 | 	return repo.Owner  | 
474 | 475 | }  | 
475 | 476 | 
 
  | 
476 |  | -// ComposeMetas composes a map of metas for properly rendering issue links and external issue trackers.  | 
477 |  | -func (repo *Repository) ComposeMetas(ctx context.Context) map[string]string {  | 
478 |  | -	if len(repo.RenderingMetas) == 0 {  | 
 | 477 | +func (repo *Repository) composeCommonMetas(ctx context.Context) map[string]string {  | 
 | 478 | +	if len(repo.commonRenderingMetas) == 0 {  | 
479 | 479 | 		metas := map[string]string{  | 
480 | 480 | 			"user": repo.OwnerName,  | 
481 | 481 | 			"repo": repo.Name,  | 
@@ -508,21 +508,34 @@ func (repo *Repository) ComposeMetas(ctx context.Context) map[string]string {  | 
508 | 508 | 			metas["org"] = strings.ToLower(repo.OwnerName)  | 
509 | 509 | 		}  | 
510 | 510 | 
 
  | 
511 |  | -		repo.RenderingMetas = metas  | 
 | 511 | +		repo.commonRenderingMetas = metas  | 
512 | 512 | 	}  | 
513 |  | -	return repo.RenderingMetas  | 
 | 513 | +	return repo.commonRenderingMetas  | 
 | 514 | +}  | 
 | 515 | + | 
 | 516 | +// ComposeMetas composes a map of metas for properly rendering comments or comment-like contents (commit message)  | 
 | 517 | +func (repo *Repository) ComposeMetas(ctx context.Context) map[string]string {  | 
 | 518 | +	metas := maps.Clone(repo.composeCommonMetas(ctx))  | 
 | 519 | +	metas["markdownLineBreakStyle"] = "comment"  | 
 | 520 | +	metas["markdownAllowShortIssuePattern"] = "true"  | 
 | 521 | +	return metas  | 
514 | 522 | }  | 
515 | 523 | 
 
  | 
516 |  | -// ComposeDocumentMetas composes a map of metas for properly rendering documents  | 
 | 524 | +// ComposeWikiMetas composes a map of metas for properly rendering wikis  | 
 | 525 | +func (repo *Repository) ComposeWikiMetas(ctx context.Context) map[string]string {  | 
 | 526 | +	// does wiki need the "teams" and "org" from common metas?  | 
 | 527 | +	metas := maps.Clone(repo.composeCommonMetas(ctx))  | 
 | 528 | +	metas["markdownLineBreakStyle"] = "document"  | 
 | 529 | +	metas["markdownAllowShortIssuePattern"] = "true"  | 
 | 530 | +	return metas  | 
 | 531 | +}  | 
 | 532 | + | 
 | 533 | +// ComposeDocumentMetas composes a map of metas for properly rendering documents (repo files)  | 
517 | 534 | func (repo *Repository) ComposeDocumentMetas(ctx context.Context) map[string]string {  | 
518 |  | -	if len(repo.DocumentRenderingMetas) == 0 {  | 
519 |  | -		metas := map[string]string{}  | 
520 |  | -		for k, v := range repo.ComposeMetas(ctx) {  | 
521 |  | -			metas[k] = v  | 
522 |  | -		}  | 
523 |  | -		repo.DocumentRenderingMetas = metas  | 
524 |  | -	}  | 
525 |  | -	return repo.DocumentRenderingMetas  | 
 | 535 | +	// does document(file) need the "teams" and "org" from common metas?  | 
 | 536 | +	metas := maps.Clone(repo.composeCommonMetas(ctx))  | 
 | 537 | +	metas["markdownLineBreakStyle"] = "document"  | 
 | 538 | +	return metas  | 
526 | 539 | }  | 
527 | 540 | 
 
  | 
528 | 541 | // GetBaseRepo populates repo.BaseRepo for a fork repository and  | 
 | 
0 commit comments