【问题标题】:Is there a way to parse inline literals?有没有办法解析内联文字?
【发布时间】:2017-01-05 02:27:49
【问题描述】:

我的项目使用了相当多的替换 (.. |apipath| replace:: http://domain/api/v1),我希望能够在内联文字块中使用此替换。我想要类似以下 rST 源代码:

请求网址:``|apipath|/endpoint/method/param``

变成下面的html输出:

请求网址:http://domain/api/v1/endpoint/method/param

相反,它输出为

请求网址:|apipath|/endpoint/method/param

你知道有什么方法可以让它工作吗?

我尝试过使用自定义角色和类。我知道parsed-literal 指令可用,但这似乎只创建块内容,而不是内联。

【问题讨论】:

    标签: python-sphinx substitution restructuredtext


    【解决方案1】:

    我不知道怎么可能,但也许这至少在视觉上接近它。

    Request URL: |apipath|\ ``/endpoint/method/param``
    
    .. |apipath| replace:: ``http://domain/api/v1``
    

    :literal:`http://domain/api/v1` 替换内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-01
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 2012-08-21
      • 1970-01-01
      • 2018-12-09
      • 1970-01-01
      相关资源
      最近更新 更多