Roundup Tracker - Issues

Message6815

Author rouilj
Recipients ThomasAH, ber, ezio.melotti, mschieder, ncoghlan, rouilj
Date 2019-11-11.01:01:16
Message-id <1573434077.07.0.45334861035.issue2550856@roundup.psfhosted.org>
In-reply-to
Something I kicked together as a POC:

Add:

    @Routing.route("/@method/format", 'POST')
    def format_text(self,input):
        from docutils.core import publish_parts as ReStructuredText

        if 'note' in input:
            return ReStructuredText(input['note'].value, writer_name="html")['html_body']

to interfaces.py using the rest.txt documentation on how to extend the rest interface.

Then:

curl -s -u demo:demo -H "Content-Type: application/json"\
   -H "Referer: https://.../demo/" \
   -H "X-Requested-With: rest" \
   --data '{ "note": "hello\n+++++\nworld\n`example <https://example.com>`_\nlink." }' \
  https://.../demo/rest/@method/format

returns a json encoded string:

    "<div class=\"document\" id=\"hello\">\n<h1 class=\"title\">hello</h1>\n<p>world\n<a class=\"reference external\" href=\"https://example.com\">example</a>\nlink.</p>\n</div>\n"

So looks like basic concept makes sense at least.
History
Date User Action Args
2019-11-11 01:01:17rouiljsetmessageid: <1573434077.07.0.45334861035.issue2550856@roundup.psfhosted.org>
2019-11-11 01:01:17rouiljsetrecipients: + rouilj, ber, ThomasAH, ezio.melotti, ncoghlan, mschieder
2019-11-11 01:01:17rouiljlinkissue2550856 messages
2019-11-11 01:01:16rouiljcreate