brendonh / pyth

Python text markup and conversion
MIT License
89 stars 79 forks source link

Request - Support for parsing string instead of file #47

Open jkhanpara opened 6 years ago

jkhanpara commented 6 years ago

Looking for the capability to parse the string content instead of reading from a file. More like an overload of Ptf15Reader.Read() function which excepts string as an input.

My code is reading the content from a database table and one of the columns contains RTF content which needs to be parsed as plain text.

For example: Column content {\rtf1\fbidis\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Segoe UI;}{\f1\fnil Segoe UI;}}{\colortbl ;\red0\green0\blue0;}{\*\generator Riched20 15.0.4811}{\*\mmathPr\mwrapIndent1440 }\viewkind4\uc1 \pard\cf1\f0\fs20\lang2057 hi\f1\lang1033\par{\*\lyncflags<rtf=1>}}

Should be parsed as:

hi

Is there a way to achieve it using this utility?