一个新的 Slim 问题

我期待以下 Slim 模板

div class="header"
h2  slim head
p a test example of
    span Slim
span a new line with span
p
    | expected a test example of <span>Slim</span>

生成:
<div class="header">
<h2> slim head </h2>
    <p>a test example of <span>Slim</span></p>
    <span>a new line with span</span>
    <p>expected a test example of <span>Slim</span></p>
</div>

但是,跨度标记未被识别并生成:
<div class="header">
  <h2> slim head </h2>
  <p>a test example of
         span Slim </p>
  <span>a new line with span</span>
  <p>expected a test example of <span>Slim</span></p>
</div>

为什么将跨度视为文本而不是标签?

谢谢

最佳答案

Slim 将您的 span 视为文本,因为您在同一行中开始了段落的实际内容。您应该使用管道( | )嵌套文本并在其后添加跨度,如下所示:

div class="header"
h2  slim head
p
    | a test example of
    span Slim
span a new line with span
p
    | expected a test example of <span>Slim</span>

这应该正确编译为:
<div class="header">
  <h2> slim head </h2>
  <p>a test example of <span> Slim</span></p>
  <span>a new line with span</span>
  <p>expected a test example of <span>Slim</span></p>
</div>

关于slim-lang - slim - 文本不被识别为标签,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15674027/

10-13 05:29