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

Chore: update blogpost template #12154

Merged
merged 1 commit into from Aug 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/blogpost.md.ejs
Expand Up @@ -14,7 +14,7 @@ const RULE_REGEX = new RegExp(`\`?\\b(${ruleList.join("|")})\\b\`?`, "g");

function linkify(line) {
return line
.replace(/#(\d+)/g, "[#$1](https://github.com/eslint/eslint/issues/$1)")
.replace(/([^\s/]+[/][^\s/]+)?#(\d+)/g, (_, repo, num) => `[${repo || ""}#${num}](https://github.com/${repo || "eslint/eslint"}/issues/${num})`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it's tough to read those RegExp. Since the first group is optional, wouldn't repo variable contain ticket number if repo is not present?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, repo will be undefined if repo is not present.

.replace(RULE_REGEX, "[$&](/docs/rules/$1)");
}

Expand Down