【发布时间】:2018-03-27 05:29:17
【问题描述】:
我正在尝试将“mason”变量传递给在 HTML 之前运行的 Perl 自动处理程序脚本。 这可能吗?
<!--- MASON -->
<html>
<body>
<%init>
my $sub_headline = 'this is text';
</%init>
###HEADER###
</body>
</html>
<!--- AUTOHANDLER --->
my $m_header = '<div class="m-portlet__head">
<div class="m-portlet__head-caption">
<div class="m-portlet__head-title">
<h3 class="m-portlet__head-text">###TITLE###</h3>
</div>
<p>$sub_headline</p>
</div><!-- /.caption -->
</div><!-- /.head -->';
$html =~ s/###HEADER###/${m_header}/i;
【问题讨论】:
-
带js和液体
-
我对 Mason 一点也不熟悉,但我怀疑 regex 是这里的答案。等待认识梅森的人过来。我建议你做一些研究。现在,您的问题看起来像是免费为我工作请求。
-
感谢收看。我整晚都在旋转我的齿轮。我第一次使用正则表达式,没有积极的结果。
-
那么请edit 提出问题并向我们展示您的尝试。另见minimal reproducible example 和How to Ask。