开发者

Lisp-style quotation in HTML

开发者 https://www.devze.com 2022-12-27 04:29 出处:网络
In Lisp, evaluating \'(+ 1 2) produces \'(+ 1 2), not 3. It seems that HTML doesn\'t support Lisp-style quotation so you can\'t say something like <quote><b>not bold</b></quote> in H

In Lisp, evaluating '(+ 1 2) produces '(+ 1 2), not 3. It seems that HTML doesn't support Lisp-style quotation so you can't say something like <quote><b>not bold</b></quote> in HTML and let it just produce <b>not bold</b> instead of not bold.

开发者_JS百科

Is there any technical reason or historical reason for that? Thanks.


HTML has nothing to do with Lisp and did not derivate from it, so there's no reason that particular syntax should behave that way. You can, however, include literal representations of HTML tags in your markup by substituting the < and > signs with their HTML entities, like this:

&lt;b&gt;not bold&lt;/b&gt;

This will produce:

<b>not bold</b>


You can quote markup in any SGML/XML dialect using a CDATA section like this:

<![CDATA[<b>not bold</b>]]>


code is data data is code.

Check this out. It might help you some.

0

精彩评论

暂无评论...
验证码 换一张
取 消