我想定义一个可以这样调用的处理程序:
log format("Hello {}", "World") -- #> Hello World
log format("Hello {}, {}", {"World", "Again"}) -- #> Hello World, Again
我在 SDEF 中定义了它:
<command name="format" code="RTSUFRMT" description="">
<direct-parameter type="text" description="Python style string interpolation"/>
<parameter name="with" code="WiTo" type="list or text" description="..."/>
<documentation>
<html>
<![CDATA[<p>format("Hello {}", "world"R<p>]]>]
</html>
</documentation>
</command>
不幸的是,我的处理程序虽然仍然正常运行,但自动被重写如下:
on format {sourceText, tokens}
....
end format
如何让它保留语法handler("Hello", "World")
,而不是format {"Hello {}", "World"}
?