Is there a way to parse inline literals?

390 Views Asked by At

My project uses a substitution quite a bit (.. |apipath| replace:: http://domain/api/v1), and I'd like to be able to use this substitution inside an inline literal block. I want something like the following rST source:

Request URL: ``|apipath|/endpoint/method/param``

to turn into the following html output:

Request URL: <code>http://domain/api/v1/endpoint/method/param</code>

Instead, it outputs as

Request URL: <code>|apipath|/endpoint/method/param</code>

Any way you know of to get this to work?

I've tried playing with custom roles and classes. I know that the parsed-literal directive is available, but that appears to only create block content, not inline.

1

There are 1 best solutions below

0
On

I don't know how if at all possible, but perhaps this at least visually comes close to it.

Request URL: |apipath|\ ``/endpoint/method/param``

.. |apipath| replace:: ``http://domain/api/v1``

or :literal:`http://domain/api/v1` in the replace contents.