-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtext-converter.go
34 lines (27 loc) · 1.04 KB
/
text-converter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package rtfconverter
import (
// "fmt"
)
type rtfTextInterpreter struct {
content []byte
}
func (p *rtfTextInterpreter) Parse(rtfObj RtfStructure) ([]byte, error) {
var (
result []byte
err error
)
/**
* The de-encapsulating RTF reader SHOULD<14> inspect no more than the first 10 RTF tokens
* (that is, begin group marks and control words) in the input RTF document, in sequence, starting from the beginning of the RTF document.
* If one of the control words is the FROMHTML control word, the de-encapsulating RTF reader SHOULD conclude that the RTF document contains
* an encapsulated HTML document and stop further inspection. If one of the control words is the FROMTEXT control word, the de-encapsulating
* RTF reader SHOULD conclude that the RTF document was produced from a plain text document and stop further inspection.
*/
if (rtfObj.IsTextEncapsulated()) {
// the RTF was generated from a html file
parser := rtfTextEncapsulatedInterpreter{}
//rtfObj.Dump()
result, err = parser.Parse(rtfObj)
}
return result, err
}