2009-08-24 13 views
0
<html> 
<header> 
</header> 
<body> 
<div class='rebol'> 
<pre> 
Rebol [ 
    Title: "rebol script embedded in html" 
    Author-Url: <a href=http://reboltutorial.com/blog/protect-rebol-script-with-php/>http://reboltutorial.com/blog/protect-rebol-script-with-php/</a> 
    Script-Url: <a href=http://reboltutorial.com/source/rebolscriptembedded.html>http://reboltutorial.com/source/rebolscript.html</a> 
    Date: 24-Aug-2009 
    Purpose: { 
      demo of rebol script embedded in html 
    } 
] 
ask "You're successfull!" 
</pre> 
</div> 
</body> 

如果Rebol的控制檯測試這給嵌入html中的rebol腳本:爲什麼它返回</body>?

>> do read clipboard:// 
You're successfull! 
== </body> 
>> 

爲什麼它返回以及如何可能的話,以防止這種情況?

回答

1

<標題>不是有效的HTML標記。你的意思是<頭>

+0

哎呀我不要用手做足夠的HTML :) – 2009-08-24 16:17:43

3

首先:一個REBOL腳本以REBOL [...]標題開頭,因此REBOL解釋器將忽略該標題的所有內容。其次:標籤是REBOL中的有效數據類型。因此,在執行示例腳本時,ask ...表達式後面會有三個值,並且這些值中的最後一個(</body>)將作爲腳本的結果返回。

爲了防止發生這種情況,您可以在希望腳本結束的地方添加quit,即在示例中的ask表達式之後。

+0

謝謝,會糾正我的腳本。 – 2009-08-24 16:25:08

+2

另外,您可以爲腳本添加邊界以正確嵌入它:'

[REBOL [...] ...]
'。 – rgchris 2012-11-13 22:02:34

+0

你也可以只 做剪貼板:// 沒有「讀 – 2013-02-23 01:28:00