MFMの((()))構文が顔文字と競合する対策としてタグ形式の構文も追加
This commit is contained in:
		
							parent
							
								
									be67f5f422
								
							
						
					
					
						commit
						d0926a3ba1
					
				
					 2 changed files with 9 additions and 3 deletions
				
			
		| 
						 | 
					@ -9,7 +9,7 @@ export type TextElementMotion = {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function(text: string) {
 | 
					export default function(text: string) {
 | 
				
			||||||
	const match = text.match(/^\(\(\((.+?)\)\)\)/);
 | 
						const match = text.match(/^\(\(\((.+?)\)\)\)/) || text.match(/^<motion>(.+?)<\/motion>/);
 | 
				
			||||||
	if (!match) return null;
 | 
						if (!match) return null;
 | 
				
			||||||
	const motion = match[0];
 | 
						const motion = match[0];
 | 
				
			||||||
	return {
 | 
						return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								test/mfm.ts
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								test/mfm.ts
									
										
									
									
									
								
							| 
						 | 
					@ -40,11 +40,17 @@ describe('Text', () => {
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		it('motion', () => {
 | 
							it('motion', () => {
 | 
				
			||||||
			const tokens = analyze('(((Strawberry))) Pasta');
 | 
								const tokens1 = analyze('(((Strawberry))) Pasta');
 | 
				
			||||||
			assert.deepEqual([
 | 
								assert.deepEqual([
 | 
				
			||||||
				{ type: 'motion', content: '(((Strawberry)))', motion: 'Strawberry' },
 | 
									{ type: 'motion', content: '(((Strawberry)))', motion: 'Strawberry' },
 | 
				
			||||||
				{ type: 'text', content: ' Pasta' }
 | 
									{ type: 'text', content: ' Pasta' }
 | 
				
			||||||
			], tokens);
 | 
								], tokens1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const tokens2 = analyze('<motion>Strawberry</motion> Pasta');
 | 
				
			||||||
 | 
								assert.deepEqual([
 | 
				
			||||||
 | 
									{ type: 'motion', content: '<motion>Strawberry</motion>', motion: 'Strawberry' },
 | 
				
			||||||
 | 
									{ type: 'text', content: ' Pasta' }
 | 
				
			||||||
 | 
								], tokens2);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		it('mention', () => {
 | 
							it('mention', () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue