Pug中的多义文字

问题描述 投票:0回答:1

我需要在.pug文件中粘贴一个php代码,该代码不会仅作为普通文本阅读而编译。每行加l进行操作。如果有其他方法,请提出建议header.header

.header-wrapper.wrapper

    .header-inner.inner

        |   <?
        |        $friends = 10;
        |        switch($friends):
        |            case 0:
        |                echo "<p>you have no friends</p>";
        |            break;
        |            case 1:
        |                echo "<p>you have a friend</p>";
        |            break;
        |            default:
        |                echo "<p>you have a ${friends} friends</p>";
        |        endswitch;
        |    ?>
pug
1个回答
0
投票

您可以在标签后使用.来添加block of plain text,而无需依赖管道。

[如果要编写以文本形式呈现的PHP代码以供阅读,最好在<pre> element中这样做,以提高语义和可读性。

<pre>
© www.soinside.com 2019 - 2024. All rights reserved.