@@ -16,7 +16,7 @@ function LineSplitter(){
1616this . writable = true ;
1717
1818this . write = function ( data ) {
19- var lines = ( buffer + data ) . split ( / \r \n | \n \r | \n | \r / ) ;
19+ const lines = ( buffer + data ) . split ( / \r \n | \n \r | \n | \r / ) ;
2020for ( var i = 0 ; i < lines . length - 1 ; i ++ ) {
2121self . emit ( 'data' , lines [ i ] ) ;
2222}
@@ -128,18 +128,18 @@ function ParagraphParser(){
128128}
129129
130130// Find out indentation level and the start of a lied or numbered list;
131- var result = / ^ ( \s * ) ( \d + \. | \* | - ) ? \s * / . exec ( line ) ;
131+ const result = / ^ ( \s * ) ( \d + \. | \* | - ) ? \s * / . exec ( line ) ;
132132assert . ok ( result ) ;
133133// The number of characters that will be stripped from the beginning of
134134// the line.
135- var line_strip_length = result [ 0 ] . length ;
135+ const line_strip_length = result [ 0 ] . length ;
136136// The indentation size that will be used to detect indentation jumps.
137137// Fudge by 1 space.
138- var line_indent = Math . floor ( result [ 0 ] . length / 2 ) * 2 ;
138+ const line_indent = Math . floor ( line_strip_length / 2 ) * 2 ;
139139// The indentation level that will be exported
140- var level = Math . floor ( result [ 1 ] . length / 2 ) ;
140+ const level = Math . floor ( result [ 1 ] . length / 2 ) ;
141141// The list indicator that precedes the actual content, if any.
142- var line_li = result [ 2 ] ;
142+ const line_li = result [ 2 ] ;
143143
144144// Flush the paragraph when there is a li or an indentation jump
145145if ( line_li || ( line_indent !== paragraph_line_indent &&
@@ -175,14 +175,14 @@ inherits(ParagraphParser, Stream);
175175 * replaces multiple consecutive whitespace characters by a single one.
176176 */
177177function Unwrapper ( ) {
178- var self = this ;
178+ const self = this ;
179179
180180Stream . call ( this ) ;
181181this . writable = true ;
182182
183183this . write = function ( paragraph ) {
184- var lines = paragraph . lines ;
185- var break_after = [ ] ;
184+ const lines = paragraph . lines ;
185+ const break_after = [ ] ;
186186var i ;
187187
188188for ( i = 0 ; i < lines . length - 1 ; i ++ ) {
@@ -236,15 +236,14 @@ function RtfGenerator(){
236236Stream . call ( this ) ;
237237this . writable = true ;
238238
239- this . write = function ( paragraph ) {
239+ this . write = function ( { li , level , lines , in_license_block : lic } ) {
240240if ( ! did_write_anything ) {
241241emitHeader ( ) ;
242242did_write_anything = true ;
243243}
244244
245- var li = paragraph . li ;
246- var level = paragraph . level + ( li ? 1 : 0 ) ;
247- var lic = paragraph . in_license_block ;
245+ if ( li )
246+ level ++ ;
248247
249248var rtf = '\\pard' ;
250249rtf += '\\sa150\\sl300\\slmult1' ;
@@ -261,7 +260,7 @@ function RtfGenerator(){
261260if ( li )
262261rtf += ' ' + li + '\\tab' ;
263262rtf += ' ' ;
264- rtf += paragraph . lines . map ( rtfEscape ) . join ( '\\line ' ) ;
263+ rtf += lines . map ( rtfEscape ) . join ( '\\line ' ) ;
265264if ( ! lic )
266265rtf += '\\b0' ;
267266rtf += '\\par\n' ;
0 commit comments