Support bold, italic and underline in SRT
This commit is contained in:
parent
5394596317
commit
d735259a6d
@ -30,7 +30,6 @@ premium subscription!**
|
|||||||
### Pending Implementation
|
### Pending Implementation
|
||||||
|
|
||||||
* Detect and write the appropriate video extension (instead of hard-code mp4).
|
* Detect and write the appropriate video extension (instead of hard-code mp4).
|
||||||
* Improve SRT support for i, b and u.
|
|
||||||
* Add ASS support.
|
* Add ASS support.
|
||||||
* Add muxing (MP4+ASS=MKV).
|
* Add muxing (MP4+ASS=MKV).
|
||||||
* Add series API to download an entire series rather than per-episode.
|
* Add series API to download an entire series rather than per-episode.
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
var xml2js = require('xml2js');
|
var xml2js = require('xml2js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an input buffer to a SRT subtitle.
|
* Converts an input buffer to a SubRip subtitle.
|
||||||
* @param {Buffer|string} input
|
* @param {Buffer|string} input
|
||||||
* @param {function(Error, string=)} done
|
* @param {function(Error, string=)} done
|
||||||
*/
|
*/
|
||||||
@ -62,7 +62,12 @@ function _suffix(value, length) {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function _text(text) {
|
function _text(text) {
|
||||||
return text.replace(/{[^}]+}/g, '').replace(/\\n/ig, '\n');
|
return text
|
||||||
|
.replace(/{\\i1}(.+){\\i0}/g, '<i>$1</i>')
|
||||||
|
.replace(/{\\b1}(.+){\\b0}/g, '<b>$1</b>')
|
||||||
|
.replace(/{\\u1}(.+){\\u0}/g, '<u>$1</u>')
|
||||||
|
.replace(/{[^}]+}/g, '')
|
||||||
|
.replace(/\\n(\s+)?/ig, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user