def yield_sphinx_only_markup(lines):
substs = [<EOL>(r'<STR_LIT>',        r'<STR_LIT>'),<EOL>(r'<STR_LIT>',         r'<STR_LIT>'),<EOL>(r'<STR_LIT>',        r'<STR_LIT>'),<EOL>(r'<STR_LIT>',         r'<STR_LIT>'),<EOL>(r'<STR_LIT>',        r'<STR_LIT>'),<EOL>(r'<STR_LIT>', r'<STR_LIT>'),<EOL>(r'<STR_LIT>',           r'<STR_LIT>'),<EOL>(r'<STR_LIT>',            r'<STR_LIT>'),<EOL>(r'<STR_LIT>',           r'<STR_LIT:info>'),<EOL>(r'<STR_LIT>',          r'<STR_LIT>'),<EOL>(r'<STR_LIT>',          r'<STR_LIT>'),<EOL>(r'<STR_LIT>',              r'<STR_LIT>'),<EOL>(r'<STR_LIT>',          r'<STR_LIT>'),<EOL>(r'<STR_LIT>',                     r'<STR_LIT>'),<EOL>]<EOL>regex_subs = [ (re.compile(regex, re.IGNORECASE), sub) for (regex, sub) in substs ]<EOL>def clean_line(line):<EOL><INDENT>try:<EOL><INDENT>for (regex, sub) in regex_subs:<EOL><INDENT>line = regex.sub(sub, line)<EOL><DEDENT><DEDENT>except Exception as ex:<EOL><INDENT>print("<STR_LIT>"%(regex, sub))<EOL>raise ex<EOL><DEDENT>return line<EOL><DEDENT>for line in lines:<EOL><INDENT>yield clean_line(line)<EOL><DEDENT>
Cleans-up Sphinx-only constructs (ie from README.rst),
so that *PyPi* can format it properly.

To check for remaining errors, install ``sphinx`` and run::

    python setup.py --long-description | sed -file 'this_file.sed' | rst2html.py  --halt=warning

:param file_inp:     a `filename` or ``sys.stdin``?
:param file_out:     a `filename` or ``sys.stdout`?`

References
----------

https://stackoverflow.com/questions/16367770/my-rst-readme-is-not-formatted-on-pypi-python-org

Notes
-----

Check output with::

    python setup.py --long-description | rst2html.py > output.html