article preview modules implemented

main
sigonasr2, Sig, Sigo 3 years ago
parent 70e50c0f52
commit 9dd9a90416
  1. 12
      out/DIRECTORY_LISTING
  2. 6
      out/articles/DIRECTORY_LISTING
  3. 6
      out/articles/test articles/DIRECTORY_LISTING
  4. 23
      out/otherpage.html
  5. 14
      sigPlace.java

@ -18,12 +18,12 @@
<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-05-04T20:08:17.510417Z gitpod 116</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-05-05T12:57:24.310258Z gitpod 116</div>
<div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-05-04T20:08:17.482417Z gitpod 2635</div> <div class="filelisting"><a href="/codeBackground" class="icon">&#x1F5CE;</a><a href="/codeBackground">codeBackground</a> 2022-05-05T12:57:24.274258Z gitpod 2635</div>
<div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-05-04T20:08:17.490417Z gitpod 941</div> <div class="filelisting"><a href="/otherpage.html" class="icon">&#x1F5CE;</a><a href="/otherpage.html">otherpage.html</a> 2022-05-05T12:57:24.302258Z gitpod 5877</div>
<div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-05-04T20:08:17.494417Z gitpod 1093</div> <div class="filelisting"><a href="/reset.css" class="icon">&#x1F5CE;</a><a href="/reset.css">reset.css</a> 2022-05-05T12:57:24.282258Z gitpod 1093</div>
<div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-05-04T20:08:17.498417Z gitpod 4314</div> <div class="filelisting"><a href="/sig.css" class="icon">&#x1F5CE;</a><a href="/sig.css">sig.css</a> 2022-05-05T12:57:24.290258Z gitpod 4314</div>
<div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-05-04T20:08:17.502417Z gitpod 829</div> <div class="filelisting"><a href="/testfile.html" class="icon">&#x1F5CE;</a><a href="/testfile.html">testfile.html</a> 2022-05-05T12:57:24.306258Z gitpod 829</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -18,9 +18,9 @@
<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/curabitur vel tempus ex.article" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-05-04T20:08:17.466417Z gitpod 618</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/curabitur vel tempus ex.article" class="icon">&#x1F5CE;</a><a href="/articles/curabitur vel tempus ex.article">curabitur vel tempus ex.article</a> 2022-05-05T12:57:24.258258Z gitpod 618</div>
<div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-05-04T20:08:17.474417Z gitpod 1559</div> <div class="filelisting"><a href="/articles/sigplace1.article" class="icon">&#x1F5CE;</a><a href="/articles/sigplace1.article">sigplace1.article</a> 2022-05-05T12:57:24.262258Z gitpod 1559</div>
<div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-05-04T20:08:17.398417Z gitpod 69</div> <div class="folderlisting"><a href="/articles/test articles" class="icon">&#x1F4C1;</a><a href="/articles/test articles">test articles</a> 2022-05-05T12:57:24.190258Z gitpod 69</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -18,9 +18,9 @@
<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" class="icon">&#x1F5CE;</a><a href="/articles/test articles/test1.article">test1.article</a> 2022-05-04T20:08:17.474417Z gitpod 1111</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-05-05T12:57:24.266258Z gitpod 1111</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-05-04T20:08:17.474417Z gitpod 807</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-05-05T12:57:24.266258Z gitpod 807</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-05-04T20:08:17.478417Z gitpod 1020</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-05-05T12:57:24.266258Z gitpod 1020</div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -19,11 +19,24 @@
<div class="contentBody"> <div class="contentBody">
This is a different webpage.<hr> This is a different webpage.<hr>
$ARTICLE_PREVIEW sigplace1 <div class="contentWrapper"><h1>Welcome to SigPlace!</h1><div class="content" id="content_0">
$ARTICLE_PREVIEW test articles/test1 This is a SigPlace article! It will contain information that is important (probably) and will be layed out as such.
$ARTICLE_PREVIEW test articles/test2 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.
$ARTICLE_PREVIEW test articles/test3 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.
$ARTICLE_PREVIEW curabitur vel tempus ex Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque volutpat mollis sem sit amet lacinia. Phasellus vitae varius elit. Proin at vestibulum nunc, in pellentesque orci. Vestibulum efficitur mi vel augue pellentesque eleifend. Aenean eu sem ullamcorper justo consectetur ornare. Donec molestie tincidunt dui eget venenatis. Sed varius est faucibus, blandit turpis non, rhoncus neque. Integer sem felis, cursus in elementum ac, mollis in justo. Pellentesque vel risus turpis. Curabitur lectus neque, lobortis in varius et, tristique convallis erat. Morbi id sodales leo. Cras bibendum bibendum lacus, eu ullamcorper sem tempus sed. Nam ut consectetur nulla.
</div><div class="datebar"></div><div class="date">3 May 2022 10:25AM</div><div class="unexpanded" id="expand_5" onClick="expand(5)"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>A Test Title</h1><div class="content" id="content_0">
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.
</div><div class="datebar"></div><div class="date">2 May 2022 10:16AM</div><div class="unexpanded" id="expand_2" onClick="expand(2)"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>Another test title</h1><div class="content" id="content_0">
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.
</div><div class="datebar"></div><div class="date">1 May 2022 05:13AM</div><div class="unexpanded" id="expand_2" onClick="expand(2)"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>And More</h1><div class="content" id="content_0">
Curabitur suscipit quam tellus, non rhoncus diam vehicula in. Aliquam ut dapibus tortor. Cras accumsan arcu vel ante maximus ornare. Nam tempus fermentum leo maximus euismod. Donec vehicula pretium est a ultrices. Nunc blandit nibh lorem, nec blandit leo posuere quis. Sed mauris ligula, euismod eu aliquam vel, rhoncus eget magna. Proin eget tortor ut ligula suscipit mattis. Integer rutrum aliquet eleifend. Suspendisse leo libero, placerat nec mi id, sagittis malesuada felis. Quisque euismod ante cursus elit lobortis, eu tempus ligula condimentum. Mauris viverra metus et dignissim efficitur. Ut placerat nunc nunc, eu tempus neque ultrices nec. Suspendisse et magna risus. Phasellus in ullamcorper tortor. Sed lobortis ut mi in blandit.
</div><div class="datebar"></div><div class="date">30 Apr 2022 6:14PM</div><div class="unexpanded" id="expand_2" onClick="expand(2)"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
<div class="contentWrapper"><h1>Curabitur vel tempus ex</h1><div class="content" id="content_0">
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.
</div><div class="datebar"></div><div class="date">29 Apr 2022 7:37PM</div><div class="unexpanded" id="expand_2" onClick="expand(2)"><br/><br/><br/><br/>&#x2908; Click to expand.</div></div>
</div> <!--End Content Body--> </div> <!--End Content Body-->
<div class="codeForeground" id="codeForeground"></div> <div class="codeForeground" id="codeForeground"></div>

