Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
$newline neverin Hamlet 允许我们缩小 HTML 代码。如果我们将它设置在父窗口小部件中,它会对其生效,但不会对子窗口小部件生效。所以$newline never当我们想要缩小整个代码时,我们必须设置所有的小部件。这不好。
$newline never
你不知道更好的解决方案吗?谢谢。
您可以定义自己的默认为NoNewlinesin的 Hamlet quasi-quoter HamletSettings,如以下(未经测试的)代码片段:
NoNewlines
HamletSettings
import Text.Hamlet myHamlet :: QuasiQuoter myHamlet = hamletWithSettings hamletRules defaultHamletSettings{ hamletNewlines = NoNewlines}
然后简单地将其用作[myHamlet| ... |].
[myHamlet| ... |]