Merge branch 'develop' into merge/2024-02-03
# Conflicts: # locales/index.d.ts # packages/backend/src/core/entities/UserEntityService.ts # packages/frontend/src/_dev_boot_.ts # packages/misskey-js/src/autogen/types.ts # sharkey-locales/en-US.yml
This commit is contained in:
commit
f36029f795
24 changed files with 512 additions and 35 deletions
|
|
@ -45,6 +45,50 @@ describe('MfmService', () => {
|
|||
const output = '<p><pre><code><p>Hello, world!</p></code></pre></p>';
|
||||
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('ruby', () => {
|
||||
const input = '$[ruby some text ignore me]';
|
||||
const output = '<p><ruby>some<rp>(</rp><rt>text</rt><rp>)</rp></ruby></p>';
|
||||
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('ruby2', () => {
|
||||
const input = '$[ruby *some text* ignore me]';
|
||||
const output = '<p><ruby><i>some text</i><rp>(</rp><rt>ignore me</rt><rp>)</rp></ruby></p>';
|
||||
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('ruby 3', () => {
|
||||
const input = '$[ruby $[group *some* text] ignore me]';
|
||||
const output = '<p><ruby><span><i>some</i> text</span><rp>(</rp><rt>ignore me</rt><rp>)</rp></ruby></p>';
|
||||
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toMastoApiHtml', () => {
|
||||
test('br', async () => {
|
||||
const input = 'foo\nbar\nbaz';
|
||||
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
||||
assert.equal(await mfmService.toMastoApiHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('br alt', async () => {
|
||||
const input = 'foo\r\nbar\rbaz';
|
||||
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
||||
assert.equal(await mfmService.toMastoApiHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('escape', async () => {
|
||||
const input = '```\n<p>Hello, world!</p>\n```';
|
||||
const output = '<p><pre><code><p>Hello, world!</p></code></pre></p>';
|
||||
assert.equal(await mfmService.toMastoApiHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('ruby', async () => {
|
||||
const input = '$[ruby $[group *some* text] ignore me]';
|
||||
const output = '<p><ruby><span><span>*some*</span><span> text</span></span><rp>(</rp><rt>ignore me</rt><rp>)</rp></ruby></p>';
|
||||
assert.equal(await mfmService.toMastoApiHtml(mfm.parse(input)), output);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fromHtml', () => {
|
||||
|
|
@ -133,5 +177,12 @@ describe('MfmService', () => {
|
|||
test('hashtag', () => {
|
||||
assert.deepStrictEqual(mfmService.fromHtml('<p>a <a href="https://example.com/tags/a">#a</a> d</p>', ['#a']), 'a #a d');
|
||||
});
|
||||
|
||||
test('ruby', () => {
|
||||
assert.deepStrictEqual(
|
||||
mfmService.fromHtml('<ruby> <i>some</i> text <rp>(</rp><rt>ignore me</rt><rp>)</rp> and <rt>more</rt></ruby>'),
|
||||
'$[ruby $[group <i>some</i> text ] ignore me] $[ruby $[group and ] more]'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue