Completed implementation of code highlighter

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent f38db58c74
commit 385d1d8cb4
  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. 300
      out/articles/sigplace1.article
  6. 300
      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/images/DIRECTORY_LISTING
  13. 6
      out/sig.css
  14. 41
      sigPlace.java
  15. 4
      sitefiles/articles/sigplace1.article
  16. 6
      sitefiles/sig.css

@ -17,14 +17,14 @@
</head> </head>
<body> <body>
<div class="contentBody"> <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="folderlisting"><a href="/articles" class="icon">&#x1F4C1;</a><a href="/articles">articles</a> 2022-07-26T15:21:39.694961518Z codespace 4096</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-26T16:55:19.921725Z gitpod 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="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-07-26T16:55:19.837725Z gitpod 2635</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="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-07-26T16:55:19.841725Z gitpod 941</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="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-07-26T16:55:19.845725Z gitpod 1093</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="/uploadform.html" class="icon">&#x1F5CE;</a><a href="/uploadform.html">uploadform.html</a> 2022-07-26T16:55:19.865725Z gitpod 884</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="folderlisting"><a href="/images" class="icon">&#x1F4C1;</a><a href="/images">images</a> 2022-07-26T16:55:19.917725Z gitpod 58</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="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-07-26T16:55:19.857725Z gitpod 6274</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 class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-07-26T16:55:19.869725Z gitpod 804</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -17,13 +17,13 @@
</head> </head>
<body> <body>
<div class="contentBody"> <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/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> <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" class="icon">&#x1F5CE;</a><a href="/articles/Love Live! Custom Arcade Controller.article">Love Live! Custom Arcade Controller.article</a> 2022-07-26T16:55:19.405725Z gitpod 497</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="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-07-26T16:55:19.877725Z gitpod 147</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-26T16:55:19.433725Z gitpod 734</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="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-07-26T16:55:19.837725Z gitpod 81848</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/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-26T16:55:19.869725Z gitpod 1214</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/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-26T16:55:19.885725Z gitpod 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 class="filelisting"><a href="/articles/sigplace1.article.html" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article.html">sigplace1.article.html</a> 2022-07-26T16:55:19.909725Z gitpod 82565</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <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"> <div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_out/articles/curabitur vel tempus ex.article">
<p class="color1"> <p class="color3">
Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis. Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.
</p> </p>
<br/> <br/>
<p class="color2"> <p class="color3">
<pre> <pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span> &lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre> </pre>

@ -18,13 +18,13 @@
<body> <body>
<div class="contentBody"> <div class="contentBody">
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="expandedContent" id="content_out/articles/curabitur vel tempus ex.article"> <div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="expandedContent" id="content_out/articles/curabitur vel tempus ex.article">
<p class="color1"> <p class="color3">
Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis. Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. Nullam odio purus, tristique non turpis sit amet, malesuada ultricies purus. Mauris ut nulla nisl. Aenean sit amet est egestas justo volutpat consequat. Suspendisse in sagittis augue, et mattis tortor. Nullam viverra metus et nibh fringilla iaculis.
</p> </p>
<br/> <br/>
<p class="color2"> <p class="color3">
<pre> <pre>
&lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span> &lt;>&lt;Test><span class="string">"&lt;/test>&lt;/test2>&lt;test3>"</span>
</pre> </pre>

@ -51,7 +51,6 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<br/> <br/>
<br/>
@ -60,7 +59,8 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<br/>
<br/> <br/>
@ -514,24 +514,26 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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="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">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">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="comment">/* Test giant multi-line comment ""
<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>; final static String ROOTDIR = "sitefiles";
<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>; final static String REFDIR = "ref";
<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>; final static String OUTDIR = "out";
<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>; final static String ARTICLESDIR = "articles";
<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>; final static String UPLOADSDIR = "uploads";
<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>; final static String COMMENTSDIR = "comments";
<span class="keyword">static</span> <span class="keyword">int</span> <span class="keyword">PORT</span> <span class="variable"></span>= <span class="number">8080</span>; final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
<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>; static int PORT = 8080;
*/</span><span class="number"></span>
<span class="keyword">static</span> <span class="keyword">double</span> COLOR_<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">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">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">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">"$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">"$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_START"</span>, <span class="string">"&lt;div class=\"contentWrapper\">&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">"$TITLE_CONTENT_END"</span>, <span class="string">"&lt;/h1>&lt;div class=\"content\" %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">"$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">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=\"datebar\">&lt;/div>&lt;div class=\"date\">"</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">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="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
@ -550,7 +552,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
PORT=<span class="class">Integer</span>.<span class="function">parseInt</span>(arg2); 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="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="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="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Invalid argument \""</span>+arg1+<span class="string">"\"."</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
} }
} }
@ -597,11 +599,11 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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="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">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">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="comment">//System.out.println(s);</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"></span>(<span class="function">isHTMLFile</span>(f)||<span class="function">isArticleFile</span>(f))) { <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="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="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>); <span class="comment">//System.out.println("Inside &lt;pre>");</span>
inCodeBlock=<span class="number">true</span><span class="keyword"></span>; inCodeBlock=<span class="number">true</span><span class="keyword"></span>;
storedCodeBlock=<span class="string">""</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>)); 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>));
@ -622,12 +624,12 @@ 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>()); <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>; 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">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">"""</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>) {
inString=!<span class="keyword">inString</span>; inString=!<span class="keyword">inString</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">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">"; s+=<span class="function">SPAN</span>(<span class="string">"string"</span>)+<span class="string">"\""</span>;
} else { } <span class="keyword">else</span> <span class="variable"></span>{
s+="</span>\<span class="string">"&lt;/span>"</span>; s+=<span class="string">"\"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>; startPos=j+<span class="number">1</span>;
} }
} else } else
@ -638,13 +640,13 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
<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))) { <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); 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)); <span class="comment">//System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));</span>
lengthOfConstant=<span class="number">0</span>; lengthOfConstant=<span class="number">0</span>;
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>; canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
startPos=j+<span class="number">1</span>; startPos=j+<span class="number">1</span>;
} else } else
<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">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> <span class="comment">//Previous section was a member.</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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span> } <span class="keyword">else</span> <span class="variable"></span>
@ -656,23 +658,23 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
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>; 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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>) { <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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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">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> <span class="comment">//Previous section was a keyword.</span>
keyword=<span class="number">true</span><span class="keyword"></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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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">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> <span class="comment">//Previous section was a keyword.</span>
//keyword=<span class="number">true</span><span class="keyword"></span>; <span class="comment">//keyword=true;</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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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>)) { <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>; 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); 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>; startPos=j+<span class="number">1</span>;
@ -689,7 +691,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j); s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>; startPos=j+<span class="number">1</span>;
} }
<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>)) { <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>; canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
} }
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&!<span class="function">isAlphanumeric</span>(j)) { <span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&!<span class="function">isAlphanumeric</span>(j)) {
@ -699,7 +701,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
} }
s+=<span class="keyword">endText</span>; 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="comment">//System.out.println("Stored code block: "+storedCodeBlock);</span>
} <span class="keyword">else</span> <span class="variable"></span> } <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) { <span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) {
storedCodeBlock+=s+<span class="string">"\n"</span>; storedCodeBlock+=s+<span class="string">"\n"</span>;
@ -707,33 +709,33 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
} }
<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">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="comment">//Check for markdown pieces.</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">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> <span class="comment">//Start of a title piece.</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=<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>); 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=\"content_"</span>+f+<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. <span class="comment">//Use ⤈ if there's more text to be shown than can fit.</span>
} else } else
if (s.contains("===")) { <span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"==="</span><span class="variable"></span>)) {
s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END"); s=<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$CONTENT_END"</span>)+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$DATE_CONTENT_START"</span>)+<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"==="</span>,<span class="string">""</span>)+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$CONTENT_END"</span>)+<span class="string">"%CONDITIONAL_EXPAND%"</span>+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$CONTENT_END"</span>);
} else } <span class="keyword">else</span> <span class="variable"></span>
if (s.charAt(0)=="</span><span class="variable"></span>:<span class="string">") { <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>) {
//Image with caption. <span class="comment">//Image with caption.</span>
//Format: <span class="comment">//Format:</span>
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption> <span class="comment">//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption></span>
String[] splitter = s.split(Pattern.quote(",")); String[] <span class="keyword">splitter</span> <span class="variable"></span>= <span class="class">s</span>.<span class="function">split</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(<span class="string">","</span>));
StringBuilder captionText = new StringBuilder(splitter[3]); <span class="keyword">StringBuilder</span> <span class="keyword">captionText</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="variable">splitter</span>[<span class="number">3</span>]);
for (int j=4;j&lt;splitter.length;j++) { <span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">4</span>;j&lt;<span class="class">splitter</span>.<span class="keyword">length</span>;j++) {
captionText.append(",").append(splitter[j]); <span class="class">captionText</span>.<span class="function">append</span>(<span class="string">","</span>).<span class="function">append</span>(splitter[j]);
} }
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>"; s=<span class="string">"&lt;div>&lt;figure style=\"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">"\">&lt;img src=\"/"</span>+splitter[<span class="number">0</span>].<span class="function">substring</span>(<span class="number">1</span>)+<span class="string">"\" style=\"margin:auto;width:100%;\">&lt;figcaption>"</span>+<span class="class">captionText</span>.<span class="function">toString</span>()+<span class="string">"&lt;/figcaption>&lt;/figure>&lt;/div>"</span>;
} else { } <span class="keyword">else</span> <span class="variable"></span>{
//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> <span class="comment">//It's regular content, so add paragraphs.</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>; s=<span class="string">"&lt;p class=\"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>+s+<span class="string">"&lt;/p>"</span>;
} }
} <span class="keyword">else</span> <span class="variable"></span> } <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)) { <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> s=<span class="string">"&lt;br/>"</span>; <span class="comment">//Setup a line break here.</span>
} }
<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="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)); 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));
@ -751,16 +753,16 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
} }
<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">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>; <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>;
} }
<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">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>; <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>;
} }
/** <span class="comment">/**
* <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> * Writes a span tag with the included class.
* **/ * **/</span>
<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">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>; <span class="keyword">return</span> <span class="string">"&lt;span class=\""</span><span class="variable"></span>+className+<span class="string">"\">"</span>;
} }
<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="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="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Generating article files..."</span>);
@ -783,7 +785,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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>()) { <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=<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=<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">"div class=\"content\""</span>,<span class="string">"div class=\"expandedContent\""</span>);
d=<span class="class">d</span>.<span class="function">replaceFirst</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<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>); <span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
} }
@ -822,122 +824,122 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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="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>); <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>); lastline=<span class="class">lastline</span>.<span class="function">replace</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">"&lt;div class=\"unexpanded\" id=\"expand_"</span>+i+<span class="string">"\" onClick=\"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">"')\">&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">"); <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);<span class="comment">//&lt;div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>");</span>
} else { } <span class="keyword">else</span> <span class="variable"></span>{
content.set(i,"</span><span class="string">"); <span class="class">content</span>.<span class="function">set</span>(i,<span class="string">""</span>);
} }
if (!articleJavascriptIncluded) { <span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!articleJavascriptIncluded) {
List&lt;String> articlejs = Files.readAllLines(Paths.get(REFDIR,"</span><span class="class">article</span>.<span class="string">")); 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>));
for (int j=articlejs.size()-1;j>=0;j--) { <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--) {
content.add(i,articlejs.get(j)); <span class="class">content</span>.<span class="function">add</span>(i,<span class="class">articlejs</span>.<span class="function">get</span>(j));
} }
articleJavascriptIncluded=true; articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
} }
} }
} }
Files.write(f,content); <span class="class">Files</span>.<span class="function">write</span>(f,content);
} catch (IOException e) { } <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
e.printStackTrace(); <span class="class">e</span>.<span class="function">printStackTrace</span>();
} }
} }
} }
} }
static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) <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>)
throws IOException { <span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
Files.walk(Paths.get(sourceDirectoryLocation)) <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(sourceDirectoryLocation))
.forEach(source -> { .<span class="function">forEach</span>(<span class="keyword">source</span> <span class="variable"></span>-> {
Path destination = Paths.get(destinationDirectoryLocation, source.toString() <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>()
.substring(sourceDirectoryLocation.length())); .<span class="function">substring</span>(<span class="class">sourceDirectoryLocation</span>.<span class="function">length</span>()));
try { <span class="keyword">try</span> <span class="variable"></span>{
if (Files.isDirectory(destination)) { <span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(<span class="variable">destination</span>)) {
Files.createDirectories(destination); <span class="class">Files</span>.<span class="function">createDirectories</span>(destination);
} else { } <span class="keyword">else</span> <span class="variable"></span>{
Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING}); <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});
} }
} catch (IOException e) { } <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
e.printStackTrace(); <span class="class">e</span>.<span class="function">printStackTrace</span>();
} }
}); });
} }
static void buildDirectoryListings() <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">buildDirectoryListings</span>(<span class="variable"></span>)
throws IOException { <span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString(); <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>> map = new HashMap&lt;>(); 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> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator(); 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>();
map.put("</span>/<span class="string">",new ArrayList&lt;Path>()); <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>());
while (it.hasNext()) { <span class="keyword">while</span> <span class="function"></span>(<span class="class">it</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
Path f = it.next(); <span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">it</span>.<span class="function">next</span>();
if (!f.getFileName().toString().equals(OUTDIR)) { <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)) {
String myKey = f.toAbsolutePath().toString().replace(startingPath,"</span><span class="string">").replace(f.getFileName().toString(),"</span><span class="string">"); <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>);
//System.out.println(myKey+"</span>,<span class="string">"+f); <span class="comment">//System.out.println(myKey+","+f);</span>
map.putIfAbsent(myKey,new ArrayList&lt;Path>()); <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>());
map.get(myKey).add(f); <span class="class">map</span>.<span class="function">get</span>(myKey).<span class="function">add</span>(f);
} }
} }
System.out.println("</span><span class="keyword">Directory</span> <span class="keyword">structure</span> <span class="keyword">determined</span>:<span class="string">"); <span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Directory structure determined:"</span>);
System.out.println("</span> <span class="string">"+map); <span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+map);
for (String key : map.keySet()) { <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>()) {
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">"); <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>);
StringBuilder sb = new StringBuilder("</span><span class="string">"); <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> data = Files.readAllLines(ops.get("</span>%<span class="string">")); 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> data2 = Files.readAllLines(ops.get("</span>%<span class="string">")); 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>));
for (String d : data) { <span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data) {
for (String k : sigPlace.map.keySet()) { <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=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); 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>);
} }
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">"); <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>);
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="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"folderlisting\">&lt;a href=\""</span>)
.<span class="function">append</span>(key) .<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>(<span class="string">"..\" class=\"icon\">&#x1F4C1;&lt;/a>&lt;a href=\""</span>)
.<span class="function">append</span>(key) .<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>(<span class="string">"..\">.. &lt;/a>&lt;a href=\""</span>)
.<span class="function">append</span>(key) .<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">"); .<span class="function">append</span>(<span class="string">"..\" class=\"nounderline\">(Previous Directory)&lt;/a>&lt;/div>"</span>);
for (Path f : map.get(key)) { <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)) {
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">") <span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\""</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>)
.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">") .<span class="function">append</span>(<span class="string">"&lt;a href=\""</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">"\" class=\"icon\">"</span>)
.append((Files.isDirectory(f)?"</span>&#<span class="keyword">x1F4C1</span>;<span class="string">":"</span>&#<span class="keyword">x1F5CE</span>;<span class="string">")) .<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>))
.append("</span>&lt;/a><span class="string">") .<span class="function">append</span>(<span class="string">"&lt;/a>"</span>)
.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">") .<span class="function">append</span>(<span class="string">"&lt;a href=\""</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>)
.append(f.getFileName()) .<span class="function">append</span>(<span class="class">f</span>.<span class="function">getFileName</span>())
.append("</span>&lt;/a>\<span class="string">") .<span class="function">append</span>(<span class="string">"&lt;/a>\t"</span>)
.append(Files.getLastModifiedTime(f)) .<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getLastModifiedTime</span>(f))
.append("</span>\<span class="string">") .<span class="function">append</span>(<span class="string">"\t"</span>)
.append(Files.getOwner(f)) .<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getOwner</span>(f))
.append("</span>\<span class="string">") .<span class="function">append</span>(<span class="string">"\t"</span>)
.append(Files.size(f)) .<span class="function">append</span>(<span class="class">Files</span>.<span class="function">size</span>(f))
.append("</span>&lt;/div>\<span class="string">"); .<span class="function">append</span>(<span class="string">"&lt;/div>\n"</span>);
} }
for (String d : data2) { <span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data2) {
for (String k : sigPlace.map.keySet()) { <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=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); 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>);
} }
Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes()); <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>());
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="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>());
} }
} }
private static boolean isArticleFile(Path f) { <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>) {
return f.getFileName().toString().contains("</span><span class="variable"></span>.<span class="string">"); <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 isHTMLFile(Path f) { <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>) {
return f.getFileName().toString().contains("</span>.<span class="string">"); <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 void ExportCodeFile() { <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ExportCodeFile</span>(<span class="variable"></span>) {
try { <span class="keyword">try</span> <span class="variable"></span>{
Path file = Paths.get("</span><span class="class">sigServer</span>.<span class="string">"); <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> data = Files.readAllLines(file); List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
int i=0; <span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
while (!data.get(i++).contains("</span><span class="function">sigServer</span>()<span class="string">")&&i&lt;data.size()); <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>());
if (i&lt;data.size()) { <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>()) {
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="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);
} }
} catch (IOException e) { } <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
e.printStackTrace(); <span class="class">e</span>.<span class="function">printStackTrace</span>();
} }
} }

@ -70,7 +70,6 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<br/> <br/>
<br/>
@ -79,7 +78,8 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<br/>
<br/> <br/>
@ -533,24 +533,26 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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="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">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">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="comment">/* Test giant multi-line comment ""
<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>; final static String ROOTDIR = "sitefiles";
<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>; final static String REFDIR = "ref";
<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>; final static String OUTDIR = "out";
<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>; final static String ARTICLESDIR = "articles";
<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>; final static String UPLOADSDIR = "uploads";
<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>; final static String COMMENTSDIR = "comments";
<span class="keyword">static</span> <span class="keyword">int</span> <span class="keyword">PORT</span> <span class="variable"></span>= <span class="number">8080</span>; final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
<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>; static int PORT = 8080;
*/</span><span class="number"></span>
<span class="keyword">static</span> <span class="keyword">double</span> COLOR_<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">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">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">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">"$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">"$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_START"</span>, <span class="string">"&lt;div class=\"contentWrapper\">&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">"$TITLE_CONTENT_END"</span>, <span class="string">"&lt;/h1>&lt;div class=\"content\" %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">"$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">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=\"datebar\">&lt;/div>&lt;div class=\"date\">"</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">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="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span>&lt;><span class="function"></span>(
@ -569,7 +571,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
PORT=<span class="class">Integer</span>.<span class="function">parseInt</span>(arg2); 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="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="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="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Invalid argument \""</span>+arg1+<span class="string">"\"."</span>);
<span class="keyword">return</span>; <span class="keyword">return</span>;
} }
} }
@ -616,11 +618,11 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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="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">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">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="comment">//System.out.println(s);</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"></span>(<span class="function">isHTMLFile</span>(f)||<span class="function">isArticleFile</span>(f))) { <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="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="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>); <span class="comment">//System.out.println("Inside &lt;pre>");</span>
inCodeBlock=<span class="number">true</span><span class="keyword"></span>; inCodeBlock=<span class="number">true</span><span class="keyword"></span>;
storedCodeBlock=<span class="string">""</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>)); 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>));
@ -641,12 +643,12 @@ 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>()); <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>; 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">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">"""</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>) {
inString=!<span class="keyword">inString</span>; inString=!<span class="keyword">inString</span>;
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">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">"; s+=<span class="function">SPAN</span>(<span class="string">"string"</span>)+<span class="string">"\""</span>;
} else { } <span class="keyword">else</span> <span class="variable"></span>{
s+="</span>\<span class="string">"&lt;/span>"</span>; s+=<span class="string">"\"&lt;/span>"</span>;
startPos=j+<span class="number">1</span>; startPos=j+<span class="number">1</span>;
} }
} else } else
@ -657,13 +659,13 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
<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))) { <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); 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)); <span class="comment">//System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));</span>
lengthOfConstant=<span class="number">0</span>; lengthOfConstant=<span class="number">0</span>;
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>; canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
startPos=j+<span class="number">1</span>; startPos=j+<span class="number">1</span>;
} else } else
<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">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> <span class="comment">//Previous section was a member.</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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></span> } <span class="keyword">else</span> <span class="variable"></span>
@ -675,23 +677,23 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
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>; 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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>) { <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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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">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> <span class="comment">//Previous section was a keyword.</span>
keyword=<span class="number">true</span><span class="keyword"></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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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">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> <span class="comment">//Previous section was a keyword.</span>
//keyword=<span class="number">true</span><span class="keyword"></span>; <span class="comment">//keyword=true;</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); 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>; startPos=j+<span class="number">1</span>;
} <span class="keyword">else</span> <span class="variable"></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>)) { <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>; 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); 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>; startPos=j+<span class="number">1</span>;
@ -708,7 +710,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j); s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
startPos=j+<span class="number">1</span>; startPos=j+<span class="number">1</span>;
} }
<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>)) { <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>; canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
} }
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&!<span class="function">isAlphanumeric</span>(j)) { <span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!canBeNumericalConstant&&!<span class="function">isAlphanumeric</span>(j)) {
@ -718,7 +720,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
} }
s+=<span class="keyword">endText</span>; 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="comment">//System.out.println("Stored code block: "+storedCodeBlock);</span>
} <span class="keyword">else</span> <span class="variable"></span> } <span class="keyword">else</span> <span class="variable"></span>
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) { <span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) {
storedCodeBlock+=s+<span class="string">"\n"</span>; storedCodeBlock+=s+<span class="string">"\n"</span>;
@ -726,33 +728,33 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
} }
<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">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="comment">//Check for markdown pieces.</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">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> <span class="comment">//Start of a title piece.</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=<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>); 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=\"content_"</span>+f+<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. <span class="comment">//Use ⤈ if there's more text to be shown than can fit.</span>
} else } else
if (s.contains("===")) { <span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"==="</span><span class="variable"></span>)) {
s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END"); s=<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$CONTENT_END"</span>)+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$DATE_CONTENT_START"</span>)+<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"==="</span>,<span class="string">""</span>)+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$CONTENT_END"</span>)+<span class="string">"%CONDITIONAL_EXPAND%"</span>+<span class="class">map</span>.<span class="function">get</span>(<span class="string">"$CONTENT_END"</span>);
} else } <span class="keyword">else</span> <span class="variable"></span>
if (s.charAt(0)=="</span><span class="variable"></span>:<span class="string">") { <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>) {
//Image with caption. <span class="comment">//Image with caption.</span>
//Format: <span class="comment">//Format:</span>
//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption> <span class="comment">//:&lt;url>,&lt;left|right|center>,&lt;width>,&lt;caption></span>
String[] splitter = s.split(Pattern.quote(",")); String[] <span class="keyword">splitter</span> <span class="variable"></span>= <span class="class">s</span>.<span class="function">split</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(<span class="string">","</span>));
StringBuilder captionText = new StringBuilder(splitter[3]); <span class="keyword">StringBuilder</span> <span class="keyword">captionText</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="variable">splitter</span>[<span class="number">3</span>]);
for (int j=4;j&lt;splitter.length;j++) { <span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">4</span>;j&lt;<span class="class">splitter</span>.<span class="keyword">length</span>;j++) {
captionText.append(",").append(splitter[j]); <span class="class">captionText</span>.<span class="function">append</span>(<span class="string">","</span>).<span class="function">append</span>(splitter[j]);
} }
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>"; s=<span class="string">"&lt;div>&lt;figure style=\"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">"\">&lt;img src=\"/"</span>+splitter[<span class="number">0</span>].<span class="function">substring</span>(<span class="number">1</span>)+<span class="string">"\" style=\"margin:auto;width:100%;\">&lt;figcaption>"</span>+<span class="class">captionText</span>.<span class="function">toString</span>()+<span class="string">"&lt;/figcaption>&lt;/figure>&lt;/div>"</span>;
} else { } <span class="keyword">else</span> <span class="variable"></span>{
//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> <span class="comment">//It's regular content, so add paragraphs.</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>; s=<span class="string">"&lt;p class=\"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>+s+<span class="string">"&lt;/p>"</span>;
} }
} <span class="keyword">else</span> <span class="variable"></span> } <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)) { <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> s=<span class="string">"&lt;br/>"</span>; <span class="comment">//Setup a line break here.</span>
} }
<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="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)); 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));
@ -770,16 +772,16 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
} }
} }
<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">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>; <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>;
} }
<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">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>; <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>;
} }
/** <span class="comment">/**
* <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> * Writes a span tag with the included class.
* **/ * **/</span>
<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">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>; <span class="keyword">return</span> <span class="string">"&lt;span class=\""</span><span class="variable"></span>+className+<span class="string">"\">"</span>;
} }
<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="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="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Generating article files..."</span>);
@ -802,7 +804,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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>()) { <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=<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=<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">"div class=\"content\""</span>,<span class="string">"div class=\"expandedContent\""</span>);
d=<span class="class">d</span>.<span class="function">replaceFirst</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<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>); <span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
} }
@ -841,122 +843,122 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
<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="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>); <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>); lastline=<span class="class">lastline</span>.<span class="function">replace</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">"&lt;div class=\"unexpanded\" id=\"expand_"</span>+i+<span class="string">"\" onClick=\"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">"')\">&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">"); <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);<span class="comment">//&lt;div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\">&lt;br/>&lt;br/>&lt;br/>&lt;br/>&#x2908; Click to expand.&lt;/div>");</span>
} else { } <span class="keyword">else</span> <span class="variable"></span>{
content.set(i,"</span><span class="string">"); <span class="class">content</span>.<span class="function">set</span>(i,<span class="string">""</span>);
} }
if (!articleJavascriptIncluded) { <span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!articleJavascriptIncluded) {
List&lt;String> articlejs = Files.readAllLines(Paths.get(REFDIR,"</span><span class="class">article</span>.<span class="string">")); 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>));
for (int j=articlejs.size()-1;j>=0;j--) { <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--) {
content.add(i,articlejs.get(j)); <span class="class">content</span>.<span class="function">add</span>(i,<span class="class">articlejs</span>.<span class="function">get</span>(j));
} }
articleJavascriptIncluded=true; articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
} }
} }
} }
Files.write(f,content); <span class="class">Files</span>.<span class="function">write</span>(f,content);
} catch (IOException e) { } <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
e.printStackTrace(); <span class="class">e</span>.<span class="function">printStackTrace</span>();
} }
} }
} }
} }
static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) <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>)
throws IOException { <span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
Files.walk(Paths.get(sourceDirectoryLocation)) <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(sourceDirectoryLocation))
.forEach(source -> { .<span class="function">forEach</span>(<span class="keyword">source</span> <span class="variable"></span>-> {
Path destination = Paths.get(destinationDirectoryLocation, source.toString() <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>()
.substring(sourceDirectoryLocation.length())); .<span class="function">substring</span>(<span class="class">sourceDirectoryLocation</span>.<span class="function">length</span>()));
try { <span class="keyword">try</span> <span class="variable"></span>{
if (Files.isDirectory(destination)) { <span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(<span class="variable">destination</span>)) {
Files.createDirectories(destination); <span class="class">Files</span>.<span class="function">createDirectories</span>(destination);
} else { } <span class="keyword">else</span> <span class="variable"></span>{
Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING}); <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});
} }
} catch (IOException e) { } <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
e.printStackTrace(); <span class="class">e</span>.<span class="function">printStackTrace</span>();
} }
}); });
} }
static void buildDirectoryListings() <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">buildDirectoryListings</span>(<span class="variable"></span>)
throws IOException { <span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString(); <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>> map = new HashMap&lt;>(); 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> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator(); 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>();
map.put("</span>/<span class="string">",new ArrayList&lt;Path>()); <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>());
while (it.hasNext()) { <span class="keyword">while</span> <span class="function"></span>(<span class="class">it</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
Path f = it.next(); <span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">it</span>.<span class="function">next</span>();
if (!f.getFileName().toString().equals(OUTDIR)) { <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)) {
String myKey = f.toAbsolutePath().toString().replace(startingPath,"</span><span class="string">").replace(f.getFileName().toString(),"</span><span class="string">"); <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>);
//System.out.println(myKey+"</span>,<span class="string">"+f); <span class="comment">//System.out.println(myKey+","+f);</span>
map.putIfAbsent(myKey,new ArrayList&lt;Path>()); <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>());
map.get(myKey).add(f); <span class="class">map</span>.<span class="function">get</span>(myKey).<span class="function">add</span>(f);
} }
} }
System.out.println("</span><span class="keyword">Directory</span> <span class="keyword">structure</span> <span class="keyword">determined</span>:<span class="string">"); <span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Directory structure determined:"</span>);
System.out.println("</span> <span class="string">"+map); <span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+map);
for (String key : map.keySet()) { <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>()) {
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">"); <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>);
StringBuilder sb = new StringBuilder("</span><span class="string">"); <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> data = Files.readAllLines(ops.get("</span>%<span class="string">")); 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> data2 = Files.readAllLines(ops.get("</span>%<span class="string">")); 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>));
for (String d : data) { <span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data) {
for (String k : sigPlace.map.keySet()) { <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=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); 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>);
} }
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">"); <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>);
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="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\"folderlisting\">&lt;a href=\""</span>)
.<span class="function">append</span>(key) .<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>(<span class="string">"..\" class=\"icon\">&#x1F4C1;&lt;/a>&lt;a href=\""</span>)
.<span class="function">append</span>(key) .<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>(<span class="string">"..\">.. &lt;/a>&lt;a href=\""</span>)
.<span class="function">append</span>(key) .<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">"); .<span class="function">append</span>(<span class="string">"..\" class=\"nounderline\">(Previous Directory)&lt;/a>&lt;/div>"</span>);
for (Path f : map.get(key)) { <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)) {
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">") <span class="class">sb</span>.<span class="function">append</span>(<span class="string">"&lt;div class=\""</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>)
.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">") .<span class="function">append</span>(<span class="string">"&lt;a href=\""</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">"\" class=\"icon\">"</span>)
.append((Files.isDirectory(f)?"</span>&#<span class="keyword">x1F4C1</span>;<span class="string">":"</span>&#<span class="keyword">x1F5CE</span>;<span class="string">")) .<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>))
.append("</span>&lt;/a><span class="string">") .<span class="function">append</span>(<span class="string">"&lt;/a>"</span>)
.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">") .<span class="function">append</span>(<span class="string">"&lt;a href=\""</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>)
.append(f.getFileName()) .<span class="function">append</span>(<span class="class">f</span>.<span class="function">getFileName</span>())
.append("</span>&lt;/a>\<span class="string">") .<span class="function">append</span>(<span class="string">"&lt;/a>\t"</span>)
.append(Files.getLastModifiedTime(f)) .<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getLastModifiedTime</span>(f))
.append("</span>\<span class="string">") .<span class="function">append</span>(<span class="string">"\t"</span>)
.append(Files.getOwner(f)) .<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getOwner</span>(f))
.append("</span>\<span class="string">") .<span class="function">append</span>(<span class="string">"\t"</span>)
.append(Files.size(f)) .<span class="function">append</span>(<span class="class">Files</span>.<span class="function">size</span>(f))
.append("</span>&lt;/div>\<span class="string">"); .<span class="function">append</span>(<span class="string">"&lt;/div>\n"</span>);
} }
for (String d : data2) { <span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data2) {
for (String k : sigPlace.map.keySet()) { <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=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); 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>);
} }
Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes()); <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>());
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="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>());
} }
} }
private static boolean isArticleFile(Path f) { <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>) {
return f.getFileName().toString().contains("</span><span class="variable"></span>.<span class="string">"); <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 isHTMLFile(Path f) { <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>) {
return f.getFileName().toString().contains("</span>.<span class="string">"); <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 void ExportCodeFile() { <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ExportCodeFile</span>(<span class="variable"></span>) {
try { <span class="keyword">try</span> <span class="variable"></span>{
Path file = Paths.get("</span><span class="class">sigServer</span>.<span class="string">"); <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> data = Files.readAllLines(file); List&lt;String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
int i=0; <span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
while (!data.get(i++).contains("</span><span class="function">sigServer</span>()<span class="string">")&&i&lt;data.size()); <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>());
if (i&lt;data.size()) { <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>()) {
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="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);
} }
} catch (IOException e) { } <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
e.printStackTrace(); <span class="class">e</span>.<span class="function">printStackTrace</span>();
} }
} }

