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

Change order that PostProcess Processors are run #6445

Merged
merged 2 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions modules/markup/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ func (p *postProcessError) Error() string {
type processor func(ctx *postProcessCtx, node *html.Node)

var defaultProcessors = []processor{
mentionProcessor,
shortLinkProcessor,
fullIssuePatternProcessor,
fullSha1PatternProcessor,
shortLinkProcessor,
linkProcessor,
mentionProcessor,
issueIndexPatternProcessor,
crossReferenceIssueIndexPatternProcessor,
fullSha1PatternProcessor,
sha1CurrentPatternProcessor,
emailAddressProcessor,
linkProcessor,
}

type postProcessCtx struct {
Expand Down Expand Up @@ -194,14 +194,14 @@ func PostProcess(
}

var commitMessageProcessors = []processor{
mentionProcessor,
fullIssuePatternProcessor,
fullSha1PatternProcessor,
linkProcessor,
mentionProcessor,
issueIndexPatternProcessor,
crossReferenceIssueIndexPatternProcessor,
fullSha1PatternProcessor,
sha1CurrentPatternProcessor,
emailAddressProcessor,
linkProcessor,
}

// RenderCommitMessage will use the same logic as PostProcess, but will disable
Expand Down
6 changes: 6 additions & 0 deletions modules/markup/html_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ func TestRender_links(t *testing.T) {
test(
"https://foo_bar.example.com/",
`<p><a href="https://foo_bar.example.com/" rel="nofollow">https://foo_bar.example.com/</a></p>`)
test(
"https://stackoverflow.com/questions/2896191/what-is-go-used-fore",
`<p><a href="https://stackoverflow.com/questions/2896191/what-is-go-used-fore" rel="nofollow">https://stackoverflow.com/questions/2896191/what-is-go-used-fore</a></p>`)
test(
"https://username:password@gitea.com",
`<p><a href="https://username:password@gitea.com" rel="nofollow">https://username:password@gitea.com</a></p>`)

// Test that should *not* be turned into URL
test(
Expand Down