You could improve the following formatting logic :
|
html = _.trim(html.text()); |
|
html = html.replace(/\r\n\n/g, '\n'); |
|
html = html.replace(/\t/g, ''); |
|
html = html.replace(/\n\r\n/g, '\n'); |
|
html = html.replace(/ +/g, ' '); |
|
html = html.replace(/\n /g, '\n'); |
With :
html = html.text()
.replace(/\r\n/g, '\n') // windows to linux new line style
.replace(/\t/g, '') // no tabs
.replace(/ +/g, ' ') // whitespaces
.split('\n').map(line => line.trim()).join('\n') // trim every line
.replace(/\n{3,}/g, '\n\n'); // no more than two new lines in a row
This would fix the formatting issues seen on lyrics.ovh.
You could improve the following formatting logic :
alltomp3/index.js
Lines 75 to 80 in 7129f17
With :
This would fix the formatting issues seen on lyrics.ovh.