@ -17,12 +17,12 @@
</head> </head>
<body> <body>
<div class="contentBody"> <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/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> <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" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-07-26T16:55:19.405725Z gitpod 1085</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" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test2.article">test2.article</a> 2022-07-26T16:55:19.409725Z gitpod 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-26T15:21:39.646960666Z codespace 1498</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-26T16:55:19.409725Z gitpod 994</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.html" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article.html">test1.article.html</a> 2022-07-26T16:55:19.873725Z gitpod 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-26T15:21:39.058950225Z codespace 1085</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-26T16:55:19.873725Z gitpod 1498</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 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-26T16:55:19.877725Z gitpod 1711</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <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"> <div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_out/articles/test articles/test1.article">
<p class="color3"> <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. In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.
</p> </p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div>%CONDITIONAL_EXPAND%</div> </div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div>%CONDITIONAL_EXPAND%</div>

@ -18,7 +18,7 @@
<body> <body>
<div class="contentBody"> <div class="contentBody">
<div class="contentWrapper"><h1>A Test Title</h1><div class="expandedContent" id="content_out/articles/test articles/test1.article"> <div class="contentWrapper"><h1>A Test Title</h1><div class="expandedContent" id="content_out/articles/test articles/test1.article">
<p class="color3"> <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. In dolor erat, malesuada at elit cursus, convallis imperdiet turpis. Ut aliquet magna tellus, at viverra mauris ullamcorper vehicula. Nam quis urna semper magna ornare elementum sed id mauris. Suspendisse faucibus nunc ante, ac rhoncus nisl tristique sed. Vestibulum pretium odio eget scelerisque vestibulum. Aliquam viverra ex ac vestibulum interdum. Donec ligula nunc, dignissim a purus vitae, fermentum laoreet diam. Quisque nec auctor urna. Vestibulum sit amet ligula ullamcorper, congue ipsum et, accumsan ante. Phasellus fermentum, sapien nec pulvinar blandit, elit purus pretium urna, et dapibus orci urna eu metus. Nunc molestie dictum pharetra. Suspendisse luctus felis et ante tristique, vitae commodo diam porttitor. Aliquam orci eros, placerat ac justo vitae, bibendum efficitur metus. Phasellus eget bibendum mauris.
</p> </p>
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div></div> </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"> <div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_out/articles/test articles/test2.article">
<p class="color3"> <p class="color2">
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. Sed lobortis nisi id nunc tincidunt volutpat. Mauris cursus felis quis condimentum posuere. Pellentesque vitae dolor et justo suscipit ultrices. Integer dapibus leo id felis varius, ut volutpat massa bibendum. Quisque sed nunc arcu. In sit amet faucibus magna, non venenatis massa. Cras sed placerat risus, id consectetur est. Pellentesque in nunc dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque eget lorem ac urna posuere accumsan. Quisque sed imperdiet nisi.
</p> </p>
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div>%CONDITIONAL_EXPAND%</div> </div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div>%CONDITIONAL_EXPAND%</div>

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

