differentiate string parsing

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent ba85f01113
commit f38db58c74
  1. 16
      out/DIRECTORY_LISTING
  2. 14
      out/articles/DIRECTORY_LISTING
  3. 4
      out/articles/curabitur vel tempus ex.article
  4. 4
      out/articles/curabitur vel tempus ex.article.html
  5. 520
      out/articles/sigplace1.article
  6. 520
      out/articles/sigplace1.article.html
  7. 12
      out/articles/test articles/DIRECTORY_LISTING
  8. 2
      out/articles/test articles/test1.article
  9. 2
      out/articles/test articles/test1.article.html
  10. 2
      out/articles/test articles/test2.article
  11. 2
      out/articles/test articles/test2.article.html
  12. 2
      out/articles/test articles/test3.article
  13. 2
      out/articles/test articles/test3.article.html
  14. 2
      out/images/DIRECTORY_LISTING
  15. 988
      out/otherpage.html
  16. BIN
      sigPlace.class
  17. 6
      sigPlace.java
  18. BIN
      sigServer.class

@ -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-24T00:27:54.916308747Z niconiconii 1093</div>
<div class="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-07-24T00:27:55.628296037Z niconiconii 4096</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-07-24T00:27:55.568297107Z niconiconii 884</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-07-24T00:27:55.564297179Z niconiconii 6238</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-07-24T00:27:55.568297107Z niconiconii 804</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-07-24T00:27:55.576296965Z niconiconii 70355</div>
<div class="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-07-24T00:27:55.624296107Z niconiconii 4096</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-07-24T00:27:55.568297107Z 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="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-07-26T15:21:39.694961518Z codespace 4096</div>
<div class="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-07-26T15:21:39.690961447Z codespace 4096</div>
<div class="filelisting"><a href="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-07-26T15:21:39.618960169Z codespace 884</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-07-26T15:21:39.594959742Z codespace 2635</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-07-26T15:21:39.598959813Z codespace 941</div>
<div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-07-26T15:21:39.598959813Z codespace 1093</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-07-26T15:21:39.614960098Z codespace 6238</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-07-26T15:21:39.626960311Z codespace 804</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-24T00:27:55.552297393Z niconiconii 65060</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-24T00:27:55.616296251Z niconiconii 1214</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-24T00:27:55.604296465Z niconiconii 65777</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-24T00:27:55.556297321Z niconiconii 734</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-07-24T00:27:55.612296322Z 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-24T00:27:55.604296465Z niconiconii 1451</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-24T00:27:55.560297251Z niconiconii 497</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/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-26T15:21:39.626960311Z codespace 1214</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-26T15:21:39.03894987Z codespace 497</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-26T15:21:39.678961234Z codespace 74556</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-26T15:21:39.054950154Z codespace 734</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-07-26T15:21:39.646960666Z codespace 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-26T15:21:39.638960524Z codespace 1451</div>
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-07-26T15:21:39.590959671Z codespace 73839</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -1,11 +1,11 @@
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out/articles/curabitur vel tempus ex.article">
<p class="color5">
<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>
<br/>
<p class="color5">
<p class="color2">
<pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre>

@ -18,13 +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="color5">
<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>
<br/>
<p class="color5">
<p class="color2">
<pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre>

