diff --git a/src/lib/default-transformer.js b/src/lib/default-transformer.js index 8b25fe6..deab03d 100644 --- a/src/lib/default-transformer.js +++ b/src/lib/default-transformer.js @@ -20,9 +20,9 @@ export default function(input, {project, baseURI}) { // subjects in a specific project : @owner-slug/project-slug^subject_id // \b[\w-]+\b is hyphen boundary for slugs - .replace(/@(\b[\w-]+\b)\/(\b[\w-]+\b)\^([0-9]+)/g, `$1/$2 - Subject $3`) + .replace(/@(\b[\w-]+\b)\/(\b[\w-]+\b)\^S([0-9]+)/g, `$1/$2 - Subject $3`) - .replace(/\^([0-9]+)/g, function(_, subjectID) { + .replace(/\^S([0-9]+)/g, function(_, subjectID) { if (owner && name) { return `${owner}/${name} - Subject ${subjectID}`; } diff --git a/test/lib/default-transformer-test.js b/test/lib/default-transformer-test.js index 2fdb58a..32ce411 100644 --- a/test/lib/default-transformer-test.js +++ b/test/lib/default-transformer-test.js @@ -25,19 +25,19 @@ describe('default-transformer', () => { expect(htmlTagLink).to.equal(`

#good \n https://www.zooniverse.org/#/talk/17/1403?page=1&comment=3063

`); }); - it('replaces ^subject mentions with subject links', () =>{ + it('replaces ^S mentions with subject links', () =>{ project = { slug: "test/project" }; - var subjectLink = replaceSymbols('^123456', {project, baseURI});; + var subjectLink = replaceSymbols('^S123456', {project, baseURI});; expect(subjectLink).to.equal('test/project - Subject 123456'); }); it('does not format subject Ids when not in a routed context', () =>{ - var subjectLink = replaceSymbols('^123456', {project, baseURI}); + var subjectLink = replaceSymbols('^S123456', {project, baseURI}); expect(subjectLink).to.equal("123456"); }); - it('replaces @ownerslug/project-slug^subject_id mentions with links', () => { - var projectSubjectLink = replaceSymbols('@owner/project-d^123456', {project, baseURI}); + it('replaces @ownerslug/project-slug^S mentions with links', () => { + var projectSubjectLink = replaceSymbols('@owner/project-d^S123456', {project, baseURI}); expect(projectSubjectLink).to.equal('owner/project-d - Subject 123456'); });