@ -17,7 +17,7 @@
</head> </head>
<body> <body>
<div class="contentBody"> <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-26T15:15:09.668054Z codespace 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:25:37.713993Z gitpod 12167</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -245,7 +245,7 @@ sup{
pre{ pre{
font-family:'Courier New', Courier, monospace; font-family:'Courier New', Courier, monospace;
padding:3px; padding:3px;
font-size:1.25em; font-size:1.15em;
position:relative; position:relative;
width:85vw; width:85vw;
color:darkseagreen; color:darkseagreen;
@ -275,3 +275,7 @@ pre .string{
pre .number{ pre .number{
color:#d8f070; color:#d8f070;
} }
pre .comment{
color:#6b235e;
}

@ -127,8 +127,9 @@ public class sigPlace {
inCodeBlock=false; inCodeBlock=false;
boolean keyword=false; boolean keyword=false;
boolean inString=false; boolean inString=false;
boolean inComment=false;
boolean inMultiLineComment=false;
char stringChar=' '; char stringChar=' ';
boolean inChar=false;
boolean canBeNumericalConstant=false; boolean canBeNumericalConstant=false;
int lengthOfConstant=0; int lengthOfConstant=0;
storedCodeBlock+=s.substring(0,s.indexOf("</pre>")); storedCodeBlock+=s.substring(0,s.indexOf("</pre>"));
@ -138,21 +139,49 @@ public class sigPlace {
String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length()); String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length());
s=""; s="";
for (int j=0;j<storedCodeBlock.length();j++) { for (int j=0;j<storedCodeBlock.length();j++) {
if (!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)) { if (storedCodeBlock.charAt(j)=='\n'&&inString) {
inString=false;
s+="</span>";
} else
if (storedCodeBlock.charAt(j)=='\n'&&inComment) {
inComment=false;
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+"</span>";
startPos=j+1;
}
if (!inComment&&!inMultiLineComment&&(j>0&&storedCodeBlock.charAt(j-1)!='\\'&&(!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)))) {
inString=!inString; inString=!inString;
if (inString) { if (inString) {
stringChar=storedCodeBlock.charAt(j); stringChar=storedCodeBlock.charAt(j);
s+=SPAN("string")+"\""; s+=SPAN("string")+stringChar;
} else { } else {
s+="\"</span>"; s+=stringChar;
s+="</span>";
startPos=j+1; startPos=j+1;
} }
} else } else
if (!inString&&!inChar) { if (!inString) {
if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) { if (canBeNumericalConstant&&validNumericalConstantCharacters(lengthOfConstant, j)) {
lengthOfConstant++; lengthOfConstant++;
System.out.println("Length of Constant now "+lengthOfConstant); System.out.println("Length of Constant now "+lengthOfConstant);
} }
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='*'||inMultiLineComment) {
if (!inMultiLineComment) {
inMultiLineComment=true;
} else {
if (storedCodeBlock.charAt(j-1)=='*'&&storedCodeBlock.charAt(j)=='/') {
inMultiLineComment=false;
s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>";
startPos=j+1;
}
}
//Stops further execution since we're in a comment.
} else
if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='/'||inComment) {
if (!inComment) {
inComment=true;
}
//Stops further execution since we're in a comment.
} else
if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) { if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) {
s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
//System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)); //System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j));
@ -189,7 +218,7 @@ public class sigPlace {
s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1; startPos=j+1;
} else } else
if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) { if (keyword&&!(storedCodeBlock.charAt(j)=='_'||storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) {
keyword=false; keyword=false;
s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j);
startPos=j+1; startPos=j+1;

@ -33,7 +33,7 @@ import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class sigPlace { public class sigPlace {
/* Test giant multi-line comment ""
final static String ROOTDIR = "sitefiles"; final static String ROOTDIR = "sitefiles";
final static String REFDIR = "ref"; final static String REFDIR = "ref";
final static String OUTDIR = "out"; final static String OUTDIR = "out";
@ -42,7 +42,7 @@ public class sigPlace {
final static String COMMENTSDIR = "comments"; final static String COMMENTSDIR = "comments";
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING"; final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
static int PORT = 8080; static int PORT = 8080;
*/
static double COLOR_ROTATION = 0; static double COLOR_ROTATION = 0;
static boolean inCodeBlock = false; static boolean inCodeBlock = false;

@ -245,7 +245,7 @@ sup{
pre{ pre{
font-family:'Courier New', Courier, monospace; font-family:'Courier New', Courier, monospace;
padding:3px; padding:3px;
font-size:1.25em; font-size:1.15em;
position:relative; position:relative;
width:85vw; width:85vw;
color:darkseagreen; color:darkseagreen;
@ -274,4 +274,8 @@ pre .string{
pre .number{ pre .number{
color:#d8f070; color:#d8f070;
}
pre .comment{
color:#6b235e;
} }
Loading…
Cancel
Save