@ -19,6 +19,7 @@ public class sigPlace {
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";
final static String ARTICLESDIR = "articles";
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING"; final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
static int PORT = 8080; static int PORT = 8080;
@ -143,12 +144,21 @@ public class sigPlace {
for (int i=0;i<content.size();i++) { for (int i=0;i<content.size();i++) {
String s = content.get(i); String s = content.get(i);
if (s.length()>0&&s.contains("$ARTICLE_PREVIEW")) { if (s.length()>0&&s.contains("$ARTICLE_PREVIEW")) {
String article = s.replace("$ARTICLE_PREVIEW ",""); String article = ARTICLESDIR+"/"+s.replace("$ARTICLE_PREVIEW ","")+".article";
System.out.println(" Found article preview request in "+f.getFileName()+" for article "+article+"."); System.out.println(" Found article preview request in "+f.getFileName()+" for article "+article+".");
Path file = Paths.get(OUTDIR,article); Path file = Paths.get(OUTDIR,article);
content.remove(i--); List<String> newData = Files.readAllLines(file);
if (newData.size()>0) {
content.set(i,newData.get(0));
for (int j=1;j<newData.size();j++) {
content.add(i+j, newData.get(j));
}
} else {
content.set(i,"");
}
} }
} }
Files.write(f,content);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

Loading…
Cancel
Save