我有以下标签:
Public Class Form1
Public Delegate Sub delegateSub()
Public Sub func1()
MsgBox("I AM FUNC1")
End Sub
Public Sub func2()
MsgBox("I AM FUNC2")
End Sub
Public Sub func3()
MsgBox("I AM FUNC3")
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim functions As delegateSub() = {New delegateSub(AddressOf func1), New delegateSub(AddressOf func2), New delegateSub(AddressOf func3)}
InvokeDelegates(functions)
End Sub
Private Sub InvokeDelegates(ByVal functions() As delegateSub)
For Each funcy As delegateSub In functions
funcy.Invoke()
Next
End Sub
End Class
html文件:
@register.inclusion_tag('template.html')
def my_field(field: BoundField):
return {"field": field, "spam":42}
但是现在我想为此标签提供一段HTML代码:
<span>{{ field }}</span> {{ spam }}
对于模板,我可以使用块,但是如何为includement_tag使用块呢?
我可以创建自定义的编译函数并创建自定义的Node,但随后include_tag创建了{% my_field field %}
<b>I want this code to be displayed instead of spam </b>
{% end_my_field %}
,我无法控制它。