是否可以创建HTML quine?

Yuv*_*dam 14 html computer-science quine computation-theory

根据标题,是否可以在HTML中创建(非平凡的)quine

我对HTML quine的定义:

在假设HTML文件中的某些字符串由浏览器呈现为纯文本的情况下,非平凡的HTML quine是非空的并且至少使用一个HTML标记.定义HTML quine q.html ,使得标准浏览器呈现as的输出是其q.html自身的内容.

(我对这个定义的任何评论持开放态度,我现在就把它搞砸了)

HTML不是图灵完备的,因此定点定理不能用来证明它确实是可能的.

但是,这并不一定意味着HTML quine是不可能的.或者它实际上可以证明HTML quine是不可能的?

Tho*_*s W 16

使用"普通"HTML肯定是不可能的.显然可以使用JavaScript,但也可以使用CSS:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>This is the title</title>
<style type="text/css"><![CDATA[ 
* {
  display:inline;
  white-space:pre;
}
html:last-child {
  white-space:normal;
}
html:before  {content:'<html xmlns="http://www.w3.org/1999/xhtml">';}
html:after   {content:'</html>';}
head:before  {content:'<head>';}
head:after   {content:'</head>';}
title:before {content:'<title>';}
title:after  {content:'</title>';}
style:before {content:'<style type="text/css"><![CDATA[';}
style:after  {content:']]\00003e</style>';}
body:before  {content:'<body/>';position:absolute;left:0;}
]]></style>
</head>
<body/>
</html>
Run Code Online (Sandbox Code Playgroud)