Interpreting <pre> and </pre> on individual lines

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 2 years ago
parent 33b6f7bd2a
commit 5e91a3ddfb
  1. 16
      out/DIRECTORY_LISTING
  2. 14
      out/articles/DIRECTORY_LISTING
  3. 2
      out/articles/Love Live! Custom Arcade Controller.article
  4. 2
      out/articles/Love Live! Custom Arcade Controller.article.html
  5. 14
      out/articles/curabitur vel tempus ex.article
  6. 14
      out/articles/curabitur vel tempus ex.article.html
  7. 908
      out/articles/sigplace1.article
  8. 908
      out/articles/sigplace1.article.html
  9. 12
      out/articles/test articles/DIRECTORY_LISTING
  10. 2
      out/articles/test articles/test1.article
  11. 2
      out/articles/test articles/test1.article.html
  12. 2
      out/articles/test articles/test2.article
  13. 2
      out/articles/test articles/test2.article.html
  14. 2
      out/articles/test articles/test3.article
  15. 2
      out/articles/test articles/test3.article.html
  16. 936
      out/otherpage.html
  17. BIN
      sigPlace.class
  18. 33
      sigPlace.java
  19. 6
      sitefiles/articles/curabitur vel tempus ex.article
  20. 466
      sitefiles/articles/sigplace1.article

@ -17,14 +17,14 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /</h2><div class="folderlisting"><a href="/.." class="icon">&#x1F4C1;</a><a href="/..">.. </a><a href="/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-07-23T22:42:49.256861486Z niconiconii 1093</div>
<div class="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-07-23T22:42:49.400858932Z niconiconii 4096</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-07-23T22:42:49.364859572Z niconiconii 884</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-07-23T22:42:49.356859712Z niconiconii 6238</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-07-23T22:42:49.368859499Z niconiconii 804</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-07-23T22:42:49.368859499Z niconiconii 11341</div>
<div class="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-07-23T22:42:49.396859003Z niconiconii 4096</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-07-23T22:42:49.364859572Z niconiconii 2635</div>
<h2>Directory Listing for /</h2><div class="folderlisting"><a href="/.." class="icon">&#x1F4C1;</a><a href="/..">.. </a><a href="/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-07-23T23:57:41.43284476Z niconiconii 1093</div>
<div class="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-07-23T23:57:42.292829103Z niconiconii 4096</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-07-23T23:57:42.228830266Z niconiconii 884</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-07-23T23:57:42.22483034Z niconiconii 6238</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-07-23T23:57:42.228830266Z niconiconii 804</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-07-23T23:57:42.236830121Z niconiconii 80030</div>
<div class="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-07-23T23:57:42.288829174Z niconiconii 4096</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-07-23T23:57:42.228830266Z niconiconii 2635</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -17,13 +17,13 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /articles/</h2><div class="folderlisting"><a href="/articles/.." class="icon">&#x1F4C1;</a><a href="/articles/..">.. </a><a href="/articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-07-23T22:42:49.328860209Z niconiconii 5203</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article.html" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article.html">Love Live! Custom Arcade Controller.article.html</a> 2022-07-23T22:42:49.388859145Z niconiconii 1212</div>
<div class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-07-23T22:42:49.376859358Z niconiconii 5920</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-07-23T22:42:49.336860069Z niconiconii 1587</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-07-23T22:42:49.384859216Z niconiconii 4096</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article.html" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article.html">curabitur vel tempus ex.article.html</a> 2022-07-23T22:42:49.376859358Z niconiconii 2304</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-07-23T22:42:49.344859925Z niconiconii 495</div>
<h2>Directory Listing for /articles/</h2><div class="folderlisting"><a href="/articles/.." class="icon">&#x1F4C1;</a><a href="/articles/..">.. </a><a href="/articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-07-23T23:57:42.212830557Z niconiconii 74701</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article.html" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article.html">Love Live! Custom Arcade Controller.article.html</a> 2022-07-23T23:57:42.280829319Z niconiconii 1212</div>
<div class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-07-23T23:57:42.272829466Z niconiconii 75418</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-07-23T23:57:42.212830557Z niconiconii 774</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-07-23T23:57:42.280829319Z niconiconii 4096</div>
<div class="filelisting"><a href="/articles/curabitur vel tempus ex.article.html" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article.html">curabitur vel tempus ex.article.html</a> 2022-07-23T23:57:42.272829466Z niconiconii 1491</div>
<div class="filelisting"><a href="/articles/Love Live! Custom Arcade Controller.article" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-07-23T23:57:42.216830485Z niconiconii 495</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -1,5 +1,5 @@
<div class="contentWrapper"><h1>My Love Live! Custom Arcade Controller</h1><div class="content" id="content_out/articles/Love Live! Custom Arcade Controller.article">
<br/>
<p class="color5">For over a year since I first got into <u>Love Live! School Idol Festival ~after school ACTIVITY~ Wai-Wai!Home Meeting!!</u> <sup>Try saying that one 10 times fast!</sup><sub>Subscript</sub></p>
<p class="color6">For over a year since I first got into <u>Love Live! School Idol Festival ~after school ACTIVITY~ Wai-Wai!Home Meeting!!</u> <sup>Try saying that one 10 times fast!</sup><sub>Subscript</sub></p>
<br/>
</div><div class="datebar"></div><div class="date">15 July 2022 1:53PM</div>%CONDITIONAL_EXPAND%</div>

@ -19,7 +19,7 @@
<div class="contentBody">
<div class="contentWrapper"><h1>My Love Live! Custom Arcade Controller</h1><div class="expandedContent" id="content_out/articles/Love Live! Custom Arcade Controller.article">
<br/>
<p class="color5">For over a year since I first got into <u>Love Live! School Idol Festival ~after school ACTIVITY~ Wai-Wai!Home Meeting!!</u> <sup>Try saying that one 10 times fast!</sup><sub>Subscript</sub></p>
<p class="color6">For over a year since I first got into <u>Love Live! School Idol Festival ~after school ACTIVITY~ Wai-Wai!Home Meeting!!</u> <sup>Try saying that one 10 times fast!</sup><sub>Subscript</sub></p>
<br/>
</div><div class="datebar"></div><div class="date">15 July 2022 1:53PM</div></div>

