unify name of ChangesetShortLink and export regex

This commit is contained in:
Sebastian Sdorra
2020-07-02 11:29:17 +02:00
parent e8eaaf486f
commit 3a393f6238
3 changed files with 2 additions and 4 deletions

View File

@@ -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;

View File

@@ -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", () => {

View File

@@ -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) {