【问题标题】:Is it possible to put sections inside container in reStructuredText?是否可以将部分放在 reStructuredText 中的容器内?
【发布时间】:2013-04-22 15:49:39
【问题描述】:

我想用 reStructuredText 和 rst2html5 编写一个 2 列的网站 (html)。

我试过这样

.. container:: right

   Right text

.. container:: left

   Left text

而且效果很好(使用 css “float”)。

但是,rst2html5 无法编译 .rst,其中包含容器指令中带有消息 (SEVERE/4) Unexpected section title or transition..

.. container:: right

   ========
   Section1
   ========

   Right text

.. container:: left

   Left text

我猜/认为 rst2html5 行为对于 rst 规范是完全有效的。

我想像这样使用 rst2html5 从 .rst 获取 .html。

<div class="right">
  <h1>Section1</h1>
  <p>Right text</p>
</div>
<div class="left">
  <p>Left text</p>
</div>

是否允许在容器或类似内容中包含部分?(我认为这是不允许的,对吗?) 要么 如何从 .rst(使用 rst2html5)获得与上述类似的 html 输出?

我阅读了this 线程,但无法获得 2 列 html。

任何 cmets 将不胜感激。提前致谢。

【问题讨论】:

    标签: python html restructuredtext


    【解决方案1】:

    我认为尝试让 ReST 处理这两列是错误的方法。 ReST 不关心布局,也不应该关心布局。这应该由网站设计和课程来完成。

    这是一个关于该问题的问题:flow 2 columns of text automatically with CSS 看起来 CSS3: columns 属性现在得到了广泛的支持。

    你是对的,Docutils 不会在容器中划分标题。容器是一种主体元素,只允许在部分内部。 http://docutils.sourceforge.net/docs/ref/doctree.html

    【讨论】:

    • 我也尝试过类指令但失败了。指向 CSS3 方式的指针看起来很有希望。我对 JavaScript 或 jQuery 没有经验,但我会尝试一下。再次感谢。
    猜你喜欢
    • 2012-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-03
    • 2015-01-27
    • 2014-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多