@ -1,35 +1,35 @@
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_out/articles/sigplace1.article">
<p class="color1">
<p class="color3">
This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.
</p>
<p class="color1">
<p class="color4">
Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.
</p>
<p class="color2">
<p class="color4">
A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.
</p>
<p class="color2">
<p class="color4">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In feugiat, urna ut sollicitudin luctus, nulla magna faucibus mauris, at semper nisl nisi ut mauris. Vestibulum cursus tortor velit, ut congue ex porta in. Nullam hendrerit risus sit amet neque euismod faucibus. Sed ac diam non lectus euismod pulvinar eu non mauris. Donec accumsan nisl efficitur, sodales lectus et, finibus quam. Sed vel consectetur leo. Cras ut condimentum quam. Aliquam molestie viverra congue. Donec scelerisque nibh ac nulla dictum semper. Aliquam id massa a massa bibendum finibus id ac sapien. Integer vitae ullamcorper enim, non semper massa.
</p>
<br/>
<p class="color3">
<p class="color5">
Proin cursus sodales elit, vitae volutpat mi fermentum a. In vitae magna quis leo cursus accumsan id facilisis purus. Vestibulum accumsan iaculis turpis eu sollicitudin. Sed ultricies felis non elit suscipit interdum. Maecenas sollicitudin turpis justo, vel pretium sapien scelerisque eget. Nullam sagittis finibus risus ut aliquam. Praesent quam orci, dapibus ut ex ac, sodales dapibus nunc.
</p>
<br/>
<p class="color3">
<p class="color5">
Fusce magna risus, iaculis non justo sit amet, semper sodales urna. Morbi eu eros lectus. Integer euismod venenatis eros a hendrerit. Nulla ultricies lectus nec quam condimentum fermentum. Quisque a turpis vitae orci pharetra ullamcorper. Nunc fringilla vitae nunc a aliquam. In aliquam gravida massa. Sed imperdiet dignissim sapien, ullamcorper rutrum lacus convallis ut.
</p>
<br/>
<p class="color3">
<p class="color6">
Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.
</p>
<br/>
<p class="color4">
<p class="color6">
Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.
</p>
<br/>
<div><figure style="text-align:center;width:30%;float:right;"><img src="/images/Love_Live!_Logo.png" style="margin:auto;width:100%;"><figcaption>Hello there! You can see this is the Love Live logo indeed! It is quite smol right now but that's okay. Let's keep on going with the text. If the caption is really long and with commas, they will now be combined,,,,,see how that works? Amazing!</figcaption></figure></div>
<p class="color4">
<p class="color1">
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.
</p>
<br/>
@ -496,7 +496,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<p class="color4">
<p class="color1">
<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>
@ -622,322 +622,322 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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;
<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">"""</span>) {
inString=!<span class="keyword">inString</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inString</span>) {
s+=<span class="function">SPAN</span>(<span class="string">"string"</span>)+<span class="string">"\"</span><span class="string">";
} else {
s+="</span>\<span class="string">"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>;
}
} else
if (!inString&&!inChar) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!inString&&!inChar) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&<span class="function">validNumericalConstantCharacters</span>(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;
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Length of Constant now "</span>+lengthOfConstant);
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&lengthOfConstant><span class="number">0</span>&&!<span class="function"></span>(<span class="function">validNumericalConstantCharacters</span>(lengthOfConstant, j))) {
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="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Setting "</span>+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j));
lengthOfConstant=<span class="number">0</span>;
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
startPos=j+<span class="number">1</span>;
} 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;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"."</span>) {
//<span class="keyword">Previous</span> <span class="keyword">section</span> <span class="keyword">was</span> <span class="keyword">a</span> <span class="class">member</span>.<span class="variable"></span>
s+=<span class="function">SPAN</span>(<span class="string">"class"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">3</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">3</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"true"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">4</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">"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<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">"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<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">"("</span>) {
s+=<span class="function">SPAN</span>(<span class="string">"function"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">0</span>&&<span class="function">isAlphanumeric</span>(j-<span class="number">1</span>) && <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">" "</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j-<span class="number">1</span>)!=<span class="string">" "</span>) {
//<span class="keyword">Previous</span> <span class="keyword">section</span> <span class="keyword">was</span> <span class="keyword">a</span> <span class="class">keyword</span>.<span class="variable"></span>
keyword=<span class="number">true</span><span class="keyword"></span>;
s+=<span class="function">SPAN</span>(<span class="string">"keyword"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">0</span>&&<span class="function">isAlphanumeric</span>(j-<span class="number">1</span>) && <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">";"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">":"</span>)) {
//<span class="keyword">Previous</span> <span class="keyword">section</span> <span class="keyword">was</span> <span class="keyword">a</span> <span class="class">keyword</span>.<span class="variable"></span>
//keyword=<span class="number">true</span><span class="keyword"></span>;
s+=<span class="function">SPAN</span>(<span class="string">"keyword"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">keyword</span>&&!<span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"A"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"Z"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"a"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"z"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">" "</span>)) {
keyword=<span class="number">false</span><span class="keyword"></span>;
s+=<span class="function">SPAN</span>(<span class="string">"variable"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} 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);
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="function">isAlphanumeric</span>(j)){
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">startPos</span>&lt;j) {
s+=<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="keyword">else</span> <span class="variable"></span>{
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
}
startPos=j+1;
startPos=j+<span class="number">1</span>;
}
} else {
s+=storedCodeBlock.charAt(j);
startPos=j+1;
} <span class="keyword">else</span> <span class="variable"></span>{
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
}
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9')) {
canBeNumericalConstant=false;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&lengthOfConstant==<span class="number">0</span>&&!<span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>)) {
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
}
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">");
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&!<span class="function">isAlphanumeric</span>(j)) {
canBeNumericalConstant=<span class="number">true</span><span class="keyword"></span>;
lengthOfConstant=<span class="number">0</span>;
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Found "</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">", can be numeric..."</span>);
}
}
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>%ID%<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.
s+=<span class="keyword">endText</span>;
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Stored code block: "</span>+storedCodeBlock);
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) {
storedCodeBlock+=s+<span class="string">"\n"</span>;
s=<span class="string">" "</span>;
}
}
<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">isArticleFile</span>(f)) {
//<span class="keyword">Check</span> <span class="keyword">for</span> <span class="keyword">markdown</span> <span class="class">pieces</span>.<span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">charAt</span>(<span class="number">0</span>)<span class="variable"></span>==<span class="string">"-"</span>) {
//<span class="keyword">Start</span> <span class="keyword">of</span> <span class="keyword">a</span> <span class="keyword">title</span> <span class="class">piece</span>.<span class="variable"></span>
s=<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"-"</span>,<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$TITLE_CONTENT_START"</span>));
s=s+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$TITLE_CONTENT_END"</span>).<span class="function">replace</span>(<span class="string">"%ID%"</span>,<span class="string">"id=\"</span>content_<span class="string">"+f+"</span>\<span class="string">""</span>);
//<span class="keyword">Use</span> <span class="variable"></span>⤈ <span class="keyword">if</span> <span class="string">"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>%CONDITIONAL_EXPAND%<span class="string">"+map.get("</span>$CONTENT_<span class="string">");
if (s.contains("===")) {
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)==':') {
if (s.charAt(0)=="</span><span class="variable"></span>:<span class="string">") {
//Image with caption.
//Format:
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption>
String[] splitter = s.split(Pattern.quote("</span>,<span class="string">"));
String[] splitter = s.split(Pattern.quote(","));
StringBuilder captionText = new StringBuilder(splitter[3]);
for (int j=4;j&lt;splitter.length;j++) {
captionText.append("</span>,<span class="string">").append(splitter[j]);
captionText.append(",").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">";
s="&lt;div>&lt;figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\">&lt;img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\">&lt;figcaption>"+captionText.toString()+"&lt;/figcaption>&lt;/figure>&lt;/div>";
} 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">";
//It"</span><span class="keyword">s</span> <span class="keyword">regular</span> <span class="variable">content</span>, <span class="keyword">so</span> <span class="keyword">add</span> <span class="class">paragraphs</span>.<span class="variable"></span>
s=<span class="string">"&lt;p class=\"</span><span class="string">"+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"</span>\<span class="string">">"</span>+s+<span class="string">"&lt;/p>"</span>;
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="</span>&lt;br/><span class="string">"; //Setup a line break here.
} <span class="keyword">else</span> <span class="variable"></span>
<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">isArticleFile</span>(f)) {
s=<span class="string">"&lt;br/>"</span>; //<span class="keyword">Setup</span> <span class="keyword">a</span> <span class="keyword">line</span> <span class="keyword">break</span> <span class="class">here</span>.<span class="variable"></span>
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
<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>()) {
s=<span class="class">s</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(key),<span class="class">map</span>.<span class="function">get</span>(key));
}
content.set(i,s);
<span class="class">content</span>.<span class="function">set</span>(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);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Writing to "</span>+<span class="class">f</span>.<span class="function">toAbsolutePath</span>());
<span class="class">Files</span>.<span class="function">write</span>(f, content, <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);
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();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+<span class="class">f</span>.<span class="function">getFileName</span>() + <span class="string">" conversion complete!"</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>();
}
}
}
}
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';
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">validNumericalConstantCharacters</span>(<span class="keyword">int</span> <span class="variable">lengthOfConstant</span>, <span class="keyword">int</span> <span class="variable">j</span>) {
<span class="keyword">return</span> <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"."</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"A"</span>&&lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"F"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"a"</span>&&lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"f"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"x"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"X"</span>;
}
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';
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isAlphanumeric</span>(<span class="keyword">int</span> <span class="variable">j</span>) {
<span class="keyword">return</span> <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"A"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"Z"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"a"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"z"</span>;
}
/**
* Writes a span tag with the included class.
* <span class="keyword">Writes</span> <span class="keyword">a</span> <span class="keyword">span</span> <span class="keyword">tag</span> <span class="keyword">with</span> <span class="keyword">the</span> <span class="keyword">included</span> <span class="class">class</span>.<span class="variable"></span>
* **/
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">";
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="function">SPAN</span>(<span class="keyword">String</span> <span class="variable">className</span>) {
<span class="keyword">return</span> <span class="string">"&lt;span class=\"</span><span class="string">"+className+"</span><span class="variable"></span>\<span class="string">">"</span>;
}
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="variable"></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));
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">GenerateArticleFiles</span>(<span class="variable">Iterator</span>&lt;Path> items){
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Generating article files..."</span>);
<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="keyword">try</span> <span class="variable"></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="function">isArticleFile</span>(f)) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Creating article for "</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);
List&lt;String> <span class="keyword">preContent</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">"%DEFAULT"</span>));
List&lt;String> <span class="keyword">postContent</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">"%FOOTER"</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="variable"></span>);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: preContent) {
<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));
}
sb.append(d).append("</span>\<span class="string">");
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
for (String d : content) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: content) {
<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));
}
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>%CONDITIONAL_EXPAND%<span class="string">","</span><span class="string">");
sb.append(d).append("</span>\<span class="string">");
d=<span class="class">d</span>.<span class="function">replaceFirst</span>(<span class="string">"div class=\"</span>content\<span class="string">""</span>,<span class="string">"div class=\"</span>expandedContent\<span class="string">""</span>);
d=<span class="class">d</span>.<span class="function">replaceFirst</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">""</span>);
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
for (String d : postContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: postContent) {
<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));
}
sb.append(d).append("</span>\<span class="string">");
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
Files.write(Paths.get(f.getParent().toString(),f.getFileName()+"</span>.<span class="string">"),sb.toString().getBytes());
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">f</span>.<span class="function">getParent</span>().<span class="function">toString</span>(),<span class="class">f</span>.<span class="function">getFileName</span>()+<span class="string">".html"</span>),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
}
} catch (IOException e) {
e.printStackTrace();
} <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>();
}
}
}
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"></span>$ARTICLE_<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>%CONDITIONAL_EXPAND%<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">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ConvertArticleReferences</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">" Looking for Article References..."</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">boolean</span> <span class="variable">articleJavascriptIncluded</span>=<span class="number">false</span><span class="keyword"></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="function">isHTMLFile</span>(f)) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Searching "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">try</span> <span class="variable"></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">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="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="class">s</span>.<span class="function">contains</span>(<span class="string">"$ARTICLE_PREVIEW"</span>)) {
<span class="keyword">String</span> <span class="keyword">article</span> <span class="variable"></span>= ARTICLESDIR+<span class="string">"/"</span>+<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"$ARTICLE_PREVIEW "</span>,<span class="string">""</span>)+<span class="string">".article"</span>;
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found article preview request in "</span>+<span class="class">f</span>.<span class="function">getFileName</span>()+<span class="string">" for article "</span>+article+<span class="string">"."</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>(OUTDIR,article);
List&lt;String> <span class="keyword">newData</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
<span class="keyword">if</span> <span class="function"></span>(<span class="class">newData</span>.<span class="function">size</span>(<span class="variable"></span>)><span class="number">0</span>) {
<span class="class">content</span>.<span class="function">set</span>(i,<span class="class">newData</span>.<span class="function">get</span>(<span class="number">0</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">1</span>;j&lt;<span class="class">newData</span>.<span class="function">size</span>();j++) {
<span class="class">content</span>.<span class="function">add</span>(i+j, <span class="class">newData</span>.<span class="function">get</span>(j));
}
<span class="keyword">String</span> <span class="variable">lastline</span>=<span class="class">content</span>.<span class="function">get</span>(i+<span class="class">newData</span>.<span class="function">size</span>()-<span class="number">1</span>);
lastline=<span class="class">lastline</span>.<span class="function">replace</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">"&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>(this,<span class="string">""+Paths.get(OUTDIR,article.toString())+""</span>)\<span class="string">">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>"</span>);
<span class="class">content</span>.<span class="function">set</span>(i+<span class="class">newData</span>.<span class="function">size</span>()-<span class="number">1</span>,lastline);//&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("</span>+i+<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">");
} else {
content.set(i,"</span><span class="string">");
}
<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));
if (!articleJavascriptIncluded) {
List&lt;String> articlejs = Files.readAllLines(Paths.get(REFDIR,"</span><span class="class">article</span>.<span class="string">"));
for (int j=articlejs.size()-1;j>=0;j--) {
content.add(i,articlejs.get(j));
}
articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
articleJavascriptIncluded=true;
}
}
}
<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>();
Files.write(f,content);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
<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});
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});
}
} <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>();
} catch (IOException e) {
e.printStackTrace();
}
});
}
<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">"%DEFAULT"</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">"%FOOTER"</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));
static void buildDirectoryListings()
throws IOException {
String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString();
HashMap&lt;String,List&lt;Path>> map = new HashMap&lt;>();
Iterator&lt;Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator();
map.put("</span>/<span class="string">",new ArrayList&lt;Path>());
while (it.hasNext()) {
Path f = it.next();
if (!f.getFileName().toString().equals(OUTDIR)) {
String myKey = f.toAbsolutePath().toString().replace(startingPath,"</span><span class="string">").replace(f.getFileName().toString(),"</span><span class="string">");
//System.out.println(myKey+"</span>,<span class="string">"+f);
map.putIfAbsent(myKey,new ArrayList&lt;Path>());
map.get(myKey).add(f);
}
}
System.out.println("</span><span class="keyword">Directory</span> <span class="keyword">structure</span> <span class="keyword">determined</span>:<span class="string">");
System.out.println("</span> <span class="string">"+map);
for (String key : map.keySet()) {
System.out.println("</span><span class="keyword">Creating</span> <span class="keyword">directory</span> <span class="keyword">listing</span> <span class="keyword">for</span> <span class="string">"+key+"</span><span class="variable"></span>...<span class="string">");
StringBuilder sb = new StringBuilder("</span><span class="string">");
List&lt;String> data = Files.readAllLines(ops.get("</span>%<span class="string">"));
List&lt;String> data2 = Files.readAllLines(ops.get("</span>%<span class="string">"));
for (String d : data) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
sb.append(d).append("</span>\<span class="string">");
}
<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));
sb.append("</span>&lt;h2><span class="keyword">Directory</span> <span class="keyword">Listing</span> <span class="keyword">for</span> <span class="string">"+key+"</span><span class="variable"></span>&lt;/h2><span class="string">");
sb.append("</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"folderlisting\"</span>>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>)
.<span class="function">append</span>(key)
.<span class="function">append</span>(<span class="string">"..\"</span> class=\<span class="string">"icon\"</span>>&#<span class="keyword">x1F4C1</span>;&lt;/a>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>)
.<span class="function">append</span>(key)
.<span class="function">append</span>(<span class="string">"..\"</span>>.. &lt;/a>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>)
.<span class="function">append</span>(key)
.<span class="function">append</span>(<span class="string">"..\"</span> class=\<span class="string">"nounderline\"</span>><span class="function"></span>(<span class="keyword">Previous</span> <span class="variable">Directory</span>)&lt;/a>&lt;/div><span class="string">");
for (Path f : map.get(key)) {
sb.append("</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<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">"folderlisting"</span>:<span class="string">"filelisting"</span>)).<span class="function">append</span>(<span class="string">"\"</span>><span class="string">")
.append("</span>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>+<span class="function"></span>(<span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>(),<span class="string">""</span>))+<span class="string">"\"</span> class=\<span class="string">"icon\"</span>><span class="string">")
.append((Files.isDirectory(f)?"</span>&#<span class="keyword">x1F4C1</span>;<span class="string">":"</span>&#<span class="keyword">x1F5CE</span>;<span class="string">"))
.append("</span>&lt;/a><span class="string">")
.append("</span>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>+<span class="function"></span>(<span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>(),<span class="string">""</span>))+<span class="string">"\"</span>><span class="string">")
.append(f.getFileName())
.append("</span>&lt;/a>\<span class="string">")
.append(Files.getLastModifiedTime(f))
.append("</span>\<span class="string">")
.append(Files.getOwner(f))
.append("</span>\<span class="string">")
.append(Files.size(f))
.append("</span>&lt;/div>\<span class="string">");
}
for (String d : data2) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
sb.append(d).append("</span>\<span class="string">");
}
<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>());
Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes());
System.out.println("</span> <span class="keyword">Added</span> <span class="keyword">info</span> <span class="keyword">for</span> <span class="function"></span>(<span class="string">"+map.size()+"</span><span class="variable"></span>) <span class="keyword">files</span> <span class="keyword">to</span> <span class="string">"+newf.toAbsolutePath());
}
}
<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>);
private static boolean isArticleFile(Path f) {
return f.getFileName().toString().contains("</span><span class="variable"></span>.<span class="string">");
}
<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>);
private static boolean isHTMLFile(Path f) {
return f.getFileName().toString().contains("</span>.<span class="string">");
}
<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);
private static void ExportCodeFile() {
try {
Path file = Paths.get("</span><span class="class">sigServer</span>.<span class="string">");
List&lt;String> data = Files.readAllLines(file);
int i=0;
while (!data.get(i++).contains("</span><span class="function">sigServer</span>()<span class="string">")&&i&lt;data.size());
if (i&lt;data.size()) {
Files.write(Paths.get(OUTDIR,"</span><span class="string">"),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.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>();
} catch (IOException e) {
e.printStackTrace();
}
}

@ -18,37 +18,37 @@
<body>
<div class="contentBody">
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="expandedContent" id="content_out/articles/sigplace1.article">
<p class="color1">
<p class="color3">
This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.
</p>
<p class="color1">
<p class="color4">
Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.
</p>
<p class="color2">
<p class="color4">
A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.
</p>
<p class="color2">
<p class="color4">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In feugiat, urna ut sollicitudin luctus, nulla magna faucibus mauris, at semper nisl nisi ut mauris. Vestibulum cursus tortor velit, ut congue ex porta in. Nullam hendrerit risus sit amet neque euismod faucibus. Sed ac diam non lectus euismod pulvinar eu non mauris. Donec accumsan nisl efficitur, sodales lectus et, finibus quam. Sed vel consectetur leo. Cras ut condimentum quam. Aliquam molestie viverra congue. Donec scelerisque nibh ac nulla dictum semper. Aliquam id massa a massa bibendum finibus id ac sapien. Integer vitae ullamcorper enim, non semper massa.
</p>
<br/>
<p class="color3">
<p class="color5">
Proin cursus sodales elit, vitae volutpat mi fermentum a. In vitae magna quis leo cursus accumsan id facilisis purus. Vestibulum accumsan iaculis turpis eu sollicitudin. Sed ultricies felis non elit suscipit interdum. Maecenas sollicitudin turpis justo, vel pretium sapien scelerisque eget. Nullam sagittis finibus risus ut aliquam. Praesent quam orci, dapibus ut ex ac, sodales dapibus nunc.
</p>
<br/>
<p class="color3">
<p class="color5">
Fusce magna risus, iaculis non justo sit amet, semper sodales urna. Morbi eu eros lectus. Integer euismod venenatis eros a hendrerit. Nulla ultricies lectus nec quam condimentum fermentum. Quisque a turpis vitae orci pharetra ullamcorper. Nunc fringilla vitae nunc a aliquam. In aliquam gravida massa. Sed imperdiet dignissim sapien, ullamcorper rutrum lacus convallis ut.
</p>
<br/>
<p class="color3">
<p class="color6">
Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.
</p>
<br/>
<p class="color4">
<p class="color6">
Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.
</p>
<br/>
<div><figure style="text-align:center;width:30%;float:right;"><img src="/images/Love_Live!_Logo.png" style="margin:auto;width:100%;"><figcaption>Hello there! You can see this is the Love Live logo indeed! It is quite smol right now but that's okay. Let's keep on going with the text. If the caption is really long and with commas, they will now be combined,,,,,see how that works? Amazing!</figcaption></figure></div>
<p class="color4">
<p class="color1">
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.
</p>
<br/>
@ -515,7 +515,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<p class="color4">
<p class="color1">
<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>
@ -641,322 +641,322 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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;
<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">"""</span>) {
inString=!<span class="keyword">inString</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inString</span>) {
s+=<span class="function">SPAN</span>(<span class="string">"string"</span>)+<span class="string">"\"</span><span class="string">";
} else {
s+="</span>\<span class="string">"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>;
}
} else
if (!inString&&!inChar) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!inString&&!inChar) {
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&<span class="function">validNumericalConstantCharacters</span>(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;
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Length of Constant now "</span>+lengthOfConstant);
}
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&lengthOfConstant><span class="number">0</span>&&!<span class="function"></span>(<span class="function">validNumericalConstantCharacters</span>(lengthOfConstant, j))) {
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="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Setting "</span>+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j));
lengthOfConstant=<span class="number">0</span>;
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
startPos=j+<span class="number">1</span>;
} 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;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"."</span>) {
//<span class="keyword">Previous</span> <span class="keyword">section</span> <span class="keyword">was</span> <span class="keyword">a</span> <span class="class">member</span>.<span class="variable"></span>
s+=<span class="function">SPAN</span>(<span class="string">"class"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">3</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">3</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"true"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">4</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">"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<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">"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<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">"("</span>) {
s+=<span class="function">SPAN</span>(<span class="string">"function"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">0</span>&&<span class="function">isAlphanumeric</span>(j-<span class="number">1</span>) && <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">" "</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j-<span class="number">1</span>)!=<span class="string">" "</span>) {
//<span class="keyword">Previous</span> <span class="keyword">section</span> <span class="keyword">was</span> <span class="keyword">a</span> <span class="class">keyword</span>.<span class="variable"></span>
keyword=<span class="number">true</span><span class="keyword"></span>;
s+=<span class="function">SPAN</span>(<span class="string">"keyword"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">0</span>&&<span class="function">isAlphanumeric</span>(j-<span class="number">1</span>) && <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">";"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">":"</span>)) {
//<span class="keyword">Previous</span> <span class="keyword">section</span> <span class="keyword">was</span> <span class="keyword">a</span> <span class="class">keyword</span>.<span class="variable"></span>
//keyword=<span class="number">true</span><span class="keyword"></span>;
s+=<span class="function">SPAN</span>(<span class="string">"keyword"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">keyword</span>&&!<span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"A"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"Z"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"a"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"z"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">" "</span>)) {
keyword=<span class="number">false</span><span class="keyword"></span>;
s+=<span class="function">SPAN</span>(<span class="string">"variable"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"&lt;/span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
} 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);
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="function">isAlphanumeric</span>(j)){
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">startPos</span>&lt;j) {
s+=<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="keyword">else</span> <span class="variable"></span>{
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
}
startPos=j+1;
startPos=j+<span class="number">1</span>;
}
} else {
s+=storedCodeBlock.charAt(j);
startPos=j+1;
} <span class="keyword">else</span> <span class="variable"></span>{
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>;
}
if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)&lt;='9')) {
canBeNumericalConstant=false;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&lengthOfConstant==<span class="number">0</span>&&!<span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>)) {
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
}
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">");
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&!<span class="function">isAlphanumeric</span>(j)) {
canBeNumericalConstant=<span class="number">true</span><span class="keyword"></span>;
lengthOfConstant=<span class="number">0</span>;
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Found "</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">", can be numeric..."</span>);
}
}
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>%ID%<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.
s+=<span class="keyword">endText</span>;
//<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Stored code block: "</span>+storedCodeBlock);
} <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) {
storedCodeBlock+=s+<span class="string">"\n"</span>;
s=<span class="string">" "</span>;
}
}
<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">isArticleFile</span>(f)) {
//<span class="keyword">Check</span> <span class="keyword">for</span> <span class="keyword">markdown</span> <span class="class">pieces</span>.<span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">charAt</span>(<span class="number">0</span>)<span class="variable"></span>==<span class="string">"-"</span>) {
//<span class="keyword">Start</span> <span class="keyword">of</span> <span class="keyword">a</span> <span class="keyword">title</span> <span class="class">piece</span>.<span class="variable"></span>
s=<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"-"</span>,<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$TITLE_CONTENT_START"</span>));
s=s+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$TITLE_CONTENT_END"</span>).<span class="function">replace</span>(<span class="string">"%ID%"</span>,<span class="string">"id=\"</span>content_<span class="string">"+f+"</span>\<span class="string">""</span>);
//<span class="keyword">Use</span> <span class="variable"></span><span class="keyword">if</span> <span class="string">"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>%CONDITIONAL_EXPAND%<span class="string">"+map.get("</span>$CONTENT_<span class="string">");
if (s.contains("===")) {
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)==':') {
if (s.charAt(0)=="</span><span class="variable"></span>:<span class="string">") {
//Image with caption.
//Format:
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption>
String[] splitter = s.split(Pattern.quote("</span>,<span class="string">"));
String[] splitter = s.split(Pattern.quote(","));
StringBuilder captionText = new StringBuilder(splitter[3]);
for (int j=4;j&lt;splitter.length;j++) {
captionText.append("</span>,<span class="string">").append(splitter[j]);
captionText.append(",").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">";
s="&lt;div>&lt;figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\">&lt;img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\">&lt;figcaption>"+captionText.toString()+"&lt;/figcaption>&lt;/figure>&lt;/div>";
} 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">";
//It"</span><span class="keyword">s</span> <span class="keyword">regular</span> <span class="variable">content</span>, <span class="keyword">so</span> <span class="keyword">add</span> <span class="class">paragraphs</span>.<span class="variable"></span>
s=<span class="string">"&lt;p class=\"</span><span class="string">"+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"</span>\<span class="string">">"</span>+s+<span class="string">"&lt;/p>"</span>;
}
} else
if (s.length()==0&&isArticleFile(f)) {
s="</span>&lt;br/><span class="string">"; //Setup a line break here.
} <span class="keyword">else</span> <span class="variable"></span>
<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">isArticleFile</span>(f)) {
s=<span class="string">"&lt;br/>"</span>; //<span class="keyword">Setup</span> <span class="keyword">a</span> <span class="keyword">line</span> <span class="keyword">break</span> <span class="class">here</span>.<span class="variable"></span>
}
for (String key : map.keySet()) {
s=s.replaceAll(Pattern.quote(key),map.get(key));
<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>()) {
s=<span class="class">s</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(key),<span class="class">map</span>.<span class="function">get</span>(key));
}
content.set(i,s);
<span class="class">content</span>.<span class="function">set</span>(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);
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Writing to "</span>+<span class="class">f</span>.<span class="function">toAbsolutePath</span>());
<span class="class">Files</span>.<span class="function">write</span>(f, content, <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);
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();
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+<span class="class">f</span>.<span class="function">getFileName</span>() + <span class="string">" conversion complete!"</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>();
}
}
}
}
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';
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">validNumericalConstantCharacters</span>(<span class="keyword">int</span> <span class="variable">lengthOfConstant</span>, <span class="keyword">int</span> <span class="variable">j</span>) {
<span class="keyword">return</span> <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"."</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"A"</span>&&lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"F"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"a"</span>&&lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"f"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"x"</span>||lengthOfConstant><span class="number">0</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">"X"</span>;
}
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';
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isAlphanumeric</span>(<span class="keyword">int</span> <span class="variable">j</span>) {
<span class="keyword">return</span> <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)>=<span class="string">"0"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"9"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"A"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"Z"</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">"a"</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)&lt;=<span class="string">"z"</span>;
}
/**
* Writes a span tag with the included class.
* <span class="keyword">Writes</span> <span class="keyword">a</span> <span class="keyword">span</span> <span class="keyword">tag</span> <span class="keyword">with</span> <span class="keyword">the</span> <span class="keyword">included</span> <span class="class">class</span>.<span class="variable"></span>
* **/
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">";
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">String</span> <span class="function">SPAN</span>(<span class="keyword">String</span> <span class="variable">className</span>) {
<span class="keyword">return</span> <span class="string">"&lt;span class=\"</span><span class="string">"+className+"</span><span class="variable"></span>\<span class="string">">"</span>;
}
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="variable"></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));
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">GenerateArticleFiles</span>(<span class="variable">Iterator</span>&lt;Path> items){
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Generating article files..."</span>);
<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="keyword">try</span> <span class="variable"></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="function">isArticleFile</span>(f)) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Creating article for "</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);
List&lt;String> <span class="keyword">preContent</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">"%DEFAULT"</span>));
List&lt;String> <span class="keyword">postContent</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">"%FOOTER"</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="variable"></span>);
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: preContent) {
<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));
}
sb.append(d).append("</span>\<span class="string">");
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
for (String d : content) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: content) {
<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));
}
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>%CONDITIONAL_EXPAND%<span class="string">","</span><span class="string">");
sb.append(d).append("</span>\<span class="string">");
d=<span class="class">d</span>.<span class="function">replaceFirst</span>(<span class="string">"div class=\"</span>content\<span class="string">""</span>,<span class="string">"div class=\"</span>expandedContent\<span class="string">""</span>);
d=<span class="class">d</span>.<span class="function">replaceFirst</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">""</span>);
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
for (String d : postContent) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: postContent) {
<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));
}
sb.append(d).append("</span>\<span class="string">");
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
}
Files.write(Paths.get(f.getParent().toString(),f.getFileName()+"</span>.<span class="string">"),sb.toString().getBytes());
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">f</span>.<span class="function">getParent</span>().<span class="function">toString</span>(),<span class="class">f</span>.<span class="function">getFileName</span>()+<span class="string">".html"</span>),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
}
} catch (IOException e) {
e.printStackTrace();
} <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>();
}
}
}
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"></span>$ARTICLE_<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>%CONDITIONAL_EXPAND%<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">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ConvertArticleReferences</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">" Looking for Article References..."</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">boolean</span> <span class="variable">articleJavascriptIncluded</span>=<span class="number">false</span><span class="keyword"></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="function">isHTMLFile</span>(f)) {
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Searching "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
<span class="keyword">try</span> <span class="variable"></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">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="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="class">s</span>.<span class="function">contains</span>(<span class="string">"$ARTICLE_PREVIEW"</span>)) {
<span class="keyword">String</span> <span class="keyword">article</span> <span class="variable"></span>= ARTICLESDIR+<span class="string">"/"</span>+<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"$ARTICLE_PREVIEW "</span>,<span class="string">""</span>)+<span class="string">".article"</span>;
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found article preview request in "</span>+<span class="class">f</span>.<span class="function">getFileName</span>()+<span class="string">" for article "</span>+article+<span class="string">"."</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>(OUTDIR,article);
List&lt;String> <span class="keyword">newData</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
<span class="keyword">if</span> <span class="function"></span>(<span class="class">newData</span>.<span class="function">size</span>(<span class="variable"></span>)><span class="number">0</span>) {
<span class="class">content</span>.<span class="function">set</span>(i,<span class="class">newData</span>.<span class="function">get</span>(<span class="number">0</span>));
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">1</span>;j&lt;<span class="class">newData</span>.<span class="function">size</span>();j++) {
<span class="class">content</span>.<span class="function">add</span>(i+j, <span class="class">newData</span>.<span class="function">get</span>(j));
}
<span class="keyword">String</span> <span class="variable">lastline</span>=<span class="class">content</span>.<span class="function">get</span>(i+<span class="class">newData</span>.<span class="function">size</span>()-<span class="number">1</span>);
lastline=<span class="class">lastline</span>.<span class="function">replace</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">"&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>(this,<span class="string">""+Paths.get(OUTDIR,article.toString())+""</span>)\<span class="string">">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>"</span>);
<span class="class">content</span>.<span class="function">set</span>(i+<span class="class">newData</span>.<span class="function">size</span>()-<span class="number">1</span>,lastline);//&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("</span>+i+<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">");
} else {
content.set(i,"</span><span class="string">");
}
<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));
if (!articleJavascriptIncluded) {
List&lt;String> articlejs = Files.readAllLines(Paths.get(REFDIR,"</span><span class="class">article</span>.<span class="string">"));
for (int j=articlejs.size()-1;j>=0;j--) {
content.add(i,articlejs.get(j));
}
articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
articleJavascriptIncluded=true;
}
}
}
<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>();
Files.write(f,content);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
<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});
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});
}
} <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>();
} catch (IOException e) {
e.printStackTrace();
}
});
}
<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">"%DEFAULT"</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">"%FOOTER"</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));
static void buildDirectoryListings()
throws IOException {
String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString();
HashMap&lt;String,List&lt;Path>> map = new HashMap&lt;>();
Iterator&lt;Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator();
map.put("</span>/<span class="string">",new ArrayList&lt;Path>());
while (it.hasNext()) {
Path f = it.next();
if (!f.getFileName().toString().equals(OUTDIR)) {
String myKey = f.toAbsolutePath().toString().replace(startingPath,"</span><span class="string">").replace(f.getFileName().toString(),"</span><span class="string">");
//System.out.println(myKey+"</span>,<span class="string">"+f);
map.putIfAbsent(myKey,new ArrayList&lt;Path>());
map.get(myKey).add(f);
}
}
System.out.println("</span><span class="keyword">Directory</span> <span class="keyword">structure</span> <span class="keyword">determined</span>:<span class="string">");
System.out.println("</span> <span class="string">"+map);
for (String key : map.keySet()) {
System.out.println("</span><span class="keyword">Creating</span> <span class="keyword">directory</span> <span class="keyword">listing</span> <span class="keyword">for</span> <span class="string">"+key+"</span><span class="variable"></span>...<span class="string">");
StringBuilder sb = new StringBuilder("</span><span class="string">");
List&lt;String> data = Files.readAllLines(ops.get("</span>%<span class="string">"));
List&lt;String> data2 = Files.readAllLines(ops.get("</span>%<span class="string">"));
for (String d : data) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
sb.append(d).append("</span>\<span class="string">");
}
<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));
sb.append("</span>&lt;h2><span class="keyword">Directory</span> <span class="keyword">Listing</span> <span class="keyword">for</span> <span class="string">"+key+"</span><span class="variable"></span>&lt;/h2><span class="string">");
sb.append("</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<span class="string">"folderlisting\"</span>>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>)
.<span class="function">append</span>(key)
.<span class="function">append</span>(<span class="string">"..\"</span> class=\<span class="string">"icon\"</span>>&#<span class="keyword">x1F4C1</span>;&lt;/a>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>)
.<span class="function">append</span>(key)
.<span class="function">append</span>(<span class="string">"..\"</span>>.. &lt;/a>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>)
.<span class="function">append</span>(key)
.<span class="function">append</span>(<span class="string">"..\"</span> class=\<span class="string">"nounderline\"</span>><span class="function"></span>(<span class="keyword">Previous</span> <span class="variable">Directory</span>)&lt;/a>&lt;/div><span class="string">");
for (Path f : map.get(key)) {
sb.append("</span>&lt;<span class="keyword">div</span> <span class="variable">class</span>=\<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">"folderlisting"</span>:<span class="string">"filelisting"</span>)).<span class="function">append</span>(<span class="string">"\"</span>><span class="string">")
.append("</span>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>+<span class="function"></span>(<span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>(),<span class="string">""</span>))+<span class="string">"\"</span> class=\<span class="string">"icon\"</span>><span class="string">")
.append((Files.isDirectory(f)?"</span>&#<span class="keyword">x1F4C1</span>;<span class="string">":"</span>&#<span class="keyword">x1F5CE</span>;<span class="string">"))
.append("</span>&lt;/a><span class="string">")
.append("</span>&lt;<span class="keyword">a</span> <span class="variable">href</span>=\<span class="string">""</span>+<span class="function"></span>(<span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>(),<span class="string">""</span>))+<span class="string">"\"</span>><span class="string">")
.append(f.getFileName())
.append("</span>&lt;/a>\<span class="string">")
.append(Files.getLastModifiedTime(f))
.append("</span>\<span class="string">")
.append(Files.getOwner(f))
.append("</span>\<span class="string">")
.append(Files.size(f))
.append("</span>&lt;/div>\<span class="string">");
}
for (String d : data2) {
for (String k : sigPlace.map.keySet()) {
d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k));
}
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
sb.append(d).append("</span>\<span class="string">");
}
<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>());
Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes());
System.out.println("</span> <span class="keyword">Added</span> <span class="keyword">info</span> <span class="keyword">for</span> <span class="function"></span>(<span class="string">"+map.size()+"</span><span class="variable"></span>) <span class="keyword">files</span> <span class="keyword">to</span> <span class="string">"+newf.toAbsolutePath());
}
}
<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>);
private static boolean isArticleFile(Path f) {
return f.getFileName().toString().contains("</span><span class="variable"></span>.<span class="string">");
}
<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>);
private static boolean isHTMLFile(Path f) {
return f.getFileName().toString().contains("</span>.<span class="string">");
}
<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);
private static void ExportCodeFile() {
try {
Path file = Paths.get("</span><span class="class">sigServer</span>.<span class="string">");
List&lt;String> data = Files.readAllLines(file);
int i=0;
while (!data.get(i++).contains("</span><span class="function">sigServer</span>()<span class="string">")&&i&lt;data.size());
if (i&lt;data.size()) {
Files.write(Paths.get(OUTDIR,"</span><span class="string">"),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.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>();
} catch (IOException e) {
e.printStackTrace();
}
}

@ -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-24T00:27:55.556297321Z niconiconii 994</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-24T00:27:55.556297321Z niconiconii 781</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-24T00:27:55.608296393Z niconiconii 1498</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-24T00:27:55.608296393Z niconiconii 1711</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-24T00:27:55.612296322Z niconiconii 1802</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-24T00:27:55.560297251Z niconiconii 1085</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/test1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-07-26T15:21:39.642960595Z codespace 1802</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-26T15:21:39.058950225Z codespace 994</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-26T15:21:39.646960666Z codespace 1498</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-26T15:21:39.642960595Z codespace 1711</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-26T15:21:39.058950225Z codespace 1085</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-26T15:21:39.062950296Z codespace 781</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -1,5 +1,5 @@
<div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out/articles/test articles/test1.article">
<p class="color1">
<p class="color3">
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="color1">
<p class="color3">
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>

@ -1,5 +1,5 @@
<div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out/articles/test articles/test2.article">
<p class="color6">
<p class="color3">
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="color6">
<p class="color3">
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>

@ -1,5 +1,5 @@
<div class="contentWrapper"><h1>And More</h1><div class="content" id="content_out/articles/test articles/test3.article">
<p class="color6">
<p class="color2">
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="color6">
<p class="color2">
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>

@ -17,7 +17,7 @@
</head>
<body>
<div class="contentBody">
<h2>Directory Listing for /images/</h2><div class="folderlisting"><a href="/images/.." class="icon">&#x1F4C1;</a><a href="/images/..">.. </a><a href="/images/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/images/Love_Live!_Logo.png" class="icon">&#x1F5CE;</a><a href="/images/Love_Live!_Logo.png">Love_Live!_Logo.png</a> 2022-07-23T18:15:55.635107Z niconiconii 12167</div>
<h2>Directory Listing for /images/</h2><div class="folderlisting"><a href="/images/.." class="icon">&#x1F4C1;</a><a href="/images/..">.. </a><a href="/images/.." class="nounderline">(Previous Directory)</a></div><div class="filelisting"><a href="/images/Love_Live!_Logo.png" class="icon">&#x1F5CE;</a><a href="/images/Love_Live!_Logo.png">Love_Live!_Logo.png</a> 2022-07-26T15:15:09.668054Z codespace 12167</div>
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

@ -18,989 +18,11 @@
<body>
<div class="contentBody">
This is a different webpage.<hr>
<script type="text/javascript">
function expand(modify,element) {
var ele = document.getElementById("content_"+element);
ele.classList.remove("content");
ele.classList.add("expandedContent");
modify.remove();
}
</script>
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_out/articles/sigplace1.article">
<p class="color1">
This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.
</p>
<p class="color1">
Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.
</p>
<p class="color2">
A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.
</p>
<p class="color2">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In feugiat, urna ut sollicitudin luctus, nulla magna faucibus mauris, at semper nisl nisi ut mauris. Vestibulum cursus tortor velit, ut congue ex porta in. Nullam hendrerit risus sit amet neque euismod faucibus. Sed ac diam non lectus euismod pulvinar eu non mauris. Donec accumsan nisl efficitur, sodales lectus et, finibus quam. Sed vel consectetur leo. Cras ut condimentum quam. Aliquam molestie viverra congue. Donec scelerisque nibh ac nulla dictum semper. Aliquam id massa a massa bibendum finibus id ac sapien. Integer vitae ullamcorper enim, non semper massa.
</p>
<br/>
<p class="color3">
Proin cursus sodales elit, vitae volutpat mi fermentum a. In vitae magna quis leo cursus accumsan id facilisis purus. Vestibulum accumsan iaculis turpis eu sollicitudin. Sed ultricies felis non elit suscipit interdum. Maecenas sollicitudin turpis justo, vel pretium sapien scelerisque eget. Nullam sagittis finibus risus ut aliquam. Praesent quam orci, dapibus ut ex ac, sodales dapibus nunc.
</p>
<br/>
<p class="color3">
Fusce magna risus, iaculis non justo sit amet, semper sodales urna. Morbi eu eros lectus. Integer euismod venenatis eros a hendrerit. Nulla ultricies lectus nec quam condimentum fermentum. Quisque a turpis vitae orci pharetra ullamcorper. Nunc fringilla vitae nunc a aliquam. In aliquam gravida massa. Sed imperdiet dignissim sapien, ullamcorper rutrum lacus convallis ut.
</p>
<br/>
<p class="color3">
Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.
</p>
<br/>
<p class="color4">
Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.
</p>
<br/>
<div><figure style="text-align:center;width:30%;float:right;"><img src="/images/Love_Live!_Logo.png" style="margin:auto;width:100%;"><figcaption>Hello there! You can see this is the Love Live logo indeed! It is quite smol right now but that's okay. Let's keep on going with the text. If the caption is really long and with commas, they will now be combined,,,,,see how that works? Amazing!</figcaption></figure></div>
<p class="color4">
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.
</p>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<p class="color4">
<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">" %ID%>"</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">"%DEFAULT"</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">"%FOOTER"</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">"%DEFAULT"</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">"%FOOTER"</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>%ID%<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>%CONDITIONAL_EXPAND%<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="variable"></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="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>%CONDITIONAL_EXPAND%<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"></span>$ARTICLE_<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>%CONDITIONAL_EXPAND%<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">"%DEFAULT"</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">"%FOOTER"</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="color1">
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_975" 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="color6">
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_980" 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="color6">
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_985" 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="color5">
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="color5">
<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_990" onClick="expand(this,'out/articles/curabitur vel tempus ex.article')"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
$ARTICLE_PREVIEW sigplace1
$ARTICLE_PREVIEW test articles/test1
$ARTICLE_PREVIEW test articles/test2
$ARTICLE_PREVIEW test articles/test3
$ARTICLE_PREVIEW curabitur vel tempus ex
</div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div>

Binary file not shown.

@ -127,6 +127,7 @@ public class sigPlace {
inCodeBlock=false;
boolean keyword=false;
boolean inString=false;
char stringChar=' ';
boolean inChar=false;
boolean canBeNumericalConstant=false;
int lengthOfConstant=0;
@ -137,9 +138,10 @@ public class sigPlace {
String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length());
s="";
for (int j=0;j<storedCodeBlock.length();j++) {
if (storedCodeBlock.charAt(j)=='"') {
if (!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)) {
inString=!inString;
if (inString) {
stringChar=storedCodeBlock.charAt(j);
s+=SPAN("string")+"\"";
} else {
s+="\"</span>";
@ -210,7 +212,7 @@ public class sigPlace {
if (!canBeNumericalConstant&&!isAlphanumeric(j)) {
canBeNumericalConstant=true;
lengthOfConstant=0;
System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
//System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric...");
}
}
for (int j=0;j<s.length();j++) {

Binary file not shown.
Loading…
Cancel
Save