mazira / rtf-stream-parser

Contains native Node classes for transforming an RTF byte stream into tokens, and de-encapsulating HTML
MIT License
23 stars 4 forks source link

\line is not converted correctly #5

Closed adelphes closed 6 years ago

adelphes commented 6 years ago

The \line tag is currently not listed in the escape mappings (alongside \tab, etc). It should be converted to a single newline.

{\rtf1\ansi\fbidis\ansicpg1252\deff0\deftab720\fromtext{\fonttbl{\f0\fswiss\fcharset0 Times New Roman;}{\f1\fswiss\fcharset2
Symbol;}}
{\colortbl;\red192\green192\blue192;}
{\*\generator Microsoft Exchange Server;}
{\*\formatConverter converted from text;}
\viewkind5\viewscale100
{\*\bkmkstart BM_BEGIN}\pard\plain\f0{\fs20 As requested.\line
\line
There should be two blank lines beneath this\line
\line
\line
And this text\line
crosses\line
multiple lines\line
\line
}}
rossj commented 6 years ago

Thanks for opening. I only noticed \par before but it says right in de-encapsulation spec:

2.2.3.3 Extracting Original Plain Text from RTF
...
The \par and \line RTF control words SHOULD be translated to CRLF and emitted to the output stream.

Fixed in 2.1.0.