【问题标题】:<blockquote> tag inserted when using image in cell of RST table?在 RST 表的单元格中使用图像时插入 <blockquote> 标记?
【发布时间】:2018-12-14 00:05:54
【问题描述】:

当我使用以下代码时:

+----------------------+---------------+---------------------------------------------------------------------+
|          A           |       B       |                C                                                    |
+======================+===============+=====================================================================+
| Merchant Rating      | Ad Extension  | Star ratings plus number of reviews for the advertiser/merchant.    |
|                      |               |                                                                     |
|                      |               |.. image:: /images/merchant-rating.png                               |
+----------------------+---------------+---------------------------------------------------------------------+

前面列 C 中的图像的文本在 HTML 输出中被包裹在 &lt;blockquote&gt; 标记中。有什么办法可以避免吗?

【问题讨论】:

  • 您能发布与此问题相关的源代码吗?

标签: image restructuredtext


【解决方案1】:

为了避免在第三列的第一段中出现blockquote 标签,您可以尝试使用这个:

+----------------------+---------------+---------------------------------------------------------------------+
|          A           |       B       |                C                                                    |
+======================+===============+=====================================================================+
| Merchant Rating      | Ad Extension  | Star ratings plus number of reviews for the advertiser/merchant.    |
|                      |               |                                                                     |
|                      |               | |img|                                                               |
+----------------------+---------------+---------------------------------------------------------------------+

.. |img| image:: /images/merchant-rating.png

相反,你会得到两个段落。

【讨论】:

    【解决方案2】:

    使用 substitution 并删除分隔线,以便 Sphinx 将内容解释为单个文本块。

    +-----------------+--------------+------------------------------------------------------------------+
    |        A        |      B       |                C                                                 |
    +=================+==============+==================================================================+
    | Merchant Rating | Ad Extension | Star ratings plus number of reviews for the advertiser/merchant. |
    |                 |              | |img|                                                            |
    +-----------------+--------------+------------------------------------------------------------------+
    
    .. |img| image:: /images/merchant-rating.png
    

    【讨论】:

    • 我实际上不得不采取不同的方法,但感谢您的建议。我仍然不明白为什么前一段会受到影响。这种行为有什么我不理解的好处吗?
    • 空白在 reST 中有意义。如果没有替换,您必须将文本放在一行,然后是一个空行,然后是 image 指令,所有这些都被解释为两个内容块或两个段落。
    猜你喜欢
    • 2013-06-03
    • 2011-12-05
    • 2016-10-02
    • 2022-10-20
    • 2016-10-23
    • 1970-01-01
    • 1970-01-01
    • 2021-12-15
    • 1970-01-01
    相关资源
    最近更新 更多