字類型的處理塊參數調用時:與紅/ REBOL
f [(h test) (h test2)]
我想:
"<p><h1>test</h1><h1>test2</h1></p>"
相反,我得到:
"<h1>test2</h1></p>"
我不能看看爲什麼我的代碼不起作用。請注意,我想在下面使用g函數,因爲我有幾個像函數一樣的函數,每個函數都會調用g來分解它們。所以不要擺脫它,這是故意的。
html: copy ""
emit: func [code] [repend html code]
f: func [param [block!]] [
html: copy ""
emit: func [code] [repend html code]
emit <p>
foreach p param [
emit p
]
emit </p>
return html
]
g: func ['arg [string! word!] /local html] [
return h :arg
]
h: func ['arg [string! word!]] [
either word? arg [
text: to-string arg
][
text: arg
]
html: copy ""
emit: func [code] [repend html code]
print text
emit <h1>
emit text
emit </h1>
return html
]
f [(h test) (h test2)]
更新:
現在我得到了紅色的錯誤: 腳本錯誤:HTML是不是在指定的上下文
f: func[param [block!] /local html][
html: copy ""
emit: func [code] [repend html code]
emit <p>
foreach p param [
emit p
]
emit </p>
return html
]
g: func['arg [string! word!] /local html][
return h :arg
]
h: func['arg [string! word!] /local html][
either word? arg [text: to-string arg][
text: arg
]
html: copy ""
emit: func [code] [repend html code]
print text
emit <h1>
emit text
emit </h1>
return html
]
f [(h test) (h test2)]
很好用[]和()非常感謝:) – user310291