Where people come together to learn, code, and play. Custom-built HTTP server, site generator, and website from scratch using no external libraries. Goal is to be as minimalistic and fun as possible.
http://projectdivar.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
579 lines
83 KiB
579 lines
83 KiB
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="/reset.css">
|
|
<link rel="stylesheet" type="text/css" href="/sig.css">
|
|
<meta charset="UTF-8">
|
|
<script type="text/javascript">
|
|
function loadCodeBackground() {
|
|
fetch("/codeBackground").then((data)=>data.text())
|
|
.then((data)=>{
|
|
document.getElementById("codeForeground").innerText=data
|
|
document.getElementById("codeBackground").innerText=data
|
|
})
|
|
}
|
|
loadCodeBackground();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="contentBody">
|
|
<div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="expandedContent" id="content_out/articles/sigplace1.article">
|
|
<p class="color2">
|
|
This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.
|
|
</p>
|
|
<p class="color3">
|
|
Paragraphs are automatically split up for readability and generated correctly via the parser. There's quite a bit of flexibility with the system and makes it easy to post updates should they be required.
|
|
</p>
|
|
<p class="color3">
|
|
A lot of content management systems would do this by having a web interface and submitting content and managing it that way, but by coding my own management system and using the built-in OS' filesystem to handle the work, I save myself a lot of pains and headaches.
|
|
</p>
|
|
<p class="color3">
|
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In feugiat, urna ut sollicitudin luctus, nulla magna faucibus mauris, at semper nisl nisi ut mauris. Vestibulum cursus tortor velit, ut congue ex porta in. Nullam hendrerit risus sit amet neque euismod faucibus. Sed ac diam non lectus euismod pulvinar eu non mauris. Donec accumsan nisl efficitur, sodales lectus et, finibus quam. Sed vel consectetur leo. Cras ut condimentum quam. Aliquam molestie viverra congue. Donec scelerisque nibh ac nulla dictum semper. Aliquam id massa a massa bibendum finibus id ac sapien. Integer vitae ullamcorper enim, non semper massa.
|
|
</p>
|
|
<br/>
|
|
<p class="color4">
|
|
Proin cursus sodales elit, vitae volutpat mi fermentum a. In vitae magna quis leo cursus accumsan id facilisis purus. Vestibulum accumsan iaculis turpis eu sollicitudin. Sed ultricies felis non elit suscipit interdum. Maecenas sollicitudin turpis justo, vel pretium sapien scelerisque eget. Nullam sagittis finibus risus ut aliquam. Praesent quam orci, dapibus ut ex ac, sodales dapibus nunc.
|
|
</p>
|
|
<br/>
|
|
<p class="color4">
|
|
Fusce magna risus, iaculis non justo sit amet, semper sodales urna. Morbi eu eros lectus. Integer euismod venenatis eros a hendrerit. Nulla ultricies lectus nec quam condimentum fermentum. Quisque a turpis vitae orci pharetra ullamcorper. Nunc fringilla vitae nunc a aliquam. In aliquam gravida massa. Sed imperdiet dignissim sapien, ullamcorper rutrum lacus convallis ut.
|
|
</p>
|
|
<br/>
|
|
<p class="color4">
|
|
Nunc tortor sem, dapibus mattis varius id, varius eu leo. Phasellus efficitur nulla a diam faucibus, id facilisis lacus malesuada. Nulla condimentum egestas erat a fermentum. Ut interdum dui id est condimentum, vel fermentum nisi ornare. Sed eu rhoncus magna, sit amet finibus eros. In a nibh tincidunt, suscipit tellus eleifend, faucibus mauris. Vestibulum sagittis nisi et efficitur ullamcorper. Donec sodales efficitur ligula id congue. Etiam egestas tristique interdum. Mauris at massa eget metus pellentesque fermentum nec non lacus. Nulla turpis nunc, feugiat vel euismod ac, maximus id est. Praesent cursus elit ac dolor hendrerit lacinia.
|
|
</p>
|
|
<br/>
|
|
<p class="color5">
|
|
Vestibulum laoreet lorem consequat, mollis augue finibus, luctus libero. Praesent convallis sed velit vitae molestie. Vestibulum nec fringilla tellus, non dictum nulla. Donec tempor ac diam sit amet porta. Quisque mi ex, vulputate ac tincidunt vel, vestibulum vitae orci. Duis gravida mauris eget mauris pulvinar, lobortis tincidunt neque efficitur. Nunc blandit metus vitae faucibus vulputate. Curabitur rhoncus volutpat lorem, sit amet pulvinar ipsum. Fusce ultricies enim odio, a viverra quam tincidunt quis. Aliquam sollicitudin a sapien id efficitur. Proin at finibus elit, id gravida elit. Nulla facilisi. Ut tincidunt, ligula eu pulvinar dapibus, lorem nisl facilisis tellus, in ornare quam dolor quis libero. Pellentesque ut convallis orci. Donec volutpat nunc velit, tristique convallis purus lacinia sit amet. Maecenas porttitor cursus nisl sed porta.
|
|
</p>
|
|
<br/>
|
|
<div><figure style="text-align:center;width:30%;float:right;"><img src="/images/Love_Live!_Logo.png" style="margin:auto;width:100%;"><figcaption>Hello there! You can see this is the Love Live logo indeed! It is quite smol right now but that's okay. Let's keep on going with the text. If the caption is really long and with commas, they will now be combined,,,,,see how that works? Amazing!</figcaption></figure></div>
|
|
<p class="color5">
|
|
Here we demonstrate the love live logo. But wait, it's literally like in the middle wtf is going on.Here we demonstrate the love live logo. But wait, it's literally like in the middle wtf is going on.Here we demonstrate the love live logo. But wait, it's literally like in the middle wtf is going on.
|
|
</p>
|
|
<br/>
|
|
<p class="color6">
|
|
<pre>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">io</span>.<span class="keyword">IOException</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">charset</span>.<span class="keyword">Charset</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">CopyOption</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Files</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Path</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">Paths</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardCopyOption</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">nio</span>.<span class="class">file</span>.<span class="keyword">StandardOpenOption</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">AbstractMap</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">ArrayList</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">HashMap</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Iterator</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">List</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="keyword">Map</span>;<span class="variable"></span>
|
|
<span class="keyword">import</span> <span class="class">java</span>.<span class="class">util</span>.<span class="class">regex</span>.<span class="keyword">Pattern</span>;<span class="variable"></span>
|
|
<span class="keyword">public</span> <span class="keyword">class</span> <span class="keyword">sigPlace</span> <span class="variable"></span>{
|
|
<span class="comment">/* Test giant multi-line comment ""
|
|
final static String ROOTDIR = "sitefiles";
|
|
final static String REFDIR = "ref";
|
|
final static String OUTDIR = "out";
|
|
final static String ARTICLESDIR = "articles";
|
|
final static String UPLOADSDIR = "uploads";
|
|
final static String COMMENTSDIR = "comments";
|
|
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
|
|
static int PORT = 8080;
|
|
*/</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">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><String,String> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span><><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><><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><><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><><span class="function"></span>(<span class="string">"$TITLE_CONTENT_START"</span>, <span class="string">"<div class=\"contentWrapper\"><h1>"</span>),
|
|
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span><><span class="function"></span>(<span class="string">"$TITLE_CONTENT_END"</span>, <span class="string">"</h1><div class=\"content\" %ID%>"</span>),
|
|
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span><><span class="function"></span>(<span class="string">"$CONTENT_END"</span>, <span class="string">"</div>"</span>),
|
|
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span><><span class="function"></span>(<span class="string">"$DATE_CONTENT_START"</span>, <span class="string">"<div class=\"datebar\"></div><div class=\"date\">"</span>)
|
|
));
|
|
<span class="keyword">final</span> <span class="keyword">static</span> <span class="variable">HashMap</span><String,Path> <span class="keyword">ops</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span><><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><><span class="function"></span>(
|
|
<span class="string">"%DEFAULT"</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"DEFAULT.html"</span>)),
|
|
<span class="keyword">new</span> <span class="class">AbstractMap</span>.<span class="variable">SimpleEntry</span><><span class="function"></span>(
|
|
<span class="string">"%FOOTER"</span>, <span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"FOOTER.html"</span>))
|
|
));
|
|
<span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">main</span>(<span class="variable">String</span>[] args) {
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">args</span>.<span class="variable">length</span>><span class="number">0</span>&&<span class="class">args</span>.length%<span class="number">2</span>==<span class="number">0</span>) {
|
|
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
|
|
<span class="keyword">while</span> <span class="function"></span>(<span class="variable">i</span><<span class="class">args</span>.length) {
|
|
<span class="keyword">String</span> <span class="variable">arg1</span>=args[i];
|
|
<span class="keyword">String</span> <span class="variable">arg2</span>=args[i+<span class="number">1</span>];
|
|
i+=<span class="number">2</span>;
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">arg1</span>.<span class="function">equals</span>(<span class="string">"-p"</span><span class="variable"></span>)) {
|
|
PORT=<span class="class">Integer</span>.<span class="function">parseInt</span>(arg2);
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Port set to "</span>+PORT+<span class="string">"."</span>);
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Invalid argument \""</span>+arg1+<span class="string">"\"."</span>);
|
|
<span class="keyword">return</span>;
|
|
}
|
|
}
|
|
}
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Copying files over to output directory..."</span>);
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
<span class="function">copyDirectory</span>(<span class="string">"sitefiles"</span>,<span class="string">"out"</span>);
|
|
Iterator<Path> <span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">filter</span>(<span class="function"></span>(p)->!<span class="class">p</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">"images/"</span>)).<span class="function">iterator</span>();
|
|
<span class="function">ParseArticleFiles</span>(items);
|
|
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>)).<span class="function">iterator</span>();
|
|
<span class="function">ConvertArticleReferences</span>(items);
|
|
<span class="keyword">items</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"out"</span>,<span class="string">"articles"</span>)).<span class="function">iterator</span>();
|
|
<span class="function">GenerateArticleFiles</span>(items);
|
|
}<span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Copying files over failed!"</span>);
|
|
<span class="keyword">return</span>;
|
|
}
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Building directory listings..."</span>);
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
<span class="function">buildDirectoryListings</span>();
|
|
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
<span class="class">System</span>.<span class="class">err</span>.<span class="function">println</span>(<span class="string">"Failed to build directory listings!"</span>);
|
|
<span class="keyword">return</span>;
|
|
}
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Site has been built into the "</span>+OUTDIR+<span class="string">" directory."</span>);
|
|
<span class="function">ExportCodeFile</span>();
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"\nStarting web server..."</span>);
|
|
<span class="keyword">new</span> <span class="function">sigServer</span>(<span class="variable"></span>);
|
|
}
|
|
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ParseArticleFiles</span>(<span class="variable">Iterator</span><Path> items) {
|
|
<span class="keyword">while</span> <span class="function"></span>(<span class="class">items</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
|
|
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">items</span>.<span class="function">next</span>();
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isRegularFile</span>(<span class="variable">f</span>)) {
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Preparing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
|
|
List<String> <span class="keyword">content</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(f);
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="function">isHTMLFile</span>(<span class="variable">f</span>)) {
|
|
<span class="class">content</span>.<span class="function">addAll</span>(<span class="number">0</span>,<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">"%DEFAULT"</span>)));
|
|
<span class="class">content</span>.<span class="function">addAll</span>(<span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">"%FOOTER"</span>)));
|
|
}
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Parsing "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;i<<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="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="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">"<pre>"</span><span class="variable"></span>)) {
|
|
<span class="comment">//System.out.println("Inside <pre>");</span>
|
|
inCodeBlock=<span class="number">true</span><span class="keyword"></span>;
|
|
storedCodeBlock=<span class="string">""</span>;
|
|
s=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"<pre>"</span>));
|
|
}
|
|
}
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>&&<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"</pre>"</span>)) {
|
|
inCodeBlock=<span class="number">false</span><span class="keyword"></span>;
|
|
<span class="keyword">boolean</span> <span class="variable">keyword</span>=<span class="number">false</span><span class="keyword"></span>;
|
|
<span class="keyword">boolean</span> <span class="variable">inString</span>=<span class="number">false</span><span class="keyword"></span>;
|
|
<span class="keyword">boolean</span> <span class="variable">inChar</span>=<span class="number">false</span><span class="keyword"></span>;
|
|
<span class="keyword">boolean</span> <span class="variable">canBeNumericalConstant</span>=<span class="number">false</span><span class="keyword"></span>;
|
|
<span class="keyword">int</span> <span class="variable">lengthOfConstant</span>=<span class="number">0</span>;
|
|
storedCodeBlock+=<span class="class">s</span>.<span class="function">substring</span>(<span class="number">0</span>,<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"</pre>"</span>));
|
|
storedCodeBlock=<span class="class">storedCodeBlock</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(<span class="string">"<"</span>),<span class="string">"<"</span>);
|
|
s+=<span class="string">"</pre>"</span>;
|
|
storedCodeBlock=<span class="string">"<pre>"</span>+<span class="keyword">storedCodeBlock</span>;
|
|
<span class="keyword">int</span> <span class="variable">startPos</span>=<span class="number">0</span>;
|
|
<span class="keyword">String</span> <span class="variable">endText</span>=<span class="class">s</span>.<span class="function">substring</span>(<span class="class">s</span>.<span class="function">indexOf</span>(<span class="string">"</pre>"</span>)+<span class="string">"</pre>"</span>.<span class="function">length</span>(),<span class="class">s</span>.<span class="function">length</span>());
|
|
s=<span class="string">""</span>;
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">0</span>;j<<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>) {
|
|
inString=!<span class="keyword">inString</span>;
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inString</span>) {
|
|
s+=<span class="function">SPAN</span>(<span class="string">"string"</span>)+<span class="string">"\""</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
s+=<span class="string">"\"</span>"</span>;
|
|
startPos=j+<span class="number">1</span>;
|
|
}
|
|
} else
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!inString&&!inChar) {
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&<span class="function">validNumericalConstantCharacters</span>(lengthOfConstant, j)) {
|
|
lengthOfConstant++;
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Length of Constant now "</span>+lengthOfConstant);
|
|
}
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">canBeNumericalConstant</span>&&lengthOfConstant><span class="number">0</span>&&!<span class="function"></span>(<span class="function">validNumericalConstantCharacters</span>(lengthOfConstant, j))) {
|
|
s+=<span class="function">SPAN</span>(<span class="string">"number"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"</span>"</span>+<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>;
|
|
canBeNumericalConstant=<span class="number">false</span><span class="keyword"></span>;
|
|
startPos=j+<span class="number">1</span>;
|
|
} 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="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">"</span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
startPos=j+<span class="number">1</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">3</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">3</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"true"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">4</span>)&&!<span class="function">isAlphanumeric</span>(j+<span class="number">1</span>)) {
|
|
s+=<span class="function">SPAN</span>(<span class="string">"number"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">"</span>"</span>;
|
|
startPos=j+<span class="number">1</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">4</span>&&<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(j-<span class="number">4</span>,j+<span class="number">1</span>).<span class="function">equals</span>(<span class="string">"false"</span>)&&!<span class="function">isAlphanumeric</span>(j-<span class="number">5</span>)&&!<span class="function">isAlphanumeric</span>(j+<span class="number">1</span>)) {
|
|
s+=<span class="function">SPAN</span>(<span class="string">"number"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">"</span>"</span>;
|
|
startPos=j+<span class="number">1</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(<span class="variable">j</span>)==<span class="string">'('</span>) {
|
|
s+=<span class="function">SPAN</span>(<span class="string">"function"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"</span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
startPos=j+<span class="number">1</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">0</span>&&<span class="function">isAlphanumeric</span>(j-<span class="number">1</span>) && <span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">' '</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j-<span class="number">1</span>)!=<span class="string">' '</span>) {
|
|
<span class="comment">//Previous section was a 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">"</span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
startPos=j+<span class="number">1</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">j</span>><span class="number">0</span>&&<span class="function">isAlphanumeric</span>(j-<span class="number">1</span>) && <span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">';'</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">':'</span>)) {
|
|
<span class="comment">//Previous section was a 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">"</span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
startPos=j+<span class="number">1</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">keyword</span>&&!<span class="function"></span>(<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)>=<span class="string">'0'</span>&&<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)<=<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)<=<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)<=<span class="string">'z'</span>||<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)==<span class="string">' '</span>)) {
|
|
keyword=<span class="number">false</span><span class="keyword"></span>;
|
|
s+=<span class="function">SPAN</span>(<span class="string">"variable"</span>)+<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="string">"</span>"</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
startPos=j+<span class="number">1</span>;
|
|
} else
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="function">isAlphanumeric</span>(j)){
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">startPos</span><j) {
|
|
s+=<span class="class">storedCodeBlock</span>.<span class="function">substring</span>(startPos,j)+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
}
|
|
startPos=j+<span class="number">1</span>;
|
|
}
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
s+=<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j);
|
|
startPos=j+<span class="number">1</span>;
|
|
}
|
|
<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)<=<span class="string">'9'</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)) {
|
|
canBeNumericalConstant=<span class="number">true</span><span class="keyword"></span>;
|
|
lengthOfConstant=<span class="number">0</span>;
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Found "</span>+<span class="class">storedCodeBlock</span>.<span class="function">charAt</span>(j)+<span class="string">", can be numeric..."</span>);
|
|
}
|
|
}
|
|
s+=<span class="keyword">endText</span>;
|
|
<span class="comment">//System.out.println("Stored code block: "+storedCodeBlock);</span>
|
|
} <span class="keyword">else</span> <span class="variable"></span>
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">inCodeBlock</span>) {
|
|
storedCodeBlock+=s+<span class="string">"\n"</span>;
|
|
s=<span class="string">" "</span>;
|
|
}
|
|
}
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">length</span>(<span class="variable"></span>)><span class="number">0</span>&&<span class="function">isArticleFile</span>(f)) {
|
|
<span class="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="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=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="comment">//Use ⤈ if there's more text to be shown than can fit.</span>
|
|
} else
|
|
<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=<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>);
|
|
} <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">charAt</span>(<span class="number">0</span>)<span class="variable"></span>==<span class="string">':'</span>) {
|
|
<span class="comment">//Image with caption.</span>
|
|
<span class="comment">//Format:</span>
|
|
<span class="comment">//:<url>,<left|right|center>,<width>,<caption></span>
|
|
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>));
|
|
<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>]);
|
|
<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<<span class="class">splitter</span>.<span class="keyword">length</span>;j++) {
|
|
<span class="class">captionText</span>.<span class="function">append</span>(<span class="string">","</span>).<span class="function">append</span>(splitter[j]);
|
|
}
|
|
s=<span class="string">"<div><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">"\"><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%;\"><figcaption>"</span>+<span class="class">captionText</span>.<span class="function">toString</span>()+<span class="string">"</figcaption></figure></div>"</span>;
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
<span class="comment">//It's regular content, so add paragraphs.</span>
|
|
s=<span class="string">"<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">"</p>"</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)) {
|
|
s=<span class="string">"<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>()) {
|
|
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));
|
|
}
|
|
<span class="class">content</span>.<span class="function">set</span>(i,s);
|
|
}
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Writing to "</span>+<span class="class">f</span>.<span class="function">toAbsolutePath</span>());
|
|
<span class="class">Files</span>.<span class="function">write</span>(f, content, <span class="class">Charset</span>.<span class="function">defaultCharset</span>(),<span class="class">StandardOpenOption</span>.CREATE,<span class="class">StandardOpenOption</span>.TRUNCATE_EXISTING,<span class="class">StandardOpenOption</span>.WRITE);
|
|
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+<span class="class">f</span>.<span class="function">getFileName</span>() + <span class="string">" conversion complete!"</span>);
|
|
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
<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)<=<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)<=<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)<=<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">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)<=<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)<=<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)<=<span class="string">'z'</span>;
|
|
}
|
|
<span class="comment">/**
|
|
* 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">return</span> <span class="string">"<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><Path> items){
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Generating article files..."</span>);
|
|
<span class="keyword">while</span> <span class="function"></span>(<span class="class">items</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
|
|
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">items</span>.<span class="function">next</span>();
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isRegularFile</span>(<span class="variable">f</span>)&&<span class="function">isArticleFile</span>(f)) {
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Creating article for "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
|
|
List<String> <span class="keyword">content</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(f);
|
|
List<String> <span class="keyword">preContent</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">"%DEFAULT"</span>));
|
|
List<String> <span class="keyword">postContent</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">"%FOOTER"</span>));
|
|
<span class="keyword">StringBuilder</span> <span class="keyword">sb</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="variable"></span>);
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: preContent) {
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
|
|
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
|
|
}
|
|
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
|
|
}
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: content) {
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
|
|
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
|
|
}
|
|
d=<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>);
|
|
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
|
|
}
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: postContent) {
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
|
|
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
|
|
}
|
|
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
|
|
}
|
|
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">f</span>.<span class="function">getParent</span>().<span class="function">toString</span>(),<span class="class">f</span>.<span class="function">getFileName</span>()+<span class="string">".html"</span>),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
|
|
}
|
|
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
}
|
|
}
|
|
}
|
|
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ConvertArticleReferences</span>(<span class="variable">Iterator</span><Path> items) {
|
|
<span class="keyword">while</span> <span class="function"></span>(<span class="class">items</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
|
|
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">items</span>.<span class="function">next</span>();
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Looking for Article References..."</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
|
|
<span class="keyword">boolean</span> <span class="variable">articleJavascriptIncluded</span>=<span class="number">false</span><span class="keyword"></span>;
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isRegularFile</span>(<span class="variable">f</span>)&&<span class="function">isHTMLFile</span>(f)) {
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Searching "</span>+<span class="class">f</span>.<span class="function">getFileName</span>());
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
List<String> <span class="keyword">content</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(f);
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;i<<span class="class">content</span>.<span class="function">size</span>();i++) {
|
|
<span class="keyword">String</span> <span class="keyword">s</span> <span class="variable"></span>= <span class="class">content</span>.<span class="function">get</span>(i);
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">s</span>.<span class="function">length</span>(<span class="variable"></span>)><span class="number">0</span>&&<span class="class">s</span>.<span class="function">contains</span>(<span class="string">"$ARTICLE_PREVIEW"</span>)) {
|
|
<span class="keyword">String</span> <span class="keyword">article</span> <span class="variable"></span>= ARTICLESDIR+<span class="string">"/"</span>+<span class="class">s</span>.<span class="function">replace</span>(<span class="string">"$ARTICLE_PREVIEW "</span>,<span class="string">""</span>)+<span class="string">".article"</span>;
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Found article preview request in "</span>+<span class="class">f</span>.<span class="function">getFileName</span>()+<span class="string">" for article "</span>+article+<span class="string">"."</span>);
|
|
<span class="keyword">Path</span> <span class="keyword">file</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,article);
|
|
List<String> <span class="keyword">newData</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">newData</span>.<span class="function">size</span>(<span class="variable"></span>)><span class="number">0</span>) {
|
|
<span class="class">content</span>.<span class="function">set</span>(i,<span class="class">newData</span>.<span class="function">get</span>(<span class="number">0</span>));
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="number">1</span>;j<<span class="class">newData</span>.<span class="function">size</span>();j++) {
|
|
<span class="class">content</span>.<span class="function">add</span>(i+j, <span class="class">newData</span>.<span class="function">get</span>(j));
|
|
}
|
|
<span class="keyword">String</span> <span class="variable">lastline</span>=<span class="class">content</span>.<span class="function">get</span>(i+<span class="class">newData</span>.<span class="function">size</span>()-<span class="number">1</span>);
|
|
lastline=<span class="class">lastline</span>.<span class="function">replace</span>(<span class="string">"%CONDITIONAL_EXPAND%"</span>,<span class="string">"<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">"')\"><br/><br/><br/><br/>⤈ Click to expand.</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);<span class="comment">//<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\"><br/><br/><br/><br/>⤈ Click to expand.</div>");</span>
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
<span class="class">content</span>.<span class="function">set</span>(i,<span class="string">""</span>);
|
|
}
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!articleJavascriptIncluded) {
|
|
List<String> <span class="keyword">articlejs</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">Paths</span>.<span class="function">get</span>(REFDIR,<span class="string">"article.js"</span>));
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">int</span> <span class="variable">j</span>=<span class="class">articlejs</span>.<span class="function">size</span>()-<span class="number">1</span>;j>=<span class="number">0</span>;j--) {
|
|
<span class="class">content</span>.<span class="function">add</span>(i,<span class="class">articlejs</span>.<span class="function">get</span>(j));
|
|
}
|
|
articleJavascriptIncluded=<span class="number">true</span><span class="keyword"></span>;
|
|
}
|
|
}
|
|
}
|
|
<span class="class">Files</span>.<span class="function">write</span>(f,content);
|
|
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">copyDirectory</span>(<span class="keyword">String</span> <span class="variable">sourceDirectoryLocation</span>, <span class="keyword">String</span> <span class="variable">destinationDirectoryLocation</span>)
|
|
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
|
|
<span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(sourceDirectoryLocation))
|
|
.<span class="function">forEach</span>(<span class="keyword">source</span> <span class="variable"></span>-> {
|
|
<span class="keyword">Path</span> <span class="keyword">destination</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(destinationDirectoryLocation, <span class="class">source</span>.<span class="function">toString</span>()
|
|
.<span class="function">substring</span>(<span class="class">sourceDirectoryLocation</span>.<span class="function">length</span>()));
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(<span class="variable">destination</span>)) {
|
|
<span class="class">Files</span>.<span class="function">createDirectories</span>(destination);
|
|
} <span class="keyword">else</span> <span class="variable"></span>{
|
|
<span class="class">Files</span>.<span class="function">copy</span>(source, destination, <span class="keyword">new</span> <span class="variable">CopyOption</span>[]{<span class="class">StandardCopyOption</span>.COPY_ATTRIBUTES,<span class="class">StandardCopyOption</span>.REPLACE_EXISTING});
|
|
}
|
|
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
}
|
|
});
|
|
}
|
|
<span class="keyword">static</span> <span class="keyword">void</span> <span class="function">buildDirectoryListings</span>(<span class="variable"></span>)
|
|
<span class="keyword">throws</span> <span class="keyword">IOException</span> <span class="variable"></span>{
|
|
<span class="keyword">String</span> <span class="variable">startingPath</span>=<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR).<span class="function">toAbsolutePath</span>().<span class="function">toString</span>();
|
|
HashMap<String,List<Path>> <span class="keyword">map</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="variable">HashMap</span><><span class="function"></span>();
|
|
Iterator<Path> <span class="keyword">it</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">walk</span>(<span class="class">Paths</span>.<span class="function">get</span>(<span class="class">sigPlace</span>.OUTDIR)).<span class="function">iterator</span>();
|
|
<span class="class">map</span>.<span class="function">put</span>(<span class="string">"/"</span>,<span class="keyword">new</span> <span class="variable">ArrayList</span><Path><span class="function"></span>());
|
|
<span class="keyword">while</span> <span class="function"></span>(<span class="class">it</span>.<span class="function">hasNext</span>(<span class="variable"></span>)) {
|
|
<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>= <span class="class">it</span>.<span class="function">next</span>();
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>().<span class="function">equals</span>(OUTDIR)) {
|
|
<span class="keyword">String</span> <span class="keyword">myKey</span> <span class="variable"></span>= <span class="class">f</span>.<span class="function">toAbsolutePath</span>().<span class="function">toString</span>().<span class="function">replace</span>(startingPath,<span class="string">""</span>).<span class="function">replace</span>(<span class="class">f</span>.<span class="function">getFileName</span>().<span class="function">toString</span>(),<span class="string">""</span>);
|
|
<span class="comment">//System.out.println(myKey+","+f);</span>
|
|
<span class="class">map</span>.<span class="function">putIfAbsent</span>(myKey,<span class="keyword">new</span> <span class="variable">ArrayList</span><Path><span class="function"></span>());
|
|
<span class="class">map</span>.<span class="function">get</span>(myKey).<span class="function">add</span>(f);
|
|
}
|
|
}
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Directory structure determined:"</span>);
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" "</span>+map);
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">key</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">keySet</span>()) {
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">"Creating directory listing for "</span>+key+<span class="string">"..."</span>);
|
|
<span class="keyword">StringBuilder</span> <span class="keyword">sb</span> <span class="variable"></span>= <span class="keyword">new</span> <span class="function">StringBuilder</span>(<span class="string">""</span><span class="variable"></span>);
|
|
List<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<String> <span class="keyword">data2</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(<span class="class">ops</span>.<span class="function">get</span>(<span class="string">"%FOOTER"</span>));
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data) {
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
|
|
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
|
|
}
|
|
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
|
|
}
|
|
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"<h2>Directory Listing for "</span>+key+<span class="string">"</h2>"</span>);
|
|
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"<div class=\"folderlisting\"><a href=\""</span>)
|
|
.<span class="function">append</span>(key)
|
|
.<span class="function">append</span>(<span class="string">"..\" class=\"icon\">📁</a><a href=\""</span>)
|
|
.<span class="function">append</span>(key)
|
|
.<span class="function">append</span>(<span class="string">"..\">.. </a><a href=\""</span>)
|
|
.<span class="function">append</span>(key)
|
|
.<span class="function">append</span>(<span class="string">"..\" class=\"nounderline\">(Previous Directory)</a></div>"</span>);
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">Path</span> <span class="keyword">f</span> <span class="variable"></span>: <span class="class">map</span>.<span class="function">get</span>(key)) {
|
|
<span class="class">sb</span>.<span class="function">append</span>(<span class="string">"<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>)
|
|
.<span class="function">append</span>(<span class="string">"<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>)
|
|
.<span class="function">append</span>(<span class="function"></span>(<span class="class">Files</span>.<span class="function">isDirectory</span>(f)?<span class="string">"📁"</span>:<span class="string">"🗎"</span>))
|
|
.<span class="function">append</span>(<span class="string">"</a>"</span>)
|
|
.<span class="function">append</span>(<span class="string">"<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>)
|
|
.<span class="function">append</span>(<span class="class">f</span>.<span class="function">getFileName</span>())
|
|
.<span class="function">append</span>(<span class="string">"</a>\t"</span>)
|
|
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getLastModifiedTime</span>(f))
|
|
.<span class="function">append</span>(<span class="string">"\t"</span>)
|
|
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">getOwner</span>(f))
|
|
.<span class="function">append</span>(<span class="string">"\t"</span>)
|
|
.<span class="function">append</span>(<span class="class">Files</span>.<span class="function">size</span>(f))
|
|
.<span class="function">append</span>(<span class="string">"</div>\n"</span>);
|
|
}
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">d</span> <span class="variable"></span>: data2) {
|
|
<span class="keyword">for</span> <span class="function"></span>(<span class="keyword">String</span> <span class="keyword">k</span> <span class="variable"></span>: <span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">keySet</span>()) {
|
|
d=<span class="class">d</span>.<span class="function">replaceAll</span>(<span class="class">Pattern</span>.<span class="function">quote</span>(k),<span class="class">sigPlace</span>.<span class="class">map</span>.<span class="function">get</span>(k));
|
|
}
|
|
<span class="class">sb</span>.<span class="function">append</span>(d).<span class="function">append</span>(<span class="string">"\n"</span>);
|
|
}
|
|
<span class="keyword">Path</span> <span class="keyword">newf</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,key,DIRECTORYLISTING_FILENAME),<span class="class">sb</span>.<span class="function">toString</span>().<span class="function">getBytes</span>());
|
|
<span class="class">System</span>.<span class="class">out</span>.<span class="function">println</span>(<span class="string">" Added info for ("</span>+<span class="class">map</span>.<span class="function">size</span>()+<span class="string">") files to "</span>+<span class="class">newf</span>.<span class="function">toAbsolutePath</span>());
|
|
}
|
|
}
|
|
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isArticleFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
|
|
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".article"</span>);
|
|
}
|
|
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">boolean</span> <span class="function">isHTMLFile</span>(<span class="keyword">Path</span> <span class="variable">f</span>) {
|
|
<span class="keyword">return</span> <span class="class">f</span>.<span class="function">getFileName</span>(<span class="variable"></span>).<span class="function">toString</span>().<span class="function">contains</span>(<span class="string">".html"</span>);
|
|
}
|
|
<span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="function">ExportCodeFile</span>(<span class="variable"></span>) {
|
|
<span class="keyword">try</span> <span class="variable"></span>{
|
|
<span class="keyword">Path</span> <span class="keyword">file</span> <span class="variable"></span>= <span class="class">Paths</span>.<span class="function">get</span>(<span class="string">"sigServer.java"</span>);
|
|
List<String> <span class="keyword">data</span> <span class="variable"></span>= <span class="class">Files</span>.<span class="function">readAllLines</span>(file);
|
|
<span class="keyword">int</span> <span class="variable">i</span>=<span class="number">0</span>;
|
|
<span class="keyword">while</span> <span class="function"></span>(<span class="variable"></span>!<span class="class">data</span>.<span class="function">get</span>(i++).<span class="function">contains</span>(<span class="string">"sigServer()"</span>)&&i<<span class="class">data</span>.<span class="function">size</span>());
|
|
<span class="keyword">if</span> <span class="function"></span>(<span class="variable">i</span><<span class="class">data</span>.<span class="function">size</span>()) {
|
|
<span class="class">Files</span>.<span class="function">write</span>(<span class="class">Paths</span>.<span class="function">get</span>(OUTDIR,<span class="string">"codeBackground"</span>),<span class="class">data</span>.<span class="function">subList</span>(i, <span class="class">Math</span>.<span class="function">min</span>(i+<span class="number">40</span>,<span class="class">data</span>.<span class="function">size</span>())),<span class="class">Charset</span>.<span class="function">defaultCharset</span>(),<span class="class">StandardOpenOption</span>.CREATE,<span class="class">StandardOpenOption</span>.TRUNCATE_EXISTING,<span class="class">StandardOpenOption</span>.WRITE);
|
|
}
|
|
} <span class="keyword">catch</span> <span class="function"></span>(<span class="keyword">IOException</span> <span class="variable">e</span>) {
|
|
<span class="class">e</span>.<span class="function">printStackTrace</span>();
|
|
}
|
|
|
|
}
|
|
}
|
|
</pre>
|
|
</p>
|
|
</div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div></div>
|
|
<hr/>
|
|
<script type="text/javascript">
|
|
function changeColor() {
|
|
document.getElementById("submit").style.borderColor=document.getElementById("msg").style.borderColor=document.getElementById("name").style.borderColor=document.getElementById("col").style.borderColor=document.getElementById("col").options[document.getElementById("col").selectedIndex].text
|
|
}
|
|
function submit() {
|
|
document.getElementById("submit").disabled=
|
|
document.getElementById("name").disabled=
|
|
document.getElementById("col").disabled=
|
|
document.getElementById("msg").disabled=true;
|
|
fetch("/COMMENTS?submit=true&article=sigplace1.comment&message="+encodeURIComponent(document.getElementById("msg").value)+"&name="
|
|
+encodeURIComponent(document.getElementById("name").value)+"&color="
|
|
+encodeURIComponent(document.getElementById("col").options[document.getElementById("col").selectedIndex].text)
|
|
).then((data)=>data.text())
|
|
.then((data)=>{
|
|
document.getElementById("msg").value=""
|
|
document.getElementById("name").value=""
|
|
document.getElementById("submit").disabled=
|
|
document.getElementById("name").disabled=
|
|
document.getElementById("col").disabled=
|
|
document.getElementById("msg").disabled=false;
|
|
fetchComments()
|
|
})
|
|
}
|
|
</script>
|
|
<div id="commentForm">
|
|
<b>Leave a comment!</b><br/><br/>
|
|
<label for="name">Display Name: </label><input id="name"></input><br/><br/>
|
|
<label for="col">Display Color: </label><select id="col" onchange="changeColor()">
|
|
<option value="RED">RED</option>
|
|
<option value="GREEN" selected>GREEN</option>
|
|
<option value="YELLOW">YELLOW</option>
|
|
<option value="BLUE">BLUE</option>
|
|
<option value="MAGENTA">MAGENTA</option>
|
|
<option value="CYAN">CYAN</option>
|
|
<option value="WHITE">WHITE</option>
|
|
</select><br/><br/>
|
|
<label for="msg" style="vertical-align:top;display:inline;">Message: </label><textarea id="msg"></textarea><br/><br/>
|
|
<button id="submit" onclick="submit()">POST</button>
|
|
</div><br/><br/>
|
|
<div id="commentContainer" style="visibility:hidden;">
|
|
<h2>Comments <sub>(<span class="commentCounter" id="commentCounter">0</span>)</sub></h2>
|
|
<div class="comments" id="comments"></div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
function fetchComments() {
|
|
fetch("/COMMENTS?article=sigplace1.comment").then((data)=>data.text())
|
|
.then((data)=>{
|
|
data=data.split("\n");
|
|
document.getElementById("comments").innerHTML="";
|
|
document.getElementById("commentCounter").innerText=data[0]
|
|
for (var i=data.length-3;i>=1;i-=2) {
|
|
if (data[i].trim().length>0&&data[i+1].trim().length>0) {
|
|
document.getElementById("comments").innerHTML+="<div id=\"msg"+((i+1)/2)+"\" class=\"commentDisplayer\"><div class=\"commentData\">"+decodeURIComponent(data[i])+"</div><br>"
|
|
data2=data[i+1].split(";");
|
|
document.getElementById("msg"+((i+1)/2)).style.borderColor=data2[1]
|
|
document.getElementById("comments").innerHTML+="<div class=\"commentInfo\"><sup>- "+decodeURIComponent(data2[0])+"</sup></div></div><br>"
|
|
}
|
|
}
|
|
document.getElementById("commentContainer").style.visibility="visible"
|
|
})
|
|
}
|
|
fetchComments()
|
|
changeColor()
|
|
</script>
|
|
|
|
</div> <!--End Content Body-->
|
|
<div class="codeForeground" id="codeForeground"></div>
|
|
<div class="codeBackground" id="codeBackground"></div>
|
|
</body>
|
|
<footer>
|
|
|
|
</footer>
|
|
</html>
|
|
|