Refactor removal of trailing comma/period (#5434)
* Refactor removal of trailing comma/period * Use regex
This commit is contained in:
		
							parent
							
								
									e14509574d
								
							
						
					
					
						commit
						e94dd8a5e8
					
				
					 1 changed files with 1 additions and 4 deletions
				
			
		| 
						 | 
					@ -167,10 +167,7 @@ export const mfmLanguage = P.createLanguage({
 | 
				
			||||||
				url = match[0];
 | 
									url = match[0];
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			url = removeOrphanedBrackets(url);
 | 
								url = removeOrphanedBrackets(url);
 | 
				
			||||||
			while (url.endsWith('.') || url.endsWith(',')) {
 | 
								url = url.replace(/[.,]*$/, '');
 | 
				
			||||||
				if (url.endsWith('.')) url = url.substr(0, url.lastIndexOf('.'));
 | 
					 | 
				
			||||||
				if (url.endsWith(',')) url = url.substr(0, url.lastIndexOf(','));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return P.makeSuccess(i + url.length, url);
 | 
								return P.makeSuccess(i + url.length, url);
 | 
				
			||||||
		}).map(x => createLeaf('url', { url: x }));
 | 
							}).map(x => createLeaf('url', { url: x }));
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue