mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
unify name of ChangesetShortLink and export regex
This commit is contained in:
@@ -32,7 +32,7 @@ import MarkdownHeadingRenderer from "./MarkdownHeadingRenderer";
|
|||||||
import { create } from "./MarkdownLinkRenderer";
|
import { create } from "./MarkdownLinkRenderer";
|
||||||
import {useTranslation, WithTranslation, withTranslation} from "react-i18next";
|
import {useTranslation, WithTranslation, withTranslation} from "react-i18next";
|
||||||
import Notification from "./Notification";
|
import Notification from "./Notification";
|
||||||
import { createTransformer } from "./remarkCommitLinksParser";
|
import { createTransformer } from "./remarkChangesetShortLinkParser";
|
||||||
|
|
||||||
type Props = RouteComponentProps & WithTranslation & {
|
type Props = RouteComponentProps & WithTranslation & {
|
||||||
content: string;
|
content: string;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { regExpPattern } from "./remarkCommitLinksParser";
|
import { regExpPattern } from "./remarkChangesetShortLinkParser";
|
||||||
|
|
||||||
describe("Remark Commit Links RegEx Tests", () => {
|
describe("Remark Commit Links RegEx Tests", () => {
|
||||||
it("should match simple names", () => {
|
it("should match simple names", () => {
|
||||||
@@ -30,7 +30,6 @@ import { TFunction } from "i18next";
|
|||||||
|
|
||||||
const namePartRegex = nameRegex.source.substring(1, nameRegex.source.length - 1);
|
const namePartRegex = nameRegex.source.substring(1, nameRegex.source.length - 1);
|
||||||
|
|
||||||
// Visible for testing
|
|
||||||
export const regExpPattern = `(${namePartRegex})\\/(${namePartRegex})@([\\w\\d]+)`;
|
export const regExpPattern = `(${namePartRegex})\\/(${namePartRegex})@([\\w\\d]+)`;
|
||||||
|
|
||||||
function match(value: string): RegExpMatchArray[] {
|
function match(value: string): RegExpMatchArray[] {
|
||||||
@@ -45,7 +44,6 @@ function match(value: string): RegExpMatchArray[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const createTransformer = (t: TFunction): MdastPlugin => {
|
export const createTransformer = (t: TFunction): MdastPlugin => {
|
||||||
|
|
||||||
return (tree: MarkdownAbstractSyntaxTree) => {
|
return (tree: MarkdownAbstractSyntaxTree) => {
|
||||||
visit(tree, "text", (node: MarkdownAbstractSyntaxTree, index: number, parent: MarkdownAbstractSyntaxTree) => {
|
visit(tree, "text", (node: MarkdownAbstractSyntaxTree, index: number, parent: MarkdownAbstractSyntaxTree) => {
|
||||||
if (parent.type === "link" || !node.value) {
|
if (parent.type === "link" || !node.value) {
|
||||||
Reference in New Issue
Block a user