This repository was archived by the owner on Apr 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 66<!-- The defer is not necessary for autoloading, but is necessary for the
77 script at the bottom to work as a Quine. -->
88< script src ="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?autoload=true&skin=sunburst&lang=css " defer ="defer "> </ script >
9+ < style > .operative { font-weight : bold; border : 1px solid yellow }</ style >
910</ head >
1011
1112< body >
@@ -31,12 +32,24 @@ <h1>Making Quines Prettier</h1>
3132< ?prettify lang=html linenums=true?>
3233< pre class ="prettyprint " id ="quine " style ="border:4px solid #88c "> </ pre >
3334
34- < script >
35- //<![CDATA[
36- document . getElementById ( "quine" ) . appendChild ( document . createTextNode (
35+ < script > //<![CDATA[
36+ ( function ( ) {
37+ function html ( s ) {
38+ return s . replace ( / & / g, '&' ) . replace ( / < / g, '<' ) . replace ( / > / g, '>' ) ;
39+ }
40+
41+ var quineHtml = html (
3742 '<!DOCTYPE html>\n<html>\n'
38- + document . documentElement . innerHTML
39- + '\n<\/html>\n' ) ) ;
43+ + document . documentElement . innerHTML
44+ + '\n<\/html>\n' ) ;
45+
46+ // Highlight the operative parts:
47+ quineHtml = quineHtml . replace (
48+ / & l t ; s c r i p t s r c [ \s \S ] * ?& g t ; & l t ; \/ s c r i p t & g t ; | & l t ; ! - - \? [ \s \S ] * ?- - & g t ; | & l t ; p r e \b [ \s \S ] * ?& l t ; \/ p r e & g t ; / g,
49+ '<span class="operative">$&</span>' ) ;
50+
51+ document . getElementById ( "quine" ) . innerHTML = quineHtml ;
52+ } ) ( ) ;
4053//]]>
4154</ script > </ body >
4255</ html >
You can’t perform that action at this time.
0 commit comments