Skip to content

Commit

Permalink
convert back quot/apos entities
Browse files Browse the repository at this point in the history
  • Loading branch information
geminorum committed Jan 1, 2019
1 parent 163d8dd commit 801a792
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/virastar.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@

// replace English quotes with their Persian equivalent
if (opts.fix_english_quotes) {
text = text.replace(/"/g, '"');
text = text.replace(/'/g, '\'');
text = text.replace(/(["'`]+)(.+?)(\1)/g, '«$2»');
}

Expand Down
5 changes: 5 additions & 0 deletions test/virastar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@ describe('Virastar.js', function () {
'– که در واقع پدرخوانده‌ام بود ولی من او را جای پدرم می‌دانستم –'
);
});

it('should converts back html named character references', function () {
assert.strictEqual(virastar.cleanup('"گيومه های فارسي"'), '«گیومه‌های فارسی»');
assert.strictEqual(virastar.cleanup(''گيومه های فارسي''), '«گیومه‌های فارسی»');
});
});
});

0 comments on commit 801a792

Please sign in to comment.