@ -1,13 +1,9 @@
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out/articles/curabitur vel tempus ex.article">
<p class="color1">Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
<p class="color3">Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"><pre>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">4</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">4</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"false"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">5</span>)&&!<span class="function">isAlphanumeric</span>(j+<span class="number">1</span>)) {
s+=<span class="function">SPAN</span>(<span class="string">"number"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">"</span>"</span>;
startPos=j+<span class="number">1</span>;
}</pre> </p>
<p class="color4"> </p>
<p class="color4"><pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre> </p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div>%CONDITIONAL_EXPAND%</div>

@ -18,17 +18,13 @@
<body>
<div class="contentBody">
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="expandedContent" id="content_out/articles/curabitur vel tempus ex.article">
<p class="color1">Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
<p class="color3">Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"><pre>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">4</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">4</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"false"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">5</span>)&&!<span class="function">isAlphanumeric</span>(j+<span class="number">1</span>)) {
s+=<span class="function">SPAN</span>(<span class="string">"number"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">"</span>"</span>;
startPos=j+<span class="number">1</span>;
}</pre> </p>
<p class="color4"> </p>
<p class="color4"><pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre> </p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div></div>
</div> <!--End Content Body-->

@ -20,10 +20,908 @@
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"><pre>
test
test
test&<span class="keyword">lt</span>;/pre>&<span class="keyword">lt</span>;h1><span class="keyword">We</span> <span class="variable">can</span>'<span class="keyword">t</span> <span class="keyword">make</span> <span class="keyword">a</span> <span class="keyword">big</span> <span class="variable">header</span>&<span class="keyword">lt</span>;/h1>
testing
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<br/>
<p class="color3"> </p>
<br/>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<br/>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<br/>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<br/>
<p class="color6"> </p>
<br/>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"><pre>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">io</span>.<span class="keyword">IOException</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">charset</span>.<span class="keyword">Charset</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">CopyOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Files</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Path</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Paths</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardCopyOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardOpenOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">AbstractMap</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">ArrayList</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">HashMap</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Iterator</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">List</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Map</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="class">regex</span>.<span class="keyword">Pattern</span>;<span class="variable"></span>
<span class="keyword">public</span> <span class="keyword">class</span> <span class="keyword">sigPlace</span> <span class="variable"></span>{
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">ROOTDIR</span> <span class="variable"></span>= <span class="string">"sitefiles"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">REFDIR</span> <span class="variable"></span>= <span class="string">"ref"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">OUTDIR</span> <span class="variable"></span>= <span class="string">"out"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">ARTICLESDIR</span> <span class="variable"></span>= <span class="string">"articles"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">UPLOADSDIR</span> <span class="variable"></span>= <span class="string">"uploads"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">COMMENTSDIR</span> <span class="variable"></span>= <span class="string">"comments"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="variable">DIRECTORYLISTING</span>_<span class="keyword">FILENAME</span> <span class="variable"></span>= <span class="string">"DIRECTORY_LISTING"</span>;
<span class="keyword">static</span> <span class="keyword">int</span> <span class="keyword">PORT</span> <span class="variable"></span>= <span class="number">8080</span>;
<span class="keyword">static</span> <span class="keyword">double</span> <span class="variable">COLOR</span>_<span class="keyword">ROTATION</span> <span class="variable"></span>= <span class="number">0</span>;
<span class="keyword">static</span> <span class="keyword">boolean</span> <span class="keyword">inCodeBlock</span> <span class="variable"></span>= <span class="number">false</span><span class="keyword"></span>;
<span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">storedCodeBlock</span> <span class="variable"></span>= <span class="string">""</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span>&lt;String,String> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>(<span class="class">Map</span>.<span class="function">ofEntries</span>(
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"SITENAME"</span>, <span class="string">"SigPlace"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"SITE_BACKCOL"</span>, <span class="string">"#111"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"TITLE_CONTENT_START"</span>, <span class="string">"&lt;div class=\"</span>contentWrapper\<span class="string">">&lt;h1>"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"TITLE_CONTENT_END"</span>, <span class="string">"&lt;/h1>&lt;div class=\"</span>content\<span class="string">" >"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"CONTENT_END"</span>, <span class="string">"&lt;/div>"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"DATE_CONTENT_START"</span>, <span class="string">"&lt;div class=\"</span>datebar\<span class="string">">&lt;/div>&lt;div class=\"</span>date\<span class="string">">"</span>)
));
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span>&lt;String,Path> <span class="keyword">ops</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>(<span class="class">Map</span>.<span class="function">ofEntries</span>(
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
<span class="string">""</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"DEFAULT.html"</span>)),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
<span class="string">""</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"FOOTER.html"</span>))
));
<span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">main</span>(<span class="variable">String</span>[] args) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">args</span>.<span class="variable">length</span>><span class="number">0</span>&&<span class="class">args</span>.length%<span class="number">2</span>==<span class="number">0</span>) {
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
<span class="keyword">while</span> <span class="function"></span>(<span class="variable">i</span>&lt;<span class="class">args</span>.length) {
<span class="keyword">String</span> <span class="variable">arg1</span>=args[i];
<span class="keyword">String</span> <span class="variable">arg2</span>=args[i+<span class="number">1</span>];
i+=<span class="number">2</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="class">arg1</span>.<span class="function">equals</span>(<span class="string">"-p"</span><span class="variable"></span>)) {
PORT=<span class="class">Integer</span>.<span class="function">parseInt</span>(arg2);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Port set to "</span>+PORT+<span class="string">"."</span>);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Invalid argument \"</span><span class="string">"+arg1+"</span>\<span class="string">"."</span>);
<span class="keyword">return</span>;
}
}
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Copying files over to output directory..."</span>);
<span class="keyword">try</span> <span class="variable"></span>{
<span class="function">copyDirectory</span>(<span class="string">"sitefiles"</span>,<span class="string">"out"</span>);
Iterator&lt;Path> <span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">filter</span>(<span class="function"></span>(p)->!<span class="class">p</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">"images/"</span>)).<span class="function">iterator</span>();
<span class="function">ParseArticleFiles</span>(items);
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">iterator</span>();
<span class="function">ConvertArticleReferences</span>(items);
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>,<span class="string">"articles"</span>)).<span class="function">iterator</span>();
<span class="function">GenerateArticleFiles</span>(items);
}<span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Copying files over failed!"</span>);
<span class="keyword">return</span>;
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Building directory listings..."</span>);
<span class="keyword">try</span> <span class="variable"></span>{
<span class="function">buildDirectoryListings</span>();
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Failed to build directory listings!"</span>);
<span class="keyword">return</span>;
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Site has been built into the "</span>+OUTDIR+<span class="string">" directory."</span>);
<span class="function">ExportCodeFile</span>();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"\nStarting web server..."</span>);
<span class="keyword">new</span> <span class="function">sigServer</span>(<span class="variable"></span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ParseArticleFiles</span>(<span class="variable">Iterator</span>&lt;Path> items) {
<span class="keyword">while</span> <span class="function"></span>(<span class="class">items</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">items</span>.<span class="function">next</span>();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isRegularFile</span>(<span class="variable">f</span>)) {
<span class="keyword">try</span> <span class="variable"></span>{
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Preparing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
List&lt;String> <span class="keyword">content</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(f);
<span class="keyword">if</span> <span class="function"></span>(<span class="function">isHTMLFile</span>(<span class="variable">f</span>)) {
<span class="class">content</span>.<span class="function">addAll</span>(<span class="number">0</span>,<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>)));
<span class="class">content</span>.<span class="function">addAll</span>(<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>)));
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Parsing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;i&lt;<span class="class">content</span>.<span class="function">size</span>();i++) {
<span class="keyword">String</span> <span class="keyword">s</span> <span class="variable"></span>= <span class="class">content</span>.<span class="function">get</span>(i);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(s);
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">length</span>(<span class="variable"></span>)><span class="number">0</span>&&<span class="function"></span>(<span class="function">isHTMLFile</span>(f)||<span class="function">isArticleFile</span>(f))) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!inCodeBlock) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"&lt;pre>"</span><span class="variable"></span>)) {
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Inside &lt;pre>"</span>);
inCodeBlock=<span class="number">true</span><span class="keyword"></span>;
storedCodeBlock=<span class="string">""</span>;
s=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;pre>"</span>));
}
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>&&<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"&lt;/pre>"</span>)) {
inCodeBlock=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">keyword</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">inString</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">inChar</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">canBeNumericalConstant</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">int</span> <span class="variable">lengthOfConstant</span>=<span class="number">0</span>;
storedCodeBlock+=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;/pre>"</span>));
storedCodeBlock=<span class="class">storedCodeBlock</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(<span class="string">"&lt;"</span>),<span class="string">"&lt;"</span>);
s+=<span class="string">"&lt;/pre>"</span>;
storedCodeBlock=<span class="string">"&lt;pre>"</span>+<span class="keyword">storedCodeBlock</span>;
<span class="keyword">int</span> <span class="variable">startPos</span>=<span class="number">0</span>;
<span class="keyword">String</span> <span class="variable">endText</span>=<span class="class">s</span>.<span class="function">substring</span>(<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;/pre>"</span>)+<span class="string">"&lt;/pre>"</span>.<span class="function">length</span>(),<span class="class">s</span>.<span class="function">length</span>());
s=<span class="string">""</span>;
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">0</span>;j&lt;<span class="class">storedCodeBlock</span>.<span class="function">length</span>();j++) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)=='<span class="string">"') {
inString=!inString;
if (inString) {
s+=SPAN("</span><span class="string">")+"</span>\<span class="string">""</span>;
} <span class="keyword">else</span> <span class="variable"></span>{
s+=<span class="string">"\"</span>&lt;/span><span class="string">";
startPos=j+1;
}
} else
if (!inString&&!inChar) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
lengthOfConstant++;
System.out.println("</span><span class="keyword">Length</span> <span class="keyword">of</span> <span class="keyword">Constant</span> <span class="keyword">now</span> <span class="string">"+lengthOfConstant);
}
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span><span class="variable"></span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
//System.out.println("</span><span class="keyword">Setting</span> <span class="string">"+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
lengthOfConstant=0;
canBeNumericalConstant=false;
startPos=j+1;
} else
if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') {
//Previous section was a member.
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span><span class="variable"></span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("</span><span class="number">true</span><span class="string">")&&!isAlphanumeric(j-4)&&!isAlphanumeric(j+1)) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>&lt;/span><span class="string">";
startPos=j+1;
} else
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("</span><span class="number">false</span><span class="string">")&&!isAlphanumeric(j-5)&&!isAlphanumeric(j+1)) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>&lt;/span><span class="string">";
startPos=j+1;
} else
if (storedCodeBlock.charAt(j)=='(') {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') {
//Previous section was a keyword.
keyword=true;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) {
//Previous section was a keyword.
//keyword=true;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)&lt;='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)&lt;='z'||storedCodeBlock.charAt(j)==' ')) {
keyword=false;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (!isAlphanumeric(j)){
if (startPos&lt;j) {
s+=storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j);
} else {
s+=storedCodeBlock.charAt(j);
}
startPos=j+1;
}
} else {
s+=storedCodeBlock.charAt(j);
startPos=j+1;
}
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9')) {
canBeNumericalConstant=false;
}
if (!canBeNumericalConstant&&!isAlphanumeric(j)) {
canBeNumericalConstant=true;
lengthOfConstant=0;
System.out.println("</span><span class="keyword">Found</span> <span class="string">"+storedCodeBlock.charAt(j)+"</span><span class="variable"></span>, <span class="keyword">can</span> <span class="keyword">be</span> <span class="class">numeric</span>.<span class="variable"></span>..<span class="string">");
}
}
s+=endText;
//System.out.println("</span><span class="keyword">Stored</span> <span class="keyword">code</span> <span class="keyword">block</span>: <span class="string">"+storedCodeBlock);
} else
if (inCodeBlock) {
storedCodeBlock+=s+"</span><span class="variable"></span>\<span class="string">";
s="</span> <span class="string">";
}
}
if (s.length()>0&&isArticleFile(f)) {
//Check for markdown pieces.
if (s.charAt(0)=='-') {
//Start of a title piece.
s=s.replace("</span>-<span class="string">",map.get("</span>TITLE_CONTENT_<span class="string">"));
s=s+map.get("</span>TITLE_CONTENT_<span class="string">").replace("</span><span class="string">","</span>id=\<span class="string">"content_"</span>+f+<span class="string">"\"</span><span class="string">");
//Use ⤈ if there's more text to be shown than can fit.
} else
if (s.contains("</span>===<span class="string">")) {
s=map.get("</span>CONTENT_<span class="string">")+map.get("</span>DATE_CONTENT_<span class="string">")+s.replace("</span>===<span class="string">","</span><span class="string">")+map.get("</span>CONTENT_<span class="string">")+"</span><span class="string">"+map.get("</span>CONTENT_<span class="string">");
} else
if (s.charAt(0)==':') {
//Image with caption.
//Format:
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption>
String[] splitter = s.split(Pattern.quote("</span>,<span class="string">"));
StringBuilder captionText = new StringBuilder(splitter[3]);
for (int j=4;j&lt;splitter.length;j++) {
captionText.append("</span>,<span class="string">").append(splitter[j]);
}
s="</span>&lt;div>&lt;<span class="keyword">figure</span> <span class="variable">style</span>=\<span class="string">"text-align:center;"</span>+<span class="function"></span>(<span class="function"></span>(splitter[<span class="number">1</span>].<span class="function">equals</span>(<span class="string">"left"</span>)||splitter[<span class="number">1</span>].<span class="function">equals</span>(<span class="string">"right"</span>))?<span class="string">"width:"</span>+splitter[<span class="number">2</span>]+<span class="string">"%;float:"</span>+splitter[<span class="number">1</span>]+<span class="string">";"</span>:<span class="string">""</span>)+<span class="string">"\"</span>>&lt;<span class="keyword">img</span> <span class="variable">src</span>=\<span class="string">"/"</span>+splitter[<span class="number">0</span>].<span class="function">substring</span>(<span class="number">1</span>)+<span class="string">"\"</span> style=\<span class="string">"margin:auto;width:100%;\"</span>>&lt;figcaption><span class="string">"+captionText.toString()+"</span>&lt;/figcaption>&lt;/figure>&lt;/div><span class="string">";
} else {
//It's regular content, so add paragraphs.
s="</span>&lt;<span class="keyword">p</span> <span class="variable">class</span>=\<span class="string">"color"</span>+<span class="function"></span>(<span class="function"></span>(<span class="function"></span>(int)<span class="function"></span>(COLOR_ROTATION=<span class="function"></span>(COLOR_ROTATION+0.<span class="number">4</span>)%<span class="number">6</span>))+<span class="number">1</span>)+<span class="string">"\"</span>><span class="string">"+s+"</span>&lt;/p><span class="string">";
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="</span>&lt;br/><span class="string">"; //Setup a line break here.
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
}
content.set(i,s);
}
System.out.println("</span> <span class="keyword">Writing</span> <span class="keyword">to</span> <span class="string">"+f.toAbsolutePath());
Files.write(f, content, Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
System.out.println("</span> <span class="string">"+f.getFileName() + "</span> <span class="keyword">conversion</span> <span class="variable">complete</span>!<span class="string">");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static boolean validNumericalConstantCharacters(int lengthOfConstant, int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='.'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='A'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)&lt;='F'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='a'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)&lt;='f'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='x'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='X';
}
private static boolean isAlphanumeric(int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)&lt;='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)&lt;='z';
}
/**
* Writes a span tag with the included class.
* **/
private static String SPAN(String className) {
return "</span>&lt;<span class="keyword">span</span> <span class="variable">class</span>=\<span class="string">""</span>+className+<span class="string">"\"</span>><span class="string">";
}
private static void GenerateArticleFiles(Iterator&lt;Path> items){
System.out.println("</span> <span class="keyword">Generating</span> <span class="keyword">article</span> <span class="class">files</span>.<span class="variable"></span>..<span class="string">");
while (items.hasNext()) {
Path f = items.next();
try {
if (Files.isRegularFile(f)&&isArticleFile(f)) {
System.out.println("</span> <span class="keyword">Creating</span> <span class="keyword">article</span> <span class="keyword">for</span> <span class="string">"+f.getFileName());
List&lt;String> content = Files.readAllLines(f);
List&lt;String> preContent = Files.readAllLines(ops.get("</span><span class="string">"));
List&lt;String> postContent = Files.readAllLines(ops.get("</span><span class="string">"));
StringBuilder sb = new StringBuilder();
for (String d : preContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("</span><span class="variable"></span>\<span class="string">");
}
for (String d : content) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
d=d.replaceFirst("</span><span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"content\"</span><span class="string">","</span><span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"expandedContent\"</span><span class="string">");
d=d.replaceFirst("</span><span class="string">","</span><span class="string">");
sb.append(d).append("</span>\<span class="string">");
}
for (String d : postContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("</span>\<span class="string">");
}
Files.write(Paths.get(f.getParent().toString(),f.getFileName()+"</span>.<span class="string">"),sb.toString().getBytes());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void ConvertArticleReferences(Iterator&lt;Path> items) {
while (items.hasNext()) {
Path f = items.next();
System.out.println("</span> <span class="keyword">Looking</span> <span class="keyword">for</span> <span class="keyword">Article</span> <span class="class">References</span>.<span class="variable"></span>..<span class="string">"+f.getFileName());
boolean articleJavascriptIncluded=false;
if (Files.isRegularFile(f)&&isHTMLFile(f)) {
System.out.println("</span> <span class="keyword">Searching</span> <span class="string">"+f.getFileName());
try {
List&lt;String> content = Files.readAllLines(f);
for (int i=0;i&lt;content.size();i++) {
String s = content.get(i);
if (s.length()>0&&s.contains("</span><span class="variable">ARTICLE</span>_<span class="string">")) {
String article = ARTICLESDIR+"</span>/<span class="string">"+s.replace("</span>ARTICLE_<span class="keyword">PREVIEW</span> <span class="string">","</span><span class="string">")+"</span><span class="variable"></span>.<span class="string">";
System.out.println("</span> <span class="keyword">Found</span> <span class="keyword">article</span> <span class="keyword">preview</span> <span class="keyword">request</span> <span class="keyword">in</span> <span class="string">"+f.getFileName()+"</span> <span class="keyword">for</span> <span class="keyword">article</span> <span class="string">"+article+"</span><span class="variable"></span>.<span class="string">");
Path file = Paths.get(OUTDIR,article);
List&lt;String> newData = Files.readAllLines(file);
if (newData.size()>0) {
content.set(i,newData.get(0));
for (int j=1;j&lt;newData.size();j++) {
content.add(i+j, newData.get(j));
}
String lastline=content.get(i+newData.size()-1);
lastline=lastline.replace("</span><span class="string">","</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"unexpanded\"</span> id=\<span class="string">"expand_"</span>+i+<span class="string">"\"</span> onClick=\<span class="string">"expand(this,'"</span>+<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="class">article</span>.<span class="function">toString</span>())+<span class="string">"')\"</span>>&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#<span class="keyword">x2908</span>; <span class="keyword">Click</span> <span class="keyword">to</span> <span class="class">expand</span>.<span class="variable"></span>&lt;/div><span class="string">");
content.set(i+newData.size()-1,lastline);//&lt;div class=\"</span>unexpanded\<span class="string">" id=\"</span>expand_<span class="string">"+i+"</span>\<span class="string">" onClick=\"</span><span class="function">expand</span>(<span class="string">"+i+"</span>)\<span class="string">">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>"</span>);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">content</span>.<span class="function">set</span>(i,<span class="string">""</span>);
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!articleJavascriptIncluded) {
List&lt;String> <span class="keyword">articlejs</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"article.js"</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="class">articlejs</span>.<span class="function">size</span>()-<span class="number">1</span>;j>=<span class="number">0</span>;j--) {
<span class="class">content</span>.<span class="function">add</span>(i,<span class="class">articlejs</span>.<span class="function">get</span>(j));
}
articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
}
}
}
<span class="class">Files</span>.<span class="function">write</span>(f,content);
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
}
}
}
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">copyDirectory</span>(<span class="keyword">String</span> <span class="variable">sourceDirectoryLocation</span>, <span class="keyword">String</span> <span class="variable">destinationDirectoryLocation</span>)
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
<span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(sourceDirectoryLocation))
.<span class="function">forEach</span>(<span class="keyword">source</span> <span class="variable"></span>-> {
<span class="keyword">Path</span> <span class="keyword">destination</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(destinationDirectoryLocation, <span class="class">source</span>.<span class="function">toString</span>()
.<span class="function">substring</span>(<span class="class">sourceDirectoryLocation</span>.<span class="function">length</span>()));
<span class="keyword">try</span> <span class="variable"></span>{
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(<span class="variable">destination</span>)) {
<span class="class">Files</span>.<span class="function">createDirectories</span>(destination);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">Files</span>.<span class="function">copy</span>(source, destination, <span class="keyword">new</span> <span class="variable">CopyOption</span>[]{<span class="class">StandardCopyOption</span>.COPY_ATTRIBUTES,<span class="class">StandardCopyOption</span>.REPLACE_EXISTING});
}
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
});
}
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">buildDirectoryListings</span>(<span class="variable"></span>)
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
<span class="keyword">String</span> <span class="variable">startingPath</span>=<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>();
HashMap&lt;String,List&lt;Path>> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>();
Iterator&lt;Path> <span class="keyword">it</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR)).<span class="function">iterator</span>();
<span class="class">map</span>.<span class="function">put</span>(<span class="string">"/"</span>,<span class="keyword">new</span> <span class="variable">ArrayList</span>&lt;Path><span class="function"></span>());
<span class="keyword">while</span> <span class="function"></span>(<span class="class">it</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">it</span>.<span class="function">next</span>();
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>().<span class="function">equals</span>(OUTDIR)) {
<span class="keyword">String</span> <span class="keyword">myKey</span> <span class="variable"></span>= <span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(startingPath,<span class="string">""</span>).<span class="function">replace</span>(<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>(),<span class="string">""</span>);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(myKey+<span class="string">","</span>+f);
<span class="class">map</span>.<span class="function">putIfAbsent</span>(myKey,<span class="keyword">new</span> <span class="variable">ArrayList</span>&lt;Path><span class="function"></span>());
<span class="class">map</span>.<span class="function">get</span>(myKey).<span class="function">add</span>(f);
}
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Directory structure determined:"</span>);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+map);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">key</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">keySet</span>()) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Creating directory listing for "</span>+key+<span class="string">"..."</span>);
<span class="keyword">StringBuilder</span> <span class="keyword">sb</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="string">""</span><span class="variable"></span>);
List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>));
List&lt;String> <span class="keyword">data2</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data) {
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;h2>Directory Listing for "</span>+key+<span class="string">"&lt;/h2>"</span>);
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"</span>folderlisting\<span class="string">">&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">" class=\"</span>icon\<span class="string">">&#x1F4C1;&lt;/a>&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">">.. &lt;/a>&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">" class=\"</span>nounderline\<span class="string">">(Previous Directory)&lt;/a>&lt;/div>"</span>);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">get</span>(key)) {
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"</span><span class="string">").append((Files.isDirectory(f)?"</span><span class="string">":"</span><span class="string">")).append("</span>\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="string">"&lt;a href=\"</span><span class="string">"+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),"</span><span class="string">"))+"</span>\<span class="string">" class=\"</span>icon\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(f)?<span class="string">"&#x1F4C1;"</span>:<span class="string">"&#x1F5CE;"</span>))
.<span class="function">append</span>(<span class="string">"&lt;/a>"</span>)
.<span class="function">append</span>(<span class="string">"&lt;a href=\"</span><span class="string">"+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),"</span><span class="string">"))+"</span>\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="class">f</span>.<span class="function">getFileName</span>())
.<span class="function">append</span>(<span class="string">"&lt;/a>\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getLastModifiedTime</span>(f))
.<span class="function">append</span>(<span class="string">"\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getOwner</span>(f))
.<span class="function">append</span>(<span class="string">"\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">size</span>(f))
.<span class="function">append</span>(<span class="string">"&lt;/div>\n"</span>);
}
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data2) {
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
<span class="keyword">Path</span> <span class="keyword">newf</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,key,DIRECTORYLISTING_FILENAME),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Added info for ("</span>+<span class="class">map</span>.<span class="function">size</span>()+<span class="string">") files to "</span>+<span class="class">newf</span>.<span class="function">toAbsolutePath</span>());
}
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isArticleFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".article"</span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isHTMLFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".html"</span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ExportCodeFile</span>(<span class="variable"></span>) {
<span class="keyword">try</span> <span class="variable"></span>{
<span class="keyword">Path</span> <span class="keyword">file</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"sigServer.java"</span>);
List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
<span class="keyword">while</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">data</span>.<span class="function">get</span>(i++).<span class="function">contains</span>(<span class="string">"sigServer()"</span>)&&i&lt;<span class="class">data</span>.<span class="function">size</span>());
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">i</span>&lt;<span class="class">data</span>.<span class="function">size</span>()) {
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="string">"codeBackground"</span>),<span class="class">data</span>.<span class="function">subList</span>(i, <span class="class">Math</span>.<span class="function">min</span>(i+<span class="number">40</span>,<span class="class">data</span>.<span class="function">size</span>())),<span class="class">Charset</span>.<span class="function">defaultCharset</span>(),<span class="class">StandardOpenOption</span>.CREATE,<span class="class">StandardOpenOption</span>.TRUNCATE_EXISTING,<span class="class">StandardOpenOption</span>.WRITE);
}
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
}
}
</pre></p>
</div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div>%CONDITIONAL_EXPAND%</div>

@ -39,11 +39,909 @@
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"><pre>
test
test
test&<span class="keyword">lt</span>;/pre>&<span class="keyword">lt</span>;h1><span class="keyword">We</span> <span class="variable">can</span>'<span class="keyword">t</span> <span class="keyword">make</span> <span class="keyword">a</span> <span class="keyword">big</span> <span class="variable">header</span>&<span class="keyword">lt</span>;/h1>
testing
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<br/>
<p class="color3"> </p>
<br/>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<br/>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<br/>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<br/>
<p class="color6"> </p>
<br/>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"><pre>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">io</span>.<span class="keyword">IOException</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">charset</span>.<span class="keyword">Charset</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">CopyOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Files</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Path</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Paths</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardCopyOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardOpenOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">AbstractMap</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">ArrayList</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">HashMap</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Iterator</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">List</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Map</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="class">regex</span>.<span class="keyword">Pattern</span>;<span class="variable"></span>
<span class="keyword">public</span> <span class="keyword">class</span> <span class="keyword">sigPlace</span> <span class="variable"></span>{
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">ROOTDIR</span> <span class="variable"></span>= <span class="string">"sitefiles"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">REFDIR</span> <span class="variable"></span>= <span class="string">"ref"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">OUTDIR</span> <span class="variable"></span>= <span class="string">"out"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">ARTICLESDIR</span> <span class="variable"></span>= <span class="string">"articles"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">UPLOADSDIR</span> <span class="variable"></span>= <span class="string">"uploads"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">COMMENTSDIR</span> <span class="variable"></span>= <span class="string">"comments"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="variable">DIRECTORYLISTING</span>_<span class="keyword">FILENAME</span> <span class="variable"></span>= <span class="string">"DIRECTORY_LISTING"</span>;
<span class="keyword">static</span> <span class="keyword">int</span> <span class="keyword">PORT</span> <span class="variable"></span>= <span class="number">8080</span>;
<span class="keyword">static</span> <span class="keyword">double</span> <span class="variable">COLOR</span>_<span class="keyword">ROTATION</span> <span class="variable"></span>= <span class="number">0</span>;
<span class="keyword">static</span> <span class="keyword">boolean</span> <span class="keyword">inCodeBlock</span> <span class="variable"></span>= <span class="number">false</span><span class="keyword"></span>;
<span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">storedCodeBlock</span> <span class="variable"></span>= <span class="string">""</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span>&lt;String,String> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>(<span class="class">Map</span>.<span class="function">ofEntries</span>(
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"SITENAME"</span>, <span class="string">"SigPlace"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"SITE_BACKCOL"</span>, <span class="string">"#111"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"TITLE_CONTENT_START"</span>, <span class="string">"&lt;div class=\"</span>contentWrapper\<span class="string">">&lt;h1>"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"TITLE_CONTENT_END"</span>, <span class="string">"&lt;/h1>&lt;div class=\"</span>content\<span class="string">" >"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"CONTENT_END"</span>, <span class="string">"&lt;/div>"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"DATE_CONTENT_START"</span>, <span class="string">"&lt;div class=\"</span>datebar\<span class="string">">&lt;/div>&lt;div class=\"</span>date\<span class="string">">"</span>)
));
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span>&lt;String,Path> <span class="keyword">ops</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>(<span class="class">Map</span>.<span class="function">ofEntries</span>(
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
<span class="string">""</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"DEFAULT.html"</span>)),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
<span class="string">""</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"FOOTER.html"</span>))
));
<span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">main</span>(<span class="variable">String</span>[] args) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">args</span>.<span class="variable">length</span>><span class="number">0</span>&&<span class="class">args</span>.length%<span class="number">2</span>==<span class="number">0</span>) {
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
<span class="keyword">while</span> <span class="function"></span>(<span class="variable">i</span>&lt;<span class="class">args</span>.length) {
<span class="keyword">String</span> <span class="variable">arg1</span>=args[i];
<span class="keyword">String</span> <span class="variable">arg2</span>=args[i+<span class="number">1</span>];
i+=<span class="number">2</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="class">arg1</span>.<span class="function">equals</span>(<span class="string">"-p"</span><span class="variable"></span>)) {
PORT=<span class="class">Integer</span>.<span class="function">parseInt</span>(arg2);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Port set to "</span>+PORT+<span class="string">"."</span>);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Invalid argument \"</span><span class="string">"+arg1+"</span>\<span class="string">"."</span>);
<span class="keyword">return</span>;
}
}
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Copying files over to output directory..."</span>);
<span class="keyword">try</span> <span class="variable"></span>{
<span class="function">copyDirectory</span>(<span class="string">"sitefiles"</span>,<span class="string">"out"</span>);
Iterator&lt;Path> <span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">filter</span>(<span class="function"></span>(p)->!<span class="class">p</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">"images/"</span>)).<span class="function">iterator</span>();
<span class="function">ParseArticleFiles</span>(items);
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">iterator</span>();
<span class="function">ConvertArticleReferences</span>(items);
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>,<span class="string">"articles"</span>)).<span class="function">iterator</span>();
<span class="function">GenerateArticleFiles</span>(items);
}<span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Copying files over failed!"</span>);
<span class="keyword">return</span>;
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Building directory listings..."</span>);
<span class="keyword">try</span> <span class="variable"></span>{
<span class="function">buildDirectoryListings</span>();
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Failed to build directory listings!"</span>);
<span class="keyword">return</span>;
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Site has been built into the "</span>+OUTDIR+<span class="string">" directory."</span>);
<span class="function">ExportCodeFile</span>();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"\nStarting web server..."</span>);
<span class="keyword">new</span> <span class="function">sigServer</span>(<span class="variable"></span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ParseArticleFiles</span>(<span class="variable">Iterator</span>&lt;Path> items) {
<span class="keyword">while</span> <span class="function"></span>(<span class="class">items</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">items</span>.<span class="function">next</span>();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isRegularFile</span>(<span class="variable">f</span>)) {
<span class="keyword">try</span> <span class="variable"></span>{
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Preparing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
List&lt;String> <span class="keyword">content</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(f);
<span class="keyword">if</span> <span class="function"></span>(<span class="function">isHTMLFile</span>(<span class="variable">f</span>)) {
<span class="class">content</span>.<span class="function">addAll</span>(<span class="number">0</span>,<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>)));
<span class="class">content</span>.<span class="function">addAll</span>(<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>)));
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Parsing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;i&lt;<span class="class">content</span>.<span class="function">size</span>();i++) {
<span class="keyword">String</span> <span class="keyword">s</span> <span class="variable"></span>= <span class="class">content</span>.<span class="function">get</span>(i);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(s);
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">length</span>(<span class="variable"></span>)><span class="number">0</span>&&<span class="function"></span>(<span class="function">isHTMLFile</span>(f)||<span class="function">isArticleFile</span>(f))) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!inCodeBlock) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"&lt;pre>"</span><span class="variable"></span>)) {
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Inside &lt;pre>"</span>);
inCodeBlock=<span class="number">true</span><span class="keyword"></span>;
storedCodeBlock=<span class="string">""</span>;
s=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;pre>"</span>));
}
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>&&<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"&lt;/pre>"</span>)) {
inCodeBlock=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">keyword</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">inString</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">inChar</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">canBeNumericalConstant</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">int</span> <span class="variable">lengthOfConstant</span>=<span class="number">0</span>;
storedCodeBlock+=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;/pre>"</span>));
storedCodeBlock=<span class="class">storedCodeBlock</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(<span class="string">"&lt;"</span>),<span class="string">"&lt;"</span>);
s+=<span class="string">"&lt;/pre>"</span>;
storedCodeBlock=<span class="string">"&lt;pre>"</span>+<span class="keyword">storedCodeBlock</span>;
<span class="keyword">int</span> <span class="variable">startPos</span>=<span class="number">0</span>;
<span class="keyword">String</span> <span class="variable">endText</span>=<span class="class">s</span>.<span class="function">substring</span>(<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;/pre>"</span>)+<span class="string">"&lt;/pre>"</span>.<span class="function">length</span>(),<span class="class">s</span>.<span class="function">length</span>());
s=<span class="string">""</span>;
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">0</span>;j&lt;<span class="class">storedCodeBlock</span>.<span class="function">length</span>();j++) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)=='<span class="string">"') {
inString=!inString;
if (inString) {
s+=SPAN("</span><span class="string">")+"</span>\<span class="string">""</span>;
} <span class="keyword">else</span> <span class="variable"></span>{
s+=<span class="string">"\"</span>&lt;/span><span class="string">";
startPos=j+1;
}
} else
if (!inString&&!inChar) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
lengthOfConstant++;
System.out.println("</span><span class="keyword">Length</span> <span class="keyword">of</span> <span class="keyword">Constant</span> <span class="keyword">now</span> <span class="string">"+lengthOfConstant);
}
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span><span class="variable"></span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
//System.out.println("</span><span class="keyword">Setting</span> <span class="string">"+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
lengthOfConstant=0;
canBeNumericalConstant=false;
startPos=j+1;
} else
if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') {
//Previous section was a member.
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span><span class="variable"></span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("</span><span class="number">true</span><span class="string">")&&!isAlphanumeric(j-4)&&!isAlphanumeric(j+1)) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>&lt;/span><span class="string">";
startPos=j+1;
} else
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("</span><span class="number">false</span><span class="string">")&&!isAlphanumeric(j-5)&&!isAlphanumeric(j+1)) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>&lt;/span><span class="string">";
startPos=j+1;
} else
if (storedCodeBlock.charAt(j)=='(') {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') {
//Previous section was a keyword.
keyword=true;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) {
//Previous section was a keyword.
//keyword=true;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)&lt;='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)&lt;='z'||storedCodeBlock.charAt(j)==' ')) {
keyword=false;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (!isAlphanumeric(j)){
if (startPos&lt;j) {
s+=storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j);
} else {
s+=storedCodeBlock.charAt(j);
}
startPos=j+1;
}
} else {
s+=storedCodeBlock.charAt(j);
startPos=j+1;
}
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9')) {
canBeNumericalConstant=false;
}
if (!canBeNumericalConstant&&!isAlphanumeric(j)) {
canBeNumericalConstant=true;
lengthOfConstant=0;
System.out.println("</span><span class="keyword">Found</span> <span class="string">"+storedCodeBlock.charAt(j)+"</span><span class="variable"></span>, <span class="keyword">can</span> <span class="keyword">be</span> <span class="class">numeric</span>.<span class="variable"></span>..<span class="string">");
}
}
s+=endText;
//System.out.println("</span><span class="keyword">Stored</span> <span class="keyword">code</span> <span class="keyword">block</span>: <span class="string">"+storedCodeBlock);
} else
if (inCodeBlock) {
storedCodeBlock+=s+"</span><span class="variable"></span>\<span class="string">";
s="</span> <span class="string">";
}
}
if (s.length()>0&&isArticleFile(f)) {
//Check for markdown pieces.
if (s.charAt(0)=='-') {
//Start of a title piece.
s=s.replace("</span>-<span class="string">",map.get("</span>TITLE_CONTENT_<span class="string">"));
s=s+map.get("</span>TITLE_CONTENT_<span class="string">").replace("</span><span class="string">","</span>id=\<span class="string">"content_"</span>+f+<span class="string">"\"</span><span class="string">");
//Use ⤈ if there's more text to be shown than can fit.
} else
if (s.contains("</span>===<span class="string">")) {
s=map.get("</span>CONTENT_<span class="string">")+map.get("</span>DATE_CONTENT_<span class="string">")+s.replace("</span>===<span class="string">","</span><span class="string">")+map.get("</span>CONTENT_<span class="string">")+"</span><span class="string">"+map.get("</span>CONTENT_<span class="string">");
} else
if (s.charAt(0)==':') {
//Image with caption.
//Format:
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption>
String[] splitter = s.split(Pattern.quote("</span>,<span class="string">"));
StringBuilder captionText = new StringBuilder(splitter[3]);
for (int j=4;j&lt;splitter.length;j++) {
captionText.append("</span>,<span class="string">").append(splitter[j]);
}
s="</span>&lt;div>&lt;<span class="keyword">figure</span> <span class="variable">style</span>=\<span class="string">"text-align:center;"</span>+<span class="function"></span>(<span class="function"></span>(splitter[<span class="number">1</span>].<span class="function">equals</span>(<span class="string">"left"</span>)||splitter[<span class="number">1</span>].<span class="function">equals</span>(<span class="string">"right"</span>))?<span class="string">"width:"</span>+splitter[<span class="number">2</span>]+<span class="string">"%;float:"</span>+splitter[<span class="number">1</span>]+<span class="string">";"</span>:<span class="string">""</span>)+<span class="string">"\"</span>>&lt;<span class="keyword">img</span> <span class="variable">src</span>=\<span class="string">"/"</span>+splitter[<span class="number">0</span>].<span class="function">substring</span>(<span class="number">1</span>)+<span class="string">"\"</span> style=\<span class="string">"margin:auto;width:100%;\"</span>>&lt;figcaption><span class="string">"+captionText.toString()+"</span>&lt;/figcaption>&lt;/figure>&lt;/div><span class="string">";
} else {
//It's regular content, so add paragraphs.
s="</span>&lt;<span class="keyword">p</span> <span class="variable">class</span>=\<span class="string">"color"</span>+<span class="function"></span>(<span class="function"></span>(<span class="function"></span>(int)<span class="function"></span>(COLOR_ROTATION=<span class="function"></span>(COLOR_ROTATION+0.<span class="number">4</span>)%<span class="number">6</span>))+<span class="number">1</span>)+<span class="string">"\"</span>><span class="string">"+s+"</span>&lt;/p><span class="string">";
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="</span>&lt;br/><span class="string">"; //Setup a line break here.
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
}
content.set(i,s);
}
System.out.println("</span> <span class="keyword">Writing</span> <span class="keyword">to</span> <span class="string">"+f.toAbsolutePath());
Files.write(f, content, Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
System.out.println("</span> <span class="string">"+f.getFileName() + "</span> <span class="keyword">conversion</span> <span class="variable">complete</span>!<span class="string">");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static boolean validNumericalConstantCharacters(int lengthOfConstant, int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='.'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='A'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)&lt;='F'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='a'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)&lt;='f'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='x'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='X';
}
private static boolean isAlphanumeric(int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)&lt;='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)&lt;='z';
}
/**
* Writes a span tag with the included class.
* **/
private static String SPAN(String className) {
return "</span>&lt;<span class="keyword">span</span> <span class="variable">class</span>=\<span class="string">""</span>+className+<span class="string">"\"</span>><span class="string">";
}
private static void GenerateArticleFiles(Iterator&lt;Path> items){
System.out.println("</span> <span class="keyword">Generating</span> <span class="keyword">article</span> <span class="class">files</span>.<span class="variable"></span>..<span class="string">");
while (items.hasNext()) {
Path f = items.next();
try {
if (Files.isRegularFile(f)&&isArticleFile(f)) {
System.out.println("</span> <span class="keyword">Creating</span> <span class="keyword">article</span> <span class="keyword">for</span> <span class="string">"+f.getFileName());
List&lt;String> content = Files.readAllLines(f);
List&lt;String> preContent = Files.readAllLines(ops.get("</span><span class="string">"));
List&lt;String> postContent = Files.readAllLines(ops.get("</span><span class="string">"));
StringBuilder sb = new StringBuilder();
for (String d : preContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("</span><span class="variable"></span>\<span class="string">");
}
for (String d : content) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
d=d.replaceFirst("</span><span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"content\"</span><span class="string">","</span><span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"expandedContent\"</span><span class="string">");
d=d.replaceFirst("</span><span class="string">","</span><span class="string">");
sb.append(d).append("</span>\<span class="string">");
}
for (String d : postContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("</span>\<span class="string">");
}
Files.write(Paths.get(f.getParent().toString(),f.getFileName()+"</span>.<span class="string">"),sb.toString().getBytes());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void ConvertArticleReferences(Iterator&lt;Path> items) {
while (items.hasNext()) {
Path f = items.next();
System.out.println("</span> <span class="keyword">Looking</span> <span class="keyword">for</span> <span class="keyword">Article</span> <span class="class">References</span>.<span class="variable"></span>..<span class="string">"+f.getFileName());
boolean articleJavascriptIncluded=false;
if (Files.isRegularFile(f)&&isHTMLFile(f)) {
System.out.println("</span> <span class="keyword">Searching</span> <span class="string">"+f.getFileName());
try {
List&lt;String> content = Files.readAllLines(f);
for (int i=0;i&lt;content.size();i++) {
String s = content.get(i);
if (s.length()>0&&s.contains("</span><span class="variable">ARTICLE</span>_<span class="string">")) {
String article = ARTICLESDIR+"</span>/<span class="string">"+s.replace("</span>ARTICLE_<span class="keyword">PREVIEW</span> <span class="string">","</span><span class="string">")+"</span><span class="variable"></span>.<span class="string">";
System.out.println("</span> <span class="keyword">Found</span> <span class="keyword">article</span> <span class="keyword">preview</span> <span class="keyword">request</span> <span class="keyword">in</span> <span class="string">"+f.getFileName()+"</span> <span class="keyword">for</span> <span class="keyword">article</span> <span class="string">"+article+"</span><span class="variable"></span>.<span class="string">");
Path file = Paths.get(OUTDIR,article);
List&lt;String> newData = Files.readAllLines(file);
if (newData.size()>0) {
content.set(i,newData.get(0));
for (int j=1;j&lt;newData.size();j++) {
content.add(i+j, newData.get(j));
}
String lastline=content.get(i+newData.size()-1);
lastline=lastline.replace("</span><span class="string">","</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"unexpanded\"</span> id=\<span class="string">"expand_"</span>+i+<span class="string">"\"</span> onClick=\<span class="string">"expand(this,'"</span>+<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="class">article</span>.<span class="function">toString</span>())+<span class="string">"')\"</span>>&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#<span class="keyword">x2908</span>; <span class="keyword">Click</span> <span class="keyword">to</span> <span class="class">expand</span>.<span class="variable"></span>&lt;/div><span class="string">");
content.set(i+newData.size()-1,lastline);//&lt;div class=\"</span>unexpanded\<span class="string">" id=\"</span>expand_<span class="string">"+i+"</span>\<span class="string">" onClick=\"</span><span class="function">expand</span>(<span class="string">"+i+"</span>)\<span class="string">">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>"</span>);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">content</span>.<span class="function">set</span>(i,<span class="string">""</span>);
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!articleJavascriptIncluded) {
List&lt;String> <span class="keyword">articlejs</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"article.js"</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="class">articlejs</span>.<span class="function">size</span>()-<span class="number">1</span>;j>=<span class="number">0</span>;j--) {
<span class="class">content</span>.<span class="function">add</span>(i,<span class="class">articlejs</span>.<span class="function">get</span>(j));
}
articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
}
}
}
<span class="class">Files</span>.<span class="function">write</span>(f,content);
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
}
}
}
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">copyDirectory</span>(<span class="keyword">String</span> <span class="variable">sourceDirectoryLocation</span>, <span class="keyword">String</span> <span class="variable">destinationDirectoryLocation</span>)
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
<span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(sourceDirectoryLocation))
.<span class="function">forEach</span>(<span class="keyword">source</span> <span class="variable"></span>-> {
<span class="keyword">Path</span> <span class="keyword">destination</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(destinationDirectoryLocation, <span class="class">source</span>.<span class="function">toString</span>()
.<span class="function">substring</span>(<span class="class">sourceDirectoryLocation</span>.<span class="function">length</span>()));
<span class="keyword">try</span> <span class="variable"></span>{
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(<span class="variable">destination</span>)) {
<span class="class">Files</span>.<span class="function">createDirectories</span>(destination);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">Files</span>.<span class="function">copy</span>(source, destination, <span class="keyword">new</span> <span class="variable">CopyOption</span>[]{<span class="class">StandardCopyOption</span>.COPY_ATTRIBUTES,<span class="class">StandardCopyOption</span>.REPLACE_EXISTING});
}
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
});
}
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">buildDirectoryListings</span>(<span class="variable"></span>)
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
<span class="keyword">String</span> <span class="variable">startingPath</span>=<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>();
HashMap&lt;String,List&lt;Path>> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>();
Iterator&lt;Path> <span class="keyword">it</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR)).<span class="function">iterator</span>();
<span class="class">map</span>.<span class="function">put</span>(<span class="string">"/"</span>,<span class="keyword">new</span> <span class="variable">ArrayList</span>&lt;Path><span class="function"></span>());
<span class="keyword">while</span> <span class="function"></span>(<span class="class">it</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">it</span>.<span class="function">next</span>();
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>().<span class="function">equals</span>(OUTDIR)) {
<span class="keyword">String</span> <span class="keyword">myKey</span> <span class="variable"></span>= <span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(startingPath,<span class="string">""</span>).<span class="function">replace</span>(<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>(),<span class="string">""</span>);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(myKey+<span class="string">","</span>+f);
<span class="class">map</span>.<span class="function">putIfAbsent</span>(myKey,<span class="keyword">new</span> <span class="variable">ArrayList</span>&lt;Path><span class="function"></span>());
<span class="class">map</span>.<span class="function">get</span>(myKey).<span class="function">add</span>(f);
}
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Directory structure determined:"</span>);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+map);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">key</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">keySet</span>()) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Creating directory listing for "</span>+key+<span class="string">"..."</span>);
<span class="keyword">StringBuilder</span> <span class="keyword">sb</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="string">""</span><span class="variable"></span>);
List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>));
List&lt;String> <span class="keyword">data2</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data) {
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;h2>Directory Listing for "</span>+key+<span class="string">"&lt;/h2>"</span>);
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"</span>folderlisting\<span class="string">">&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">" class=\"</span>icon\<span class="string">">&#x1F4C1;&lt;/a>&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">">.. &lt;/a>&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">" class=\"</span>nounderline\<span class="string">">(Previous Directory)&lt;/a>&lt;/div>"</span>);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">get</span>(key)) {
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"</span><span class="string">").append((Files.isDirectory(f)?"</span><span class="string">":"</span><span class="string">")).append("</span>\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="string">"&lt;a href=\"</span><span class="string">"+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),"</span><span class="string">"))+"</span>\<span class="string">" class=\"</span>icon\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(f)?<span class="string">"&#x1F4C1;"</span>:<span class="string">"&#x1F5CE;"</span>))
.<span class="function">append</span>(<span class="string">"&lt;/a>"</span>)
.<span class="function">append</span>(<span class="string">"&lt;a href=\"</span><span class="string">"+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),"</span><span class="string">"))+"</span>\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="class">f</span>.<span class="function">getFileName</span>())
.<span class="function">append</span>(<span class="string">"&lt;/a>\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getLastModifiedTime</span>(f))
.<span class="function">append</span>(<span class="string">"\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getOwner</span>(f))
.<span class="function">append</span>(<span class="string">"\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">size</span>(f))
.<span class="function">append</span>(<span class="string">"&lt;/div>\n"</span>);
}
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data2) {
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
<span class="keyword">Path</span> <span class="keyword">newf</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,key,DIRECTORYLISTING_FILENAME),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Added info for ("</span>+<span class="class">map</span>.<span class="function">size</span>()+<span class="string">") files to "</span>+<span class="class">newf</span>.<span class="function">toAbsolutePath</span>());
}
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isArticleFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".article"</span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isHTMLFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".html"</span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ExportCodeFile</span>(<span class="variable"></span>) {
<span class="keyword">try</span> <span class="variable"></span>{
<span class="keyword">Path</span> <span class="keyword">file</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"sigServer.java"</span>);
List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
<span class="keyword">while</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">data</span>.<span class="function">get</span>(i++).<span class="function">contains</span>(<span class="string">"sigServer()"</span>)&&i&lt;<span class="class">data</span>.<span class="function">size</span>());
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">i</span>&lt;<span class="class">data</span>.<span class="function">size</span>()) {
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="string">"codeBackground"</span>),<span class="class">data</span>.<span class="function">subList</span>(i, <span class="class">Math</span>.<span class="function">min</span>(i+<span class="number">40</span>,<span class="class">data</span>.<span class="function">size</span>())),<span class="class">Charset</span>.<span class="function">defaultCharset</span>(),<span class="class">StandardOpenOption</span>.CREATE,<span class="class">StandardOpenOption</span>.TRUNCATE_EXISTING,<span class="class">StandardOpenOption</span>.WRITE);
}
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
}
}
</pre></p>
</div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div></div>

@ -17,12 +17,12 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /articles/test articles/</h2><div class="folderlisting"><a href="/articles/test articles/.." class="icon">&#x1F4C1;</a><a href="/articles/test articles/..">.. </a><a href="/articles/test articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/test articles/test3.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article">test3.article</a> 2022-07-23T22:42:49.340859996Z niconiconii 992</div>
<div class="filelisting"><a href="/articles/test articles/test2.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-07-23T22:42:49.340859996Z niconiconii 779</div>
<div class="filelisting"><a href="/articles/test articles/test2.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article.html">test2.article.html</a> 2022-07-23T22:42:49.380859288Z niconiconii 1496</div>
<div class="filelisting"><a href="/articles/test articles/test3.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article.html">test3.article.html</a> 2022-07-23T22:42:49.380859288Z niconiconii 1709</div>
<div class="filelisting"><a href="/articles/test articles/test1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-07-23T22:42:49.384859216Z niconiconii 1800</div>
<div class="filelisting"><a href="/articles/test articles/test1.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-07-23T22:42:49.340859996Z niconiconii 1083</div>
<h2>Directory Listing for /articles/test articles/</h2><div class="folderlisting"><a href="/articles/test articles/.." class="icon">&#x1F4C1;</a><a href="/articles/test articles/..">.. </a><a href="/articles/test articles/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/articles/test articles/test3.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article">test3.article</a> 2022-07-23T23:57:42.216830485Z niconiconii 992</div>
<div class="filelisting"><a href="/articles/test articles/test2.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-07-23T23:57:42.216830485Z niconiconii 779</div>
<div class="filelisting"><a href="/articles/test articles/test2.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article.html">test2.article.html</a> 2022-07-23T23:57:42.276829394Z niconiconii 1496</div>
<div class="filelisting"><a href="/articles/test articles/test3.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test3.article.html">test3.article.html</a> 2022-07-23T23:57:42.276829394Z niconiconii 1709</div>
<div class="filelisting"><a href="/articles/test articles/test1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-07-23T23:57:42.280829319Z niconiconii 1800</div>
<div class="filelisting"><a href="/articles/test articles/test1.article" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-07-23T23:57:42.216830485Z niconiconii 1083</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out/articles/test articles/test1.article">
<p class="color4"> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
<p class="color5"> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div>%CONDITIONAL_EXPAND%</div>

@ -18,7 +18,7 @@
<body>
<div class="contentBody">
<div class="contentWrapper"><h1>A Test Title</h1><div class="expandedContent" id="content_out/articles/test articles/test1.article">
<p class="color4"> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
<p class="color5"> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div></div>
</div> <!--End Content Body-->

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out/articles/test articles/test2.article">
<p class="color4"> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
<p class="color5"> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div>%CONDITIONAL_EXPAND%</div>

@ -18,7 +18,7 @@
<body>
<div class="contentBody">
<div class="contentWrapper"><h1>Another test title</h1><div class="expandedContent" id="content_out/articles/test articles/test2.article">
<p class="color4"> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
<p class="color5"> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div></div>
</div> <!--End Content Body-->

@ -1,3 +1,3 @@
<div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out/articles/test articles/test3.article">
<p class="color3"> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
<p class="color5"> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div>%CONDITIONAL_EXPAND%</div>

@ -18,7 +18,7 @@
<body>
<div class="contentBody">
<div class="contentWrapper"><h1>And More</h1><div class="expandedContent" id="content_out/articles/test articles/test3.article">
<p class="color3"> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
<p class="color5"> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div></div>
</div> <!--End Content Body-->

@ -48,35 +48,929 @@ This is a different webpage.<hr>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"><pre>
test
test
test&<span class="keyword">lt</span>;/pre>&<span class="keyword">lt</span>;h1><span class="keyword">We</span> <span class="variable">can</span>'<span class="keyword">t</span> <span class="keyword">make</span> <span class="keyword">a</span> <span class="keyword">big</span> <span class="variable">header</span>&<span class="keyword">lt</span>;/h1>
testing
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<br/>
<p class="color3"> </p>
<br/>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<br/>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<br/>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<br/>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<br/>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<br/>
<p class="color6"> </p>
<br/>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color3"> </p>
<p class="color4"> </p>
<p class="color4"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color5"> </p>
<p class="color6"> </p>
<p class="color6"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"><pre>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">io</span>.<span class="keyword">IOException</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">charset</span>.<span class="keyword">Charset</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">CopyOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Files</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Path</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Paths</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardCopyOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardOpenOption</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">AbstractMap</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">ArrayList</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">HashMap</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Iterator</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">List</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Map</span>;<span class="variable"></span>
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="class">regex</span>.<span class="keyword">Pattern</span>;<span class="variable"></span>
<span class="keyword">public</span> <span class="keyword">class</span> <span class="keyword">sigPlace</span> <span class="variable"></span>{
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">ROOTDIR</span> <span class="variable"></span>= <span class="string">"sitefiles"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">REFDIR</span> <span class="variable"></span>= <span class="string">"ref"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">OUTDIR</span> <span class="variable"></span>= <span class="string">"out"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">ARTICLESDIR</span> <span class="variable"></span>= <span class="string">"articles"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">UPLOADSDIR</span> <span class="variable"></span>= <span class="string">"uploads"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">COMMENTSDIR</span> <span class="variable"></span>= <span class="string">"comments"</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="variable">DIRECTORYLISTING</span>_<span class="keyword">FILENAME</span> <span class="variable"></span>= <span class="string">"DIRECTORY_LISTING"</span>;
<span class="keyword">static</span> <span class="keyword">int</span> <span class="keyword">PORT</span> <span class="variable"></span>= <span class="number">8080</span>;
<span class="keyword">static</span> <span class="keyword">double</span> <span class="variable">COLOR</span>_<span class="keyword">ROTATION</span> <span class="variable"></span>= <span class="number">0</span>;
<span class="keyword">static</span> <span class="keyword">boolean</span> <span class="keyword">inCodeBlock</span> <span class="variable"></span>= <span class="number">false</span><span class="keyword"></span>;
<span class="keyword">static</span> <span class="keyword">String</span> <span class="keyword">storedCodeBlock</span> <span class="variable"></span>= <span class="string">""</span>;
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span>&lt;String,String> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>(<span class="class">Map</span>.<span class="function">ofEntries</span>(
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"SITENAME"</span>, <span class="string">"SigPlace"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"SITE_BACKCOL"</span>, <span class="string">"#111"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"TITLE_CONTENT_START"</span>, <span class="string">"&lt;div class=\"</span>contentWrapper\<span class="string">">&lt;h1>"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"TITLE_CONTENT_END"</span>, <span class="string">"&lt;/h1>&lt;div class=\"</span>content\<span class="string">" >"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"CONTENT_END"</span>, <span class="string">"&lt;/div>"</span>),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(<span class="string">"DATE_CONTENT_START"</span>, <span class="string">"&lt;div class=\"</span>datebar\<span class="string">">&lt;/div>&lt;div class=\"</span>date\<span class="string">">"</span>)
));
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span>&lt;String,Path> <span class="keyword">ops</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>(<span class="class">Map</span>.<span class="function">ofEntries</span>(
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
<span class="string">""</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"DEFAULT.html"</span>)),
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
<span class="string">""</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"FOOTER.html"</span>))
));
<span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">main</span>(<span class="variable">String</span>[] args) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">args</span>.<span class="variable">length</span>><span class="number">0</span>&&<span class="class">args</span>.length%<span class="number">2</span>==<span class="number">0</span>) {
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
<span class="keyword">while</span> <span class="function"></span>(<span class="variable">i</span>&lt;<span class="class">args</span>.length) {
<span class="keyword">String</span> <span class="variable">arg1</span>=args[i];
<span class="keyword">String</span> <span class="variable">arg2</span>=args[i+<span class="number">1</span>];
i+=<span class="number">2</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="class">arg1</span>.<span class="function">equals</span>(<span class="string">"-p"</span><span class="variable"></span>)) {
PORT=<span class="class">Integer</span>.<span class="function">parseInt</span>(arg2);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Port set to "</span>+PORT+<span class="string">"."</span>);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Invalid argument \"</span><span class="string">"+arg1+"</span>\<span class="string">"."</span>);
<span class="keyword">return</span>;
}
}
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Copying files over to output directory..."</span>);
<span class="keyword">try</span> <span class="variable"></span>{
<span class="function">copyDirectory</span>(<span class="string">"sitefiles"</span>,<span class="string">"out"</span>);
Iterator&lt;Path> <span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">filter</span>(<span class="function"></span>(p)->!<span class="class">p</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">"images/"</span>)).<span class="function">iterator</span>();
<span class="function">ParseArticleFiles</span>(items);
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">iterator</span>();
<span class="function">ConvertArticleReferences</span>(items);
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>,<span class="string">"articles"</span>)).<span class="function">iterator</span>();
<span class="function">GenerateArticleFiles</span>(items);
}<span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Copying files over failed!"</span>);
<span class="keyword">return</span>;
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Building directory listings..."</span>);
<span class="keyword">try</span> <span class="variable"></span>{
<span class="function">buildDirectoryListings</span>();
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Failed to build directory listings!"</span>);
<span class="keyword">return</span>;
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Site has been built into the "</span>+OUTDIR+<span class="string">" directory."</span>);
<span class="function">ExportCodeFile</span>();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"\nStarting web server..."</span>);
<span class="keyword">new</span> <span class="function">sigServer</span>(<span class="variable"></span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ParseArticleFiles</span>(<span class="variable">Iterator</span>&lt;Path> items) {
<span class="keyword">while</span> <span class="function"></span>(<span class="class">items</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">items</span>.<span class="function">next</span>();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isRegularFile</span>(<span class="variable">f</span>)) {
<span class="keyword">try</span> <span class="variable"></span>{
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Preparing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
List&lt;String> <span class="keyword">content</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(f);
<span class="keyword">if</span> <span class="function"></span>(<span class="function">isHTMLFile</span>(<span class="variable">f</span>)) {
<span class="class">content</span>.<span class="function">addAll</span>(<span class="number">0</span>,<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>)));
<span class="class">content</span>.<span class="function">addAll</span>(<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>)));
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Parsing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;i&lt;<span class="class">content</span>.<span class="function">size</span>();i++) {
<span class="keyword">String</span> <span class="keyword">s</span> <span class="variable"></span>= <span class="class">content</span>.<span class="function">get</span>(i);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(s);
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">length</span>(<span class="variable"></span>)><span class="number">0</span>&&<span class="function"></span>(<span class="function">isHTMLFile</span>(f)||<span class="function">isArticleFile</span>(f))) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!inCodeBlock) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"&lt;pre>"</span><span class="variable"></span>)) {
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Inside &lt;pre>"</span>);
inCodeBlock=<span class="number">true</span><span class="keyword"></span>;
storedCodeBlock=<span class="string">""</span>;
s=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;pre>"</span>));
}
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>&&<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"&lt;/pre>"</span>)) {
inCodeBlock=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">keyword</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">inString</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">inChar</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">boolean</span> <span class="variable">canBeNumericalConstant</span>=<span class="number">false</span><span class="keyword"></span>;
<span class="keyword">int</span> <span class="variable">lengthOfConstant</span>=<span class="number">0</span>;
storedCodeBlock+=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;/pre>"</span>));
storedCodeBlock=<span class="class">storedCodeBlock</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(<span class="string">"&lt;"</span>),<span class="string">"&lt;"</span>);
s+=<span class="string">"&lt;/pre>"</span>;
storedCodeBlock=<span class="string">"&lt;pre>"</span>+<span class="keyword">storedCodeBlock</span>;
<span class="keyword">int</span> <span class="variable">startPos</span>=<span class="number">0</span>;
<span class="keyword">String</span> <span class="variable">endText</span>=<span class="class">s</span>.<span class="function">substring</span>(<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"&lt;/pre>"</span>)+<span class="string">"&lt;/pre>"</span>.<span class="function">length</span>(),<span class="class">s</span>.<span class="function">length</span>());
s=<span class="string">""</span>;
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">0</span>;j&lt;<span class="class">storedCodeBlock</span>.<span class="function">length</span>();j++) {
<span class="keyword">if</span> <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)=='<span class="string">"') {
inString=!inString;
if (inString) {
s+=SPAN("</span><span class="string">")+"</span>\<span class="string">""</span>;
} <span class="keyword">else</span> <span class="variable"></span>{
s+=<span class="string">"\"</span>&lt;/span><span class="string">";
startPos=j+1;
}
} else
if (!inString&&!inChar) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
lengthOfConstant++;
System.out.println("</span><span class="keyword">Length</span> <span class="keyword">of</span> <span class="keyword">Constant</span> <span class="keyword">now</span> <span class="string">"+lengthOfConstant);
}
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span><span class="variable"></span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
//System.out.println("</span><span class="keyword">Setting</span> <span class="string">"+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
lengthOfConstant=0;
canBeNumericalConstant=false;
startPos=j+1;
} else
if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') {
//Previous section was a member.
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span><span class="variable"></span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("</span><span class="number">true</span><span class="string">")&&!isAlphanumeric(j-4)&&!isAlphanumeric(j+1)) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>&lt;/span><span class="string">";
startPos=j+1;
} else
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("</span><span class="number">false</span><span class="string">")&&!isAlphanumeric(j-5)&&!isAlphanumeric(j+1)) {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>&lt;/span><span class="string">";
startPos=j+1;
} else
if (storedCodeBlock.charAt(j)=='(') {
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') {
//Previous section was a keyword.
keyword=true;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) {
//Previous section was a keyword.
//keyword=true;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)&lt;='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)&lt;='z'||storedCodeBlock.charAt(j)==' ')) {
keyword=false;
s+=SPAN("</span><span class="string">")+storedCodeBlock.substring(startPos,j)+"</span>&lt;/span><span class="string">"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (!isAlphanumeric(j)){
if (startPos&lt;j) {
s+=storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j);
} else {
s+=storedCodeBlock.charAt(j);
}
startPos=j+1;
}
} else {
s+=storedCodeBlock.charAt(j);
startPos=j+1;
}
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9')) {
canBeNumericalConstant=false;
}
if (!canBeNumericalConstant&&!isAlphanumeric(j)) {
canBeNumericalConstant=true;
lengthOfConstant=0;
System.out.println("</span><span class="keyword">Found</span> <span class="string">"+storedCodeBlock.charAt(j)+"</span><span class="variable"></span>, <span class="keyword">can</span> <span class="keyword">be</span> <span class="class">numeric</span>.<span class="variable"></span>..<span class="string">");
}
}
s+=endText;
//System.out.println("</span><span class="keyword">Stored</span> <span class="keyword">code</span> <span class="keyword">block</span>: <span class="string">"+storedCodeBlock);
} else
if (inCodeBlock) {
storedCodeBlock+=s+"</span><span class="variable"></span>\<span class="string">";
s="</span> <span class="string">";
}
}
if (s.length()>0&&isArticleFile(f)) {
//Check for markdown pieces.
if (s.charAt(0)=='-') {
//Start of a title piece.
s=s.replace("</span>-<span class="string">",map.get("</span>TITLE_CONTENT_<span class="string">"));
s=s+map.get("</span>TITLE_CONTENT_<span class="string">").replace("</span><span class="string">","</span>id=\<span class="string">"content_"</span>+f+<span class="string">"\"</span><span class="string">");
//Use ⤈ if there's more text to be shown than can fit.
} else
if (s.contains("</span>===<span class="string">")) {
s=map.get("</span>CONTENT_<span class="string">")+map.get("</span>DATE_CONTENT_<span class="string">")+s.replace("</span>===<span class="string">","</span><span class="string">")+map.get("</span>CONTENT_<span class="string">")+"</span><span class="string">"+map.get("</span>CONTENT_<span class="string">");
} else
if (s.charAt(0)==':') {
//Image with caption.
//Format:
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption>
String[] splitter = s.split(Pattern.quote("</span>,<span class="string">"));
StringBuilder captionText = new StringBuilder(splitter[3]);
for (int j=4;j&lt;splitter.length;j++) {
captionText.append("</span>,<span class="string">").append(splitter[j]);
}
s="</span>&lt;div>&lt;<span class="keyword">figure</span> <span class="variable">style</span>=\<span class="string">"text-align:center;"</span>+<span class="function"></span>(<span class="function"></span>(splitter[<span class="number">1</span>].<span class="function">equals</span>(<span class="string">"left"</span>)||splitter[<span class="number">1</span>].<span class="function">equals</span>(<span class="string">"right"</span>))?<span class="string">"width:"</span>+splitter[<span class="number">2</span>]+<span class="string">"%;float:"</span>+splitter[<span class="number">1</span>]+<span class="string">";"</span>:<span class="string">""</span>)+<span class="string">"\"</span>>&lt;<span class="keyword">img</span> <span class="variable">src</span>=\<span class="string">"/"</span>+splitter[<span class="number">0</span>].<span class="function">substring</span>(<span class="number">1</span>)+<span class="string">"\"</span> style=\<span class="string">"margin:auto;width:100%;\"</span>>&lt;figcaption><span class="string">"+captionText.toString()+"</span>&lt;/figcaption>&lt;/figure>&lt;/div><span class="string">";
} else {
//It's regular content, so add paragraphs.
s="</span>&lt;<span class="keyword">p</span> <span class="variable">class</span>=\<span class="string">"color"</span>+<span class="function"></span>(<span class="function"></span>(<span class="function"></span>(int)<span class="function"></span>(COLOR_ROTATION=<span class="function"></span>(COLOR_ROTATION+0.<span class="number">4</span>)%<span class="number">6</span>))+<span class="number">1</span>)+<span class="string">"\"</span>><span class="string">"+s+"</span>&lt;/p><span class="string">";
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="</span>&lt;br/><span class="string">"; //Setup a line break here.
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
}
content.set(i,s);
}
System.out.println("</span> <span class="keyword">Writing</span> <span class="keyword">to</span> <span class="string">"+f.toAbsolutePath());
Files.write(f, content, Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
System.out.println("</span> <span class="string">"+f.getFileName() + "</span> <span class="keyword">conversion</span> <span class="variable">complete</span>!<span class="string">");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static boolean validNumericalConstantCharacters(int lengthOfConstant, int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='.'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='A'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)&lt;='F'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='a'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)&lt;='f'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='x'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='X';
}
private static boolean isAlphanumeric(int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)&lt;='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)&lt;='z';
}
/**
* Writes a span tag with the included class.
* **/
private static String SPAN(String className) {
return "</span>&lt;<span class="keyword">span</span> <span class="variable">class</span>=\<span class="string">""</span>+className+<span class="string">"\"</span>><span class="string">";
}
private static void GenerateArticleFiles(Iterator&lt;Path> items){
System.out.println("</span> <span class="keyword">Generating</span> <span class="keyword">article</span> <span class="class">files</span>.<span class="variable"></span>..<span class="string">");
while (items.hasNext()) {
Path f = items.next();
try {
if (Files.isRegularFile(f)&&isArticleFile(f)) {
System.out.println("</span> <span class="keyword">Creating</span> <span class="keyword">article</span> <span class="keyword">for</span> <span class="string">"+f.getFileName());
List&lt;String> content = Files.readAllLines(f);
List&lt;String> preContent = Files.readAllLines(ops.get("</span><span class="string">"));
List&lt;String> postContent = Files.readAllLines(ops.get("</span><span class="string">"));
StringBuilder sb = new StringBuilder();
for (String d : preContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("</span><span class="variable"></span>\<span class="string">");
}
for (String d : content) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
d=d.replaceFirst("</span><span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"content\"</span><span class="string">","</span><span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"expandedContent\"</span><span class="string">");
d=d.replaceFirst("</span><span class="string">","</span><span class="string">");
sb.append(d).append("</span>\<span class="string">");
}
for (String d : postContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("</span>\<span class="string">");
}
Files.write(Paths.get(f.getParent().toString(),f.getFileName()+"</span>.<span class="string">"),sb.toString().getBytes());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void ConvertArticleReferences(Iterator&lt;Path> items) {
while (items.hasNext()) {
Path f = items.next();
System.out.println("</span> <span class="keyword">Looking</span> <span class="keyword">for</span> <span class="keyword">Article</span> <span class="class">References</span>.<span class="variable"></span>..<span class="string">"+f.getFileName());
boolean articleJavascriptIncluded=false;
if (Files.isRegularFile(f)&&isHTMLFile(f)) {
System.out.println("</span> <span class="keyword">Searching</span> <span class="string">"+f.getFileName());
try {
List&lt;String> content = Files.readAllLines(f);
for (int i=0;i&lt;content.size();i++) {
String s = content.get(i);
if (s.length()>0&&s.contains("</span><span class="variable">ARTICLE</span>_<span class="string">")) {
String article = ARTICLESDIR+"</span>/<span class="string">"+s.replace("</span>ARTICLE_<span class="keyword">PREVIEW</span> <span class="string">","</span><span class="string">")+"</span><span class="variable"></span>.<span class="string">";
System.out.println("</span> <span class="keyword">Found</span> <span class="keyword">article</span> <span class="keyword">preview</span> <span class="keyword">request</span> <span class="keyword">in</span> <span class="string">"+f.getFileName()+"</span> <span class="keyword">for</span> <span class="keyword">article</span> <span class="string">"+article+"</span><span class="variable"></span>.<span class="string">");
Path file = Paths.get(OUTDIR,article);
List&lt;String> newData = Files.readAllLines(file);
if (newData.size()>0) {
content.set(i,newData.get(0));
for (int j=1;j&lt;newData.size();j++) {
content.add(i+j, newData.get(j));
}
String lastline=content.get(i+newData.size()-1);
lastline=lastline.replace("</span><span class="string">","</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"unexpanded\"</span> id=\<span class="string">"expand_"</span>+i+<span class="string">"\"</span> onClick=\<span class="string">"expand(this,'"</span>+<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="class">article</span>.<span class="function">toString</span>())+<span class="string">"')\"</span>>&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#<span class="keyword">x2908</span>; <span class="keyword">Click</span> <span class="keyword">to</span> <span class="class">expand</span>.<span class="variable"></span>&lt;/div><span class="string">");
content.set(i+newData.size()-1,lastline);//&lt;div class=\"</span>unexpanded\<span class="string">" id=\"</span>expand_<span class="string">"+i+"</span>\<span class="string">" onClick=\"</span><span class="function">expand</span>(<span class="string">"+i+"</span>)\<span class="string">">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>"</span>);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">content</span>.<span class="function">set</span>(i,<span class="string">""</span>);
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!articleJavascriptIncluded) {
List&lt;String> <span class="keyword">articlejs</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"article.js"</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="class">articlejs</span>.<span class="function">size</span>()-<span class="number">1</span>;j>=<span class="number">0</span>;j--) {
<span class="class">content</span>.<span class="function">add</span>(i,<span class="class">articlejs</span>.<span class="function">get</span>(j));
}
articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
}
}
}
<span class="class">Files</span>.<span class="function">write</span>(f,content);
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
}
}
}
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">copyDirectory</span>(<span class="keyword">String</span> <span class="variable">sourceDirectoryLocation</span>, <span class="keyword">String</span> <span class="variable">destinationDirectoryLocation</span>)
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
<span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(sourceDirectoryLocation))
.<span class="function">forEach</span>(<span class="keyword">source</span> <span class="variable"></span>-> {
<span class="keyword">Path</span> <span class="keyword">destination</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(destinationDirectoryLocation, <span class="class">source</span>.<span class="function">toString</span>()
.<span class="function">substring</span>(<span class="class">sourceDirectoryLocation</span>.<span class="function">length</span>()));
<span class="keyword">try</span> <span class="variable"></span>{
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(<span class="variable">destination</span>)) {
<span class="class">Files</span>.<span class="function">createDirectories</span>(destination);
} <span class="keyword">else</span> <span class="variable"></span>{
<span class="class">Files</span>.<span class="function">copy</span>(source, destination, <span class="keyword">new</span> <span class="variable">CopyOption</span>[]{<span class="class">StandardCopyOption</span>.COPY_ATTRIBUTES,<span class="class">StandardCopyOption</span>.REPLACE_EXISTING});
}
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
});
}
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">buildDirectoryListings</span>(<span class="variable"></span>)
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
<span class="keyword">String</span> <span class="variable">startingPath</span>=<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>();
HashMap&lt;String,List&lt;Path>> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span>&lt;><span class="function"></span>();
Iterator&lt;Path> <span class="keyword">it</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR)).<span class="function">iterator</span>();
<span class="class">map</span>.<span class="function">put</span>(<span class="string">"/"</span>,<span class="keyword">new</span> <span class="variable">ArrayList</span>&lt;Path><span class="function"></span>());
<span class="keyword">while</span> <span class="function"></span>(<span class="class">it</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">it</span>.<span class="function">next</span>();
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>().<span class="function">equals</span>(OUTDIR)) {
<span class="keyword">String</span> <span class="keyword">myKey</span> <span class="variable"></span>= <span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(startingPath,<span class="string">""</span>).<span class="function">replace</span>(<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>(),<span class="string">""</span>);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(myKey+<span class="string">","</span>+f);
<span class="class">map</span>.<span class="function">putIfAbsent</span>(myKey,<span class="keyword">new</span> <span class="variable">ArrayList</span>&lt;Path><span class="function"></span>());
<span class="class">map</span>.<span class="function">get</span>(myKey).<span class="function">add</span>(f);
}
}
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Directory structure determined:"</span>);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+map);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">key</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">keySet</span>()) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Creating directory listing for "</span>+key+<span class="string">"..."</span>);
<span class="keyword">StringBuilder</span> <span class="keyword">sb</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="string">""</span><span class="variable"></span>);
List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>));
List&lt;String> <span class="keyword">data2</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">""</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data) {
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;h2>Directory Listing for "</span>+key+<span class="string">"&lt;/h2>"</span>);
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"</span>folderlisting\<span class="string">">&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">" class=\"</span>icon\<span class="string">">&#x1F4C1;&lt;/a>&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">">.. &lt;/a>&lt;a href=\"</span><span class="string">")
.append(key)
.append("</span>..\<span class="string">" class=\"</span>nounderline\<span class="string">">(Previous Directory)&lt;/a>&lt;/div>"</span>);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">get</span>(key)) {
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"</span><span class="string">").append((Files.isDirectory(f)?"</span><span class="string">":"</span><span class="string">")).append("</span>\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="string">"&lt;a href=\"</span><span class="string">"+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),"</span><span class="string">"))+"</span>\<span class="string">" class=\"</span>icon\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(f)?<span class="string">"&#x1F4C1;"</span>:<span class="string">"&#x1F5CE;"</span>))
.<span class="function">append</span>(<span class="string">"&lt;/a>"</span>)
.<span class="function">append</span>(<span class="string">"&lt;a href=\"</span><span class="string">"+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),"</span><span class="string">"))+"</span>\<span class="string">">"</span>)
.<span class="function">append</span>(<span class="class">f</span>.<span class="function">getFileName</span>())
.<span class="function">append</span>(<span class="string">"&lt;/a>\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getLastModifiedTime</span>(f))
.<span class="function">append</span>(<span class="string">"\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getOwner</span>(f))
.<span class="function">append</span>(<span class="string">"\t"</span>)
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">size</span>(f))
.<span class="function">append</span>(<span class="string">"&lt;/div>\n"</span>);
}
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data2) {
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
<span class="keyword">Path</span> <span class="keyword">newf</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,key,DIRECTORYLISTING_FILENAME),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Added info for ("</span>+<span class="class">map</span>.<span class="function">size</span>()+<span class="string">") files to "</span>+<span class="class">newf</span>.<span class="function">toAbsolutePath</span>());
}
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isArticleFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".article"</span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isHTMLFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".html"</span>);
}
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ExportCodeFile</span>(<span class="variable"></span>) {
<span class="keyword">try</span> <span class="variable"></span>{
<span class="keyword">Path</span> <span class="keyword">file</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"sigServer.java"</span>);
List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
<span class="keyword">while</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">data</span>.<span class="function">get</span>(i++).<span class="function">contains</span>(<span class="string">"sigServer()"</span>)&&i&lt;<span class="class">data</span>.<span class="function">size</span>());
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">i</span>&lt;<span class="class">data</span>.<span class="function">size</span>()) {
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="string">"codeBackground"</span>),<span class="class">data</span>.<span class="function">subList</span>(i, <span class="class">Math</span>.<span class="function">min</span>(i+<span class="number">40</span>,<span class="class">data</span>.<span class="function">size</span>())),<span class="class">Charset</span>.<span class="function">defaultCharset</span>(),<span class="class">StandardOpenOption</span>.CREATE,<span class="class">StandardOpenOption</span>.TRUNCATE_EXISTING,<span class="class">StandardOpenOption</span>.WRITE);
}
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
<span class="class">e</span>.<span class="function">printStackTrace</span>();
}
}
}
</pre></p>
</div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div><div class="unexpanded" id="expand_20" onClick="expand(this,'out/articles/sigplace1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out/articles/test articles/test1.article">
<p class="color4"> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div><div class="unexpanded" id="expand_57" onClick="expand(this,'out/articles/test articles/test1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<p class="color5"> In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.</p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div><div class="unexpanded" id="expand_955" onClick="expand(this,'out/articles/test articles/test1.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out/articles/test articles/test2.article">
<p class="color4"> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div><div class="unexpanded" id="expand_60" onClick="expand(this,'out/articles/test articles/test2.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<p class="color5"> Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.</p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div><div class="unexpanded" id="expand_958" onClick="expand(this,'out/articles/test articles/test2.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out/articles/test articles/test3.article">
<p class="color3"> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div><div class="unexpanded" id="expand_63" onClick="expand(this,'out/articles/test articles/test3.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<p class="color5"> Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.</p>
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div><div class="unexpanded" id="expand_961" onClick="expand(this,'out/articles/test articles/test3.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out/articles/curabitur vel tempus ex.article">
<p class="color1">Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
<p class="color3">Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.</p>
<br/>
<p class="color1"> </p>
<p class="color2"> </p>
<p class="color2"> </p>
<p class="color3"> </p>
<p class="color3"><pre>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">4</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">4</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"false"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">5</span>)&&!<span class="function">isAlphanumeric</span>(j+<span class="number">1</span>)) {
s+=<span class="function">SPAN</span>(<span class="string">"number"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">"</span>"</span>;
startPos=j+<span class="number">1</span>;
}</pre> </p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div><div class="unexpanded" id="expand_66" onClick="expand(this,'out/articles/curabitur vel tempus ex.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<p class="color4"> </p>
<p class="color4"><pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre> </p>
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div><div class="unexpanded" id="expand_964" onClick="expand(this,'out/articles/curabitur vel tempus ex.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

Binary file not shown.

@ -112,24 +112,27 @@ public class sigPlace {
System.out.println(" Parsing "+f.getFileName());
for (int i=0;i<content.size();i++) {
String s = content.get(i);
boolean isPreLine=false;
//System.out.println(s);
if (s.length()>0&&(isHTMLFile(f)||isArticleFile(f))) {
if (!inCodeBlock) {
if (s.contains("<pre>")) {
if (s.trim().equals("<pre>")) {
//System.out.println("Inside <pre>");
inCodeBlock=true;
storedCodeBlock=s.substring(s.indexOf("<pre>"));
storedCodeBlock="";
s=s.substring(0,s.indexOf("<pre>"));
}
}
if (inCodeBlock&&s.contains("</pre>")) {
if (inCodeBlock&&s.trim().equals("</pre>")) {
inCodeBlock=false;
boolean keyword=false;
boolean inString=false;
boolean inChar=false;
boolean canBeNumericalConstant=false;
int lengthOfConstant=0;
storedCodeBlock+=s.substring(0,s.indexOf("</pre>")+"</pre>".length());
storedCodeBlock+=s.substring(0,s.indexOf("</pre>"));
storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2");
storedCodeBlock+="</pre>";
int startPos=0;
String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length());
s="";
@ -210,7 +213,14 @@ public class sigPlace {
System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
}
}
for (int j=0;j<s.length();j++) {
if (s.charAt(j)=='\2') {
s=s.substring(0,j)+"&lt;"+s.substring(j+1,s.length());
}
}
s="<pre>"+s;
s+=endText;
isPreLine=true;
//System.out.println("Stored code block: "+storedCodeBlock);
} else
if (inCodeBlock) {
@ -226,7 +236,7 @@ public class sigPlace {
s=s+map.get("$TITLE_CONTENT_END").replace("%ID%","id=\"content_"+f+"\"");
//Use ⤈ if there's more text to be shown than can fit.
} else
if (s.contains("===")) {
if (s.startsWith("===")) {
s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END");
} else
if (s.charAt(0)==':') {
@ -243,12 +253,15 @@ public class sigPlace {
//It's regular content, so add paragraphs.
s="<p class=\"color"+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"\">"+s+"</p>";
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="<br/>"; //Setup a line break here.
} else {
if (s.length()==0&&isArticleFile(f)) {
s="<br/>"; //Setup a line break here.
}
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
if (!isPreLine) {
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
}
}
content.set(i,s);
}

@ -2,8 +2,6 @@
Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.
<pre>
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("false")&&!isAlphanumeric(j-5)&&!isAlphanumeric(j+1)) {
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
startPos=j+1;
}</pre>
<><Test>"</test></test2><test3>"
</pre>
===29 Apr 2022 7:37PM

@ -16,9 +16,467 @@ Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesen
Here we demonstrate the love live logo. But wait, it's literally like in the middle wtf is going on.Here we demonstrate the love live logo. But wait, it's literally like in the middle wtf is going on.Here we demonstrate the love live logo. But wait, it's literally like in the middle wtf is going on.
<pre>
test
test
test&lt;/pre>&lt;h1>We can't make a big header&lt;/h1>
testing
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class sigPlace {
final static String ROOTDIR = "sitefiles";
final static String REFDIR = "ref";
final static String OUTDIR = "out";
final static String ARTICLESDIR = "articles";
final static String UPLOADSDIR = "uploads";
final static String COMMENTSDIR = "comments";
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
static int PORT = 8080;
static double COLOR_ROTATION = 0;
static boolean inCodeBlock = false;
static String storedCodeBlock = "";
final static HashMap<String,String> map = new HashMap<>(Map.ofEntries(
new AbstractMap.SimpleEntry<>("SITENAME", "SigPlace"),
new AbstractMap.SimpleEntry<>("SITE_BACKCOL", "#111"),
new AbstractMap.SimpleEntry<>("TITLE_CONTENT_START", "<div class=\"contentWrapper\"><h1>"),
new AbstractMap.SimpleEntry<>("TITLE_CONTENT_END", "</h1><div class=\"content\" >"),
new AbstractMap.SimpleEntry<>("CONTENT_END", "</div>"),
new AbstractMap.SimpleEntry<>("DATE_CONTENT_START", "<div class=\"datebar\"></div><div class=\"date\">")
));
final static HashMap<String,Path> ops = new HashMap<>(Map.ofEntries(
new AbstractMap.SimpleEntry<>(
"", Paths.get(REFDIR,"DEFAULT.html")),
new AbstractMap.SimpleEntry<>(
"", Paths.get(REFDIR,"FOOTER.html"))
));
public static void main(String[] args) {
if (args.length>0&&args.length%2==0) {
int i=0;
while (i<args.length) {
String arg1=args[i];
String arg2=args[i+1];
i+=2;
if (arg1.equals("-p")) {
PORT=Integer.parseInt(arg2);
System.out.println("Port set to "+PORT+".");
} else {
System.err.println("Invalid argument \""+arg1+"\".");
return;
}
}
}
System.out.println("Copying files over to output directory...");
try {
copyDirectory("sitefiles","out");
Iterator<Path> items = Files.walk(Paths.get("out")).filter((p)->!p.toAbsolutePath().toString().contains("images/")).iterator();
ParseArticleFiles(items);
items = Files.walk(Paths.get("out")).iterator();
ConvertArticleReferences(items);
items = Files.walk(Paths.get("out","articles")).iterator();
GenerateArticleFiles(items);
}catch (IOException e) {
e.printStackTrace();
System.err.println("Copying files over failed!");
return;
}
System.out.println("Building directory listings...");
try {
buildDirectoryListings();
} catch (IOException e) {
e.printStackTrace();
System.err.println("Failed to build directory listings!");
return;
}
System.out.println("Site has been built into the "+OUTDIR+" directory.");
ExportCodeFile();
System.out.println("\nStarting web server...");
new sigServer();
}
private static void ParseArticleFiles(Iterator<Path> items) {
while (items.hasNext()) {
Path f = items.next();
System.out.println(" Found "+f.getFileName());
if (Files.isRegularFile(f)) {
try {
System.out.println(" Preparing "+f.getFileName());
List<String> content = Files.readAllLines(f);
if (isHTMLFile(f)) {
content.addAll(0,Files.readAllLines(ops.get("")));
content.addAll(Files.readAllLines(ops.get("")));
}
System.out.println(" Parsing "+f.getFileName());
for (int i=0;i<content.size();i++) {
String s = content.get(i);
//System.out.println(s);
if (s.length()>0&&(isHTMLFile(f)||isArticleFile(f))) {
if (!inCodeBlock) {
if (s.contains("<pre>")) {
//System.out.println("Inside <pre>");
inCodeBlock=true;
storedCodeBlock="";
s=s.substring(0,s.indexOf("<pre>"));
}
}
if (inCodeBlock&&s.contains("</pre>")) {
inCodeBlock=false;
boolean keyword=false;
boolean inString=false;
boolean inChar=false;
boolean canBeNumericalConstant=false;
int lengthOfConstant=0;
storedCodeBlock+=s.substring(0,s.indexOf("</pre>"));
storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"&lt;");
s+="</pre>";
storedCodeBlock="<pre>"+storedCodeBlock;
int startPos=0;
String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length());
s="";
for (int j=0;j<storedCodeBlock.length();j++) {
if (storedCodeBlock.charAt(j)=='"') {
inString=!inString;
if (inString) {
s+=SPAN("string")+"\"";
} else {
s+="\"</span>";
startPos=j+1;
}
} else
if (!inString&&!inChar) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
lengthOfConstant++;
System.out.println("Length of Constant now "+lengthOfConstant);
}
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) {
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
//System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
lengthOfConstant=0;
canBeNumericalConstant=false;
startPos=j+1;
} else
if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') {
//Previous section was a member.
s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("true")&&!isAlphanumeric(j-4)&&!isAlphanumeric(j+1)) {
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
startPos=j+1;
} else
if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("false")&&!isAlphanumeric(j-5)&&!isAlphanumeric(j+1)) {
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
startPos=j+1;
} else
if (storedCodeBlock.charAt(j)=='(') {
s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') {
//Previous section was a keyword.
keyword=true;
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) {
//Previous section was a keyword.
//keyword=true;
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) {
keyword=false;
s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1;
} else
if (!isAlphanumeric(j)){
if (startPos<j) {
s+=storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j);
} else {
s+=storedCodeBlock.charAt(j);
}
startPos=j+1;
}
} else {
s+=storedCodeBlock.charAt(j);
startPos=j+1;
}
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) {
canBeNumericalConstant=false;
}
if (!canBeNumericalConstant&&!isAlphanumeric(j)) {
canBeNumericalConstant=true;
lengthOfConstant=0;
System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
}
}
s+=endText;
//System.out.println("Stored code block: "+storedCodeBlock);
} else
if (inCodeBlock) {
storedCodeBlock+=s+"\n";
s=" ";
}
}
if (s.length()>0&&isArticleFile(f)) {
//Check for markdown pieces.
if (s.charAt(0)=='-') {
//Start of a title piece.
s=s.replace("-",map.get("TITLE_CONTENT_START"));
s=s+map.get("TITLE_CONTENT_END").replace("","id=\"content_"+f+"\"");
//Use ⤈ if there's more text to be shown than can fit.
} else
if (s.contains("===")) {
s=map.get("CONTENT_END")+map.get("DATE_CONTENT_START")+s.replace("===","")+map.get("CONTENT_END")+""+map.get("CONTENT_END");
} else
if (s.charAt(0)==':') {
//Image with caption.
//Format:
//:<url>,<left|right|center>,<width>,<caption>
String[] splitter = s.split(Pattern.quote(","));
StringBuilder captionText = new StringBuilder(splitter[3]);
for (int j=4;j<splitter.length;j++) {
captionText.append(",").append(splitter[j]);
}
s="<div><figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\"><img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\"><figcaption>"+captionText.toString()+"</figcaption></figure></div>";
} else {
//It's regular content, so add paragraphs.
s="<p class=\"color"+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"\">"+s+"</p>";
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="<br/>"; //Setup a line break here.
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
}
content.set(i,s);
}
System.out.println(" Writing to "+f.toAbsolutePath());
Files.write(f, content, Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
System.out.println(" "+f.getFileName() + " conversion complete!");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static boolean validNumericalConstantCharacters(int lengthOfConstant, int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='.'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='A'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<='F'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='a'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<='f'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='x'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='X';
}
private static boolean isAlphanumeric(int j) {
return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z';
}
/**
* Writes a span tag with the included class.
* **/
private static String SPAN(String className) {
return "<span class=\""+className+"\">";
}
private static void GenerateArticleFiles(Iterator<Path> items){
System.out.println(" Generating article files...");
while (items.hasNext()) {
Path f = items.next();
try {
if (Files.isRegularFile(f)&&isArticleFile(f)) {
System.out.println(" Creating article for "+f.getFileName());
List<String> content = Files.readAllLines(f);
List<String> preContent = Files.readAllLines(ops.get(""));
List<String> postContent = Files.readAllLines(ops.get(""));
StringBuilder sb = new StringBuilder();
for (String d : preContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("\n");
}
for (String d : content) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
d=d.replaceFirst("div class=\"content\"","div class=\"expandedContent\"");
d=d.replaceFirst("","");
sb.append(d).append("\n");
}
for (String d : postContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("\n");
}
Files.write(Paths.get(f.getParent().toString(),f.getFileName()+".html"),sb.toString().getBytes());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void ConvertArticleReferences(Iterator<Path> items) {
while (items.hasNext()) {
Path f = items.next();
System.out.println(" Looking for Article References..."+f.getFileName());
boolean articleJavascriptIncluded=false;
if (Files.isRegularFile(f)&&isHTMLFile(f)) {
System.out.println(" Searching "+f.getFileName());
try {
List<String> content = Files.readAllLines(f);
for (int i=0;i<content.size();i++) {
String s = content.get(i);
if (s.length()>0&&s.contains("ARTICLE_PREVIEW")) {
String article = ARTICLESDIR+"/"+s.replace("ARTICLE_PREVIEW ","")+".article";
System.out.println(" Found article preview request in "+f.getFileName()+" for article "+article+".");
Path file = Paths.get(OUTDIR,article);
List<String> newData = Files.readAllLines(file);
if (newData.size()>0) {
content.set(i,newData.get(0));
for (int j=1;j<newData.size();j++) {
content.add(i+j, newData.get(j));
}
String lastline=content.get(i+newData.size()-1);
lastline=lastline.replace("","<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand(this,'"+Paths.get(OUTDIR,article.toString())+"')\"><br/><br/><br/><br/>&#x2908; Click to expand.</div>");
content.set(i+newData.size()-1,lastline);//<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\"><br/><br/><br/><br/>&#x2908; Click to expand.</div>");
} else {
content.set(i,"");
}
if (!articleJavascriptIncluded) {
List<String> articlejs = Files.readAllLines(Paths.get(REFDIR,"article.js"));
for (int j=articlejs.size()-1;j>=0;j--) {
content.add(i,articlejs.get(j));
}
articleJavascriptIncluded=true;
}
}
}
Files.write(f,content);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation)
throws IOException {
Files.walk(Paths.get(sourceDirectoryLocation))
.forEach(source -> {
Path destination = Paths.get(destinationDirectoryLocation, source.toString()
.substring(sourceDirectoryLocation.length()));
try {
if (Files.isDirectory(destination)) {
Files.createDirectories(destination);
} else {
Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING});
}
} catch (IOException e) {
e.printStackTrace();
}
});
}
static void buildDirectoryListings()
throws IOException {
String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString();
HashMap<String,List<Path>> map = new HashMap<>();
Iterator<Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator();
map.put("/",new ArrayList<Path>());
while (it.hasNext()) {
Path f = it.next();
if (!f.getFileName().toString().equals(OUTDIR)) {
String myKey = f.toAbsolutePath().toString().replace(startingPath,"").replace(f.getFileName().toString(),"");
//System.out.println(myKey+","+f);
map.putIfAbsent(myKey,new ArrayList<Path>());
map.get(myKey).add(f);
}
}
System.out.println("Directory structure determined:");
System.out.println(" "+map);
for (String key : map.keySet()) {
System.out.println("Creating directory listing for "+key+"...");
StringBuilder sb = new StringBuilder("");
List<String> data = Files.readAllLines(ops.get(""));
List<String> data2 = Files.readAllLines(ops.get(""));
for (String d : data) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("\n");
}
sb.append("<h2>Directory Listing for "+key+"</h2>");
sb.append("<div class=\"folderlisting\"><a href=\"")
.append(key)
.append("..\" class=\"icon\">&#x1F4C1;</a><a href=\"")
.append(key)
.append("..\">.. </a><a href=\"")
.append(key)
.append("..\" class=\"nounderline\">(Previous Directory)</a></div>");
for (Path f : map.get(key)) {
sb.append("<div class=\"").append((Files.isDirectory(f)?"folderlisting":"filelisting")).append("\">")
.append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\" class=\"icon\">")
.append((Files.isDirectory(f)?"&#x1F4C1;":"&#x1F5CE;"))
.append("</a>")
.append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\">")
.append(f.getFileName())
.append("</a>\t")
.append(Files.getLastModifiedTime(f))
.append("\t")
.append(Files.getOwner(f))
.append("\t")
.append(Files.size(f))
.append("</div>\n");
}
for (String d : data2) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
sb.append(d).append("\n");
}
Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes());
System.out.println(" Added info for ("+map.size()+") files to "+newf.toAbsolutePath());
}
}
private static boolean isArticleFile(Path f) {
return f.getFileName().toString().contains(".article");
}
private static boolean isHTMLFile(Path f) {
return f.getFileName().toString().contains(".html");
}
private static void ExportCodeFile() {
try {
Path file = Paths.get("sigServer.java");
List<String> data = Files.readAllLines(file);
int i=0;
while (!data.get(i++).contains("sigServer()")&&i<data.size());
if (i<data.size()) {
Files.write(Paths.get(OUTDIR,"codeBackground"),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
</pre>
===3 May 2022 10:25AM
Loading…
Cancel
Save