+
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.
-
+
<><Test>"</test></test2><test3>"
diff --git a/out/articles/curabitur vel tempus ex.article.html b/out/articles/curabitur vel tempus ex.article.html
index e94590b..fb19fc4 100644
--- a/out/articles/curabitur vel tempus ex.article.html
+++ b/out/articles/curabitur vel tempus ex.article.html
@@ -18,13 +18,13 @@
Curabitur vel tempus ex
+
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.
-
+
<><Test>"</test></test2><test3>"
diff --git a/out/articles/sigplace1.article b/out/articles/sigplace1.article
index e4e49a0..ea5b9c3 100644
--- a/out/articles/sigplace1.article
+++ b/out/articles/sigplace1.article
@@ -51,7 +51,6 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
-
@@ -60,7 +59,8 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid -
+ +
@@ -514,24 +514,26 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid import java.util.Map; import java.util.regex.Pattern; public class sigPlace { - final static String ROOTDIR = "sitefiles"; - final static String REFDIR = "ref"; - final static String OUTDIR = "out"; - final static String ARTICLESDIR = "articles"; - final static String UPLOADSDIR = "uploads"; - final static String COMMENTSDIR = "comments"; - final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING"; - static int PORT = 8080; - static double COLOR_ROTATION = 0; + /* 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; + */ + static double COLOR_ROTATION = 0; static boolean inCodeBlock = false; static String storedCodeBlock = ""; final static HashMap<String,String> map = new HashMap<>(Map.ofEntries( new AbstractMap.SimpleEntry<>("$SITENAME", "SigPlace"), new AbstractMap.SimpleEntry<>("$SITE_BACKCOL", "#111"), - new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_START", "<div class=\"contentWrapper\"><h1>"), - new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_END", "</h1><div class=\"content\" %ID%>"), + new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_START", "<div class=\"contentWrapper\"><h1>"), + new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_END", "</h1><div class=\"content\" %ID%>"), new AbstractMap.SimpleEntry<>("$CONTENT_END", "</div>"), - new AbstractMap.SimpleEntry<>("$DATE_CONTENT_START", "<div class=\"datebar\"></div><div class=\"date\">") + new AbstractMap.SimpleEntry<>("$DATE_CONTENT_START", "<div class=\"datebar\"></div><div class=\"date\">") )); final static HashMap<String,Path> ops = new HashMap<>(Map.ofEntries( new AbstractMap.SimpleEntry<>( @@ -550,7 +552,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid PORT=Integer.parseInt(arg2); System.out.println("Port set to "+PORT+"."); } else { - System.err.println("Invalid argument \""+arg1+"\"."); + System.err.println("Invalid argument \""+arg1+"\"."); return; } } @@ -597,11 +599,11 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid System.out.println(" Parsing "+f.getFileName()); for (int i=0;i<content.size();i++) { String s = content.get(i); - //System.out.println(s); + //System.out.println(s); if (s.length()>0&&(isHTMLFile(f)||isArticleFile(f))) { if (!inCodeBlock) { if (s.contains("<pre>")) { - //System.out.println("Inside <pre>"); + //System.out.println("Inside <pre>"); inCodeBlock=true; storedCodeBlock=""; s=s.substring(0,s.indexOf("<pre>")); @@ -622,12 +624,12 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length()); s=""; for (int j=0;j<storedCodeBlock.length();j++) { - if (storedCodeBlock.charAt(j)==""") { + if (storedCodeBlock.charAt(j)=='"') { inString=!inString; if (inString) { - s+=SPAN("string")+"\""; - } else { - s+="\"</span>"; + s+=SPAN("string")+"\""; + } else { + s+="\"</span>"; startPos=j+1; } } else @@ -638,13 +640,13 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) { s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); - //System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)); + //System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)); lengthOfConstant=0; canBeNumericalConstant=false; startPos=j+1; } else - if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)==".") { - //Previous section was a member. + if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') { + //Previous section was a member. s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else @@ -656,23 +658,23 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>"; startPos=j+1; } else - if (storedCodeBlock.charAt(j)=="(") { + if (storedCodeBlock.charAt(j)=='(') { s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else - if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==" "&&storedCodeBlock.charAt(j-1)!=" ") { - //Previous section was a keyword. + if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') { + //Previous section was a keyword. keyword=true; s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else - if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==";"||storedCodeBlock.charAt(j)==":")) { - //Previous section was a keyword. - //keyword=true; + if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) { + //Previous section was a keyword. + //keyword=true; s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else - if (keyword&&!(storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9"||storedCodeBlock.charAt(j)>="A"&&storedCodeBlock.charAt(j)<="Z"||storedCodeBlock.charAt(j)>="a"&&storedCodeBlock.charAt(j)<="z"||storedCodeBlock.charAt(j)==" ")) { + if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) { keyword=false; s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; @@ -689,7 +691,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid s+=storedCodeBlock.charAt(j); startPos=j+1; } - if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9")) { + if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) { canBeNumericalConstant=false; } if (!canBeNumericalConstant&&!isAlphanumeric(j)) { @@ -699,7 +701,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } } s+=endText; - //System.out.println("Stored code block: "+storedCodeBlock); + //System.out.println("Stored code block: "+storedCodeBlock); } else if (inCodeBlock) { storedCodeBlock+=s+"\n"; @@ -707,33 +709,33 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } } if (s.length()>0&&isArticleFile(f)) { - //Check for markdown pieces. - if (s.charAt(0)=="-") { - //Start of a title piece. + //Check for markdown pieces. + if (s.charAt(0)=='-') { + //Start of a title piece. s=s.replace("-",map.get("$TITLE_CONTENT_START")); - s=s+map.get("$TITLE_CONTENT_END").replace("%ID%","id=\"content_"+f+"\""); - //Use ⤈ if "s more text to be shown than can fit. + s=s+map.get("$TITLE_CONTENT_END").replace("%ID%","id=\"content_"+f+"\""); + //Use ⤈ if there's more text to be shown than can fit. } else - if (s.contains("===")) { - s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END"); - } else - if (s.charAt(0)==":") { - //Image with caption. - //Format: - //:<url>,<left|right|center>,<width>,<caption> - String[] splitter = s.split(Pattern.quote(",")); - StringBuilder captionText = new StringBuilder(splitter[3]); - for (int j=4;j<splitter.length;j++) { - captionText.append(",").append(splitter[j]); + if (s.contains("===")) { + s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END"); + } else + if (s.charAt(0)==':') { + //Image with caption. + //Format: + //:<url>,<left|right|center>,<width>,<caption> + String[] splitter = s.split(Pattern.quote(",")); + StringBuilder captionText = new StringBuilder(splitter[3]); + for (int j=4;j<splitter.length;j++) { + captionText.append(",").append(splitter[j]); } - s="<div><figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\"><img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\"><figcaption>"+captionText.toString()+"</figcaption></figure></div>"; - } else { - //It"s regular content, so add paragraphs. - s="<p class=\""+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"\">"+s+"</p>"; + s="<div><figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\"><img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\"><figcaption>"+captionText.toString()+"</figcaption></figure></div>"; + } else { + //It's regular content, so add paragraphs. + s="<p class=\"color"+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"\">"+s+"</p>"; } } else if (s.length()==0&&isArticleFile(f)) { - s="<br/>"; //Setup a line break here. + s="<br/>"; //Setup a line break here. } for (String key : map.keySet()) { s=s.replaceAll(Pattern.quote(key),map.get(key)); @@ -751,16 +753,16 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } } private static boolean validNumericalConstantCharacters(int lengthOfConstant, int j) { - return storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9"||lengthOfConstant>0&&storedCodeBlock.charAt(j)=="."||lengthOfConstant>0&&storedCodeBlock.charAt(j)>="A"&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<="F"||lengthOfConstant>0&&storedCodeBlock.charAt(j)>="a"&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<="f"||lengthOfConstant>0&&storedCodeBlock.charAt(j)=="x"||lengthOfConstant>0&&storedCodeBlock.charAt(j)=="X"; + return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='.'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='A'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<='F'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='a'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<='f'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='x'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='X'; } private static boolean isAlphanumeric(int j) { - return storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9"||storedCodeBlock.charAt(j)>="A"&&storedCodeBlock.charAt(j)<="Z"||storedCodeBlock.charAt(j)>="a"&&storedCodeBlock.charAt(j)<="z"; + return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'; } - /** - * Writes a span tag with the included class. - * **/ + /** + * Writes a span tag with the included class. + * **/ private static String SPAN(String className) { - return "<span class=\""+className+"\">"; + return "<span class=\""+className+"\">"; } private static void GenerateArticleFiles(Iterator<Path> items){ System.out.println(" Generating article files..."); @@ -783,7 +785,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid for (String k : sigPlace.map.keySet()) { d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); } - d=d.replaceFirst("div class=\"content\"","div class=\"expandedContent\""); + d=d.replaceFirst("div class=\"content\"","div class=\"expandedContent\""); d=d.replaceFirst("%CONDITIONAL_EXPAND%",""); sb.append(d).append("\n"); } @@ -822,122 +824,122 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid content.add(i+j, newData.get(j)); } String lastline=content.get(i+newData.size()-1); - lastline=lastline.replace("%CONDITIONAL_EXPAND%","<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand(this,""+Paths.get(OUTDIR,article.toString())+"")\"><br/><br/><br/><br/>⤈ Click to expand.</div>"); - content.set(i+newData.size()-1,lastline);//<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\"><br/><br/><br/><br/>x2908; Click to expand.</div>"); - } else { - content.set(i,""); + lastline=lastline.replace("%CONDITIONAL_EXPAND%","<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand(this,'"+Paths.get(OUTDIR,article.toString())+"')\"><br/><br/><br/><br/>⤈ Click to expand.</div>"); + content.set(i+newData.size()-1,lastline);//<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\"><br/><br/><br/><br/>⤈ Click to expand.</div>"); + } else { + content.set(i,""); } - if (!articleJavascriptIncluded) { - List<String> articlejs = Files.readAllLines(Paths.get(REFDIR,"article.")); - for (int j=articlejs.size()-1;j>=0;j--) { - content.add(i,articlejs.get(j)); + if (!articleJavascriptIncluded) { + List<String> articlejs = Files.readAllLines(Paths.get(REFDIR,"article.js")); + for (int j=articlejs.size()-1;j>=0;j--) { + content.add(i,articlejs.get(j)); } - articleJavascriptIncluded=true; + articleJavascriptIncluded=true; } } } - Files.write(f,content); - } catch (IOException e) { - e.printStackTrace(); + Files.write(f,content); + } catch (IOException e) { + e.printStackTrace(); } } } } - static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) - throws IOException { - Files.walk(Paths.get(sourceDirectoryLocation)) - .forEach(source -> { - Path destination = Paths.get(destinationDirectoryLocation, source.toString() - .substring(sourceDirectoryLocation.length())); - try { - if (Files.isDirectory(destination)) { - Files.createDirectories(destination); - } else { - Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING}); + static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) + throws IOException { + Files.walk(Paths.get(sourceDirectoryLocation)) + .forEach(source -> { + Path destination = Paths.get(destinationDirectoryLocation, source.toString() + .substring(sourceDirectoryLocation.length())); + try { + if (Files.isDirectory(destination)) { + Files.createDirectories(destination); + } else { + Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING}); } - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } }); } - static void buildDirectoryListings() - throws IOException { - String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString(); - HashMap<String,List<Path>> map = new HashMap<>(); - Iterator<Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator(); - map.put("/",new ArrayList<Path>()); - while (it.hasNext()) { - Path f = it.next(); - if (!f.getFileName().toString().equals(OUTDIR)) { - String myKey = f.toAbsolutePath().toString().replace(startingPath,"").replace(f.getFileName().toString(),""); - //System.out.println(myKey+","+f); - map.putIfAbsent(myKey,new ArrayList<Path>()); - map.get(myKey).add(f); + static void buildDirectoryListings() + throws IOException { + String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString(); + HashMap<String,List<Path>> map = new HashMap<>(); + Iterator<Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator(); + map.put("/",new ArrayList<Path>()); + while (it.hasNext()) { + Path f = it.next(); + if (!f.getFileName().toString().equals(OUTDIR)) { + String myKey = f.toAbsolutePath().toString().replace(startingPath,"").replace(f.getFileName().toString(),""); + //System.out.println(myKey+","+f); + map.putIfAbsent(myKey,new ArrayList<Path>()); + map.get(myKey).add(f); } } - System.out.println("Directory structure determined:"); - System.out.println(" "+map); - for (String key : map.keySet()) { - System.out.println("Creating directory listing for "+key+"..."); - StringBuilder sb = new StringBuilder(""); - List<String> data = Files.readAllLines(ops.get("%")); - List<String> data2 = Files.readAllLines(ops.get("%")); - for (String d : data) { - for (String k : sigPlace.map.keySet()) { - d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); + System.out.println("Directory structure determined:"); + System.out.println(" "+map); + for (String key : map.keySet()) { + System.out.println("Creating directory listing for "+key+"..."); + StringBuilder sb = new StringBuilder(""); + List<String> data = Files.readAllLines(ops.get("%DEFAULT")); + List<String> data2 = Files.readAllLines(ops.get("%FOOTER")); + for (String d : data) { + for (String k : sigPlace.map.keySet()) { + d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); } - sb.append(d).append("\"); + sb.append(d).append("\n"); } - sb.append("<h2>Directory Listing for "+key+"</h2>"); - sb.append("<div class=\"folderlisting\"><a href=\"") + sb.append("<h2>Directory Listing for "+key+"</h2>"); + sb.append("<div class=\"folderlisting\"><a href=\"") .append(key) - .append("..\" class=\"icon\">x1F4C1;</a><a href=\"") + .append("..\" class=\"icon\">📁</a><a href=\"") .append(key) - .append("..\">.. </a><a href=\"") + .append("..\">.. </a><a href=\"") .append(key) - .append("..\" class=\"nounderline\">(Previous Directory)</a></div>"); - for (Path f : map.get(key)) { - sb.append("<div class=\"").append((Files.isDirectory(f)?"folderlisting":"filelisting")).append("\">") - .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\" class=\"icon\">") - .append((Files.isDirectory(f)?"x1F4C1;":"x1F5CE;")) - .append("</a>") - .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\">") - .append(f.getFileName()) - .append("</a>\") - .append(Files.getLastModifiedTime(f)) - .append("\") - .append(Files.getOwner(f)) - .append("\") - .append(Files.size(f)) - .append("</div>\"); + .append("..\" class=\"nounderline\">(Previous Directory)</a></div>"); + for (Path f : map.get(key)) { + sb.append("<div class=\"").append((Files.isDirectory(f)?"folderlisting":"filelisting")).append("\">") + .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\" class=\"icon\">") + .append((Files.isDirectory(f)?"📁":"🗎")) + .append("</a>") + .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\">") + .append(f.getFileName()) + .append("</a>\t") + .append(Files.getLastModifiedTime(f)) + .append("\t") + .append(Files.getOwner(f)) + .append("\t") + .append(Files.size(f)) + .append("</div>\n"); } - for (String d : data2) { - for (String k : sigPlace.map.keySet()) { - d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); + for (String d : data2) { + for (String k : sigPlace.map.keySet()) { + d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); } - sb.append(d).append("\"); + sb.append(d).append("\n"); } - Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes()); - System.out.println(" Added info for ("+map.size()+") files to "+newf.toAbsolutePath()); + Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes()); + System.out.println(" Added info for ("+map.size()+") files to "+newf.toAbsolutePath()); } } - private static boolean isArticleFile(Path f) { - return f.getFileName().toString().contains("."); + private static boolean isArticleFile(Path f) { + return f.getFileName().toString().contains(".article"); } - private static boolean isHTMLFile(Path f) { - return f.getFileName().toString().contains("."); + private static boolean isHTMLFile(Path f) { + return f.getFileName().toString().contains(".html"); } - private static void ExportCodeFile() { - try { - Path file = Paths.get("sigServer."); - List<String> data = Files.readAllLines(file); - int i=0; - while (!data.get(i++).contains("sigServer()")&&i<data.size()); - if (i<data.size()) { - Files.write(Paths.get(OUTDIR,""),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + private static void ExportCodeFile() { + try { + Path file = Paths.get("sigServer.java"); + List<String> data = Files.readAllLines(file); + int i=0; + while (!data.get(i++).contains("sigServer()")&&i<data.size()); + if (i<data.size()) { + Files.write(Paths.get(OUTDIR,"codeBackground"),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); } - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } } diff --git a/out/articles/sigplace1.article.html b/out/articles/sigplace1.article.html index 63a6fa5..5e437bc 100644 --- a/out/articles/sigplace1.article.html +++ b/out/articles/sigplace1.article.html @@ -70,7 +70,6 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid
-
@@ -79,7 +78,8 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid -
+ +
@@ -533,24 +533,26 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid import java.util.Map; import java.util.regex.Pattern; public class sigPlace { - final static String ROOTDIR = "sitefiles"; - final static String REFDIR = "ref"; - final static String OUTDIR = "out"; - final static String ARTICLESDIR = "articles"; - final static String UPLOADSDIR = "uploads"; - final static String COMMENTSDIR = "comments"; - final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING"; - static int PORT = 8080; - static double COLOR_ROTATION = 0; + /* 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; + */ + static double COLOR_ROTATION = 0; static boolean inCodeBlock = false; static String storedCodeBlock = ""; final static HashMap<String,String> map = new HashMap<>(Map.ofEntries( new AbstractMap.SimpleEntry<>("$SITENAME", "SigPlace"), new AbstractMap.SimpleEntry<>("$SITE_BACKCOL", "#111"), - new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_START", "<div class=\"contentWrapper\"><h1>"), - new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_END", "</h1><div class=\"content\" %ID%>"), + new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_START", "<div class=\"contentWrapper\"><h1>"), + new AbstractMap.SimpleEntry<>("$TITLE_CONTENT_END", "</h1><div class=\"content\" %ID%>"), new AbstractMap.SimpleEntry<>("$CONTENT_END", "</div>"), - new AbstractMap.SimpleEntry<>("$DATE_CONTENT_START", "<div class=\"datebar\"></div><div class=\"date\">") + new AbstractMap.SimpleEntry<>("$DATE_CONTENT_START", "<div class=\"datebar\"></div><div class=\"date\">") )); final static HashMap<String,Path> ops = new HashMap<>(Map.ofEntries( new AbstractMap.SimpleEntry<>( @@ -569,7 +571,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid PORT=Integer.parseInt(arg2); System.out.println("Port set to "+PORT+"."); } else { - System.err.println("Invalid argument \""+arg1+"\"."); + System.err.println("Invalid argument \""+arg1+"\"."); return; } } @@ -616,11 +618,11 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid System.out.println(" Parsing "+f.getFileName()); for (int i=0;i<content.size();i++) { String s = content.get(i); - //System.out.println(s); + //System.out.println(s); if (s.length()>0&&(isHTMLFile(f)||isArticleFile(f))) { if (!inCodeBlock) { if (s.contains("<pre>")) { - //System.out.println("Inside <pre>"); + //System.out.println("Inside <pre>"); inCodeBlock=true; storedCodeBlock=""; s=s.substring(0,s.indexOf("<pre>")); @@ -641,12 +643,12 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid String endText=s.substring(s.indexOf("</pre>")+"</pre>".length(),s.length()); s=""; for (int j=0;j<storedCodeBlock.length();j++) { - if (storedCodeBlock.charAt(j)==""") { + if (storedCodeBlock.charAt(j)=='"') { inString=!inString; if (inString) { - s+=SPAN("string")+"\""; - } else { - s+="\"</span>"; + s+=SPAN("string")+"\""; + } else { + s+="\"</span>"; startPos=j+1; } } else @@ -657,13 +659,13 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(lengthOfConstant, j))) { s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); - //System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)); + //System.out.println("Setting "+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)); lengthOfConstant=0; canBeNumericalConstant=false; startPos=j+1; } else - if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)==".") { - //Previous section was a member. + if (!canBeNumericalConstant&&storedCodeBlock.charAt(j)=='.') { + //Previous section was a member. s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else @@ -675,23 +677,23 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+"</span>"; startPos=j+1; } else - if (storedCodeBlock.charAt(j)=="(") { + if (storedCodeBlock.charAt(j)=='(') { s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else - if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==" "&&storedCodeBlock.charAt(j-1)!=" ") { - //Previous section was a keyword. + if (j>0&&isAlphanumeric(j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') { + //Previous section was a keyword. keyword=true; s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else - if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==";"||storedCodeBlock.charAt(j)==":")) { - //Previous section was a keyword. - //keyword=true; + if (j>0&&isAlphanumeric(j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) { + //Previous section was a keyword. + //keyword=true; s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; } else - if (keyword&&!(storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9"||storedCodeBlock.charAt(j)>="A"&&storedCodeBlock.charAt(j)<="Z"||storedCodeBlock.charAt(j)>="a"&&storedCodeBlock.charAt(j)<="z"||storedCodeBlock.charAt(j)==" ")) { + if (keyword&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) { keyword=false; s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+"</span>"+storedCodeBlock.charAt(j); startPos=j+1; @@ -708,7 +710,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid s+=storedCodeBlock.charAt(j); startPos=j+1; } - if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9")) { + if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) { canBeNumericalConstant=false; } if (!canBeNumericalConstant&&!isAlphanumeric(j)) { @@ -718,7 +720,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } } s+=endText; - //System.out.println("Stored code block: "+storedCodeBlock); + //System.out.println("Stored code block: "+storedCodeBlock); } else if (inCodeBlock) { storedCodeBlock+=s+"\n"; @@ -726,33 +728,33 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } } if (s.length()>0&&isArticleFile(f)) { - //Check for markdown pieces. - if (s.charAt(0)=="-") { - //Start of a title piece. + //Check for markdown pieces. + if (s.charAt(0)=='-') { + //Start of a title piece. s=s.replace("-",map.get("$TITLE_CONTENT_START")); - s=s+map.get("$TITLE_CONTENT_END").replace("%ID%","id=\"content_"+f+"\""); - //Use ⤈ if "s more text to be shown than can fit. + s=s+map.get("$TITLE_CONTENT_END").replace("%ID%","id=\"content_"+f+"\""); + //Use ⤈ if there's more text to be shown than can fit. } else - if (s.contains("===")) { - s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END"); - } else - if (s.charAt(0)==":") { - //Image with caption. - //Format: - //:<url>,<left|right|center>,<width>,<caption> - String[] splitter = s.split(Pattern.quote(",")); - StringBuilder captionText = new StringBuilder(splitter[3]); - for (int j=4;j<splitter.length;j++) { - captionText.append(",").append(splitter[j]); + if (s.contains("===")) { + s=map.get("$CONTENT_END")+map.get("$DATE_CONTENT_START")+s.replace("===","")+map.get("$CONTENT_END")+"%CONDITIONAL_EXPAND%"+map.get("$CONTENT_END"); + } else + if (s.charAt(0)==':') { + //Image with caption. + //Format: + //:<url>,<left|right|center>,<width>,<caption> + String[] splitter = s.split(Pattern.quote(",")); + StringBuilder captionText = new StringBuilder(splitter[3]); + for (int j=4;j<splitter.length;j++) { + captionText.append(",").append(splitter[j]); } - s="<div><figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\"><img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\"><figcaption>"+captionText.toString()+"</figcaption></figure></div>"; - } else { - //It"s regular content, so add paragraphs. - s="<p class=\""+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"\">"+s+"</p>"; + s="<div><figure style=\"text-align:center;"+((splitter[1].equals("left")||splitter[1].equals("right"))?"width:"+splitter[2]+"%;float:"+splitter[1]+";":"")+"\"><img src=\"/"+splitter[0].substring(1)+"\" style=\"margin:auto;width:100%;\"><figcaption>"+captionText.toString()+"</figcaption></figure></div>"; + } else { + //It's regular content, so add paragraphs. + s="<p class=\"color"+(((int)(COLOR_ROTATION=(COLOR_ROTATION+0.4)%6))+1)+"\">"+s+"</p>"; } } else if (s.length()==0&&isArticleFile(f)) { - s="<br/>"; //Setup a line break here. + s="<br/>"; //Setup a line break here. } for (String key : map.keySet()) { s=s.replaceAll(Pattern.quote(key),map.get(key)); @@ -770,16 +772,16 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid } } private static boolean validNumericalConstantCharacters(int lengthOfConstant, int j) { - return storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9"||lengthOfConstant>0&&storedCodeBlock.charAt(j)=="."||lengthOfConstant>0&&storedCodeBlock.charAt(j)>="A"&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<="F"||lengthOfConstant>0&&storedCodeBlock.charAt(j)>="a"&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<="f"||lengthOfConstant>0&&storedCodeBlock.charAt(j)=="x"||lengthOfConstant>0&&storedCodeBlock.charAt(j)=="X"; + return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='.'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='A'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<='F'||lengthOfConstant>0&&storedCodeBlock.charAt(j)>='a'&&lengthOfConstant>0&&storedCodeBlock.charAt(j)<='f'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='x'||lengthOfConstant>0&&storedCodeBlock.charAt(j)=='X'; } private static boolean isAlphanumeric(int j) { - return storedCodeBlock.charAt(j)>="0"&&storedCodeBlock.charAt(j)<="9"||storedCodeBlock.charAt(j)>="A"&&storedCodeBlock.charAt(j)<="Z"||storedCodeBlock.charAt(j)>="a"&&storedCodeBlock.charAt(j)<="z"; + return storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'; } - /** - * Writes a span tag with the included class. - * **/ + /** + * Writes a span tag with the included class. + * **/ private static String SPAN(String className) { - return "<span class=\""+className+"\">"; + return "<span class=\""+className+"\">"; } private static void GenerateArticleFiles(Iterator<Path> items){ System.out.println(" Generating article files..."); @@ -802,7 +804,7 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid for (String k : sigPlace.map.keySet()) { d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); } - d=d.replaceFirst("div class=\"content\"","div class=\"expandedContent\""); + d=d.replaceFirst("div class=\"content\"","div class=\"expandedContent\""); d=d.replaceFirst("%CONDITIONAL_EXPAND%",""); sb.append(d).append("\n"); } @@ -841,122 +843,122 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid content.add(i+j, newData.get(j)); } String lastline=content.get(i+newData.size()-1); - lastline=lastline.replace("%CONDITIONAL_EXPAND%","<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand(this,""+Paths.get(OUTDIR,article.toString())+"")\"><br/><br/><br/><br/>⤈ Click to expand.</div>"); - content.set(i+newData.size()-1,lastline);//<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\"><br/><br/><br/><br/>x2908; Click to expand.</div>"); - } else { - content.set(i,""); + lastline=lastline.replace("%CONDITIONAL_EXPAND%","<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand(this,'"+Paths.get(OUTDIR,article.toString())+"')\"><br/><br/><br/><br/>⤈ Click to expand.</div>"); + content.set(i+newData.size()-1,lastline);//<div class=\"unexpanded\" id=\"expand_"+i+"\" onClick=\"expand("+i+")\"><br/><br/><br/><br/>⤈ Click to expand.</div>"); + } else { + content.set(i,""); } - if (!articleJavascriptIncluded) { - List<String> articlejs = Files.readAllLines(Paths.get(REFDIR,"article.")); - for (int j=articlejs.size()-1;j>=0;j--) { - content.add(i,articlejs.get(j)); + if (!articleJavascriptIncluded) { + List<String> articlejs = Files.readAllLines(Paths.get(REFDIR,"article.js")); + for (int j=articlejs.size()-1;j>=0;j--) { + content.add(i,articlejs.get(j)); } - articleJavascriptIncluded=true; + articleJavascriptIncluded=true; } } } - Files.write(f,content); - } catch (IOException e) { - e.printStackTrace(); + Files.write(f,content); + } catch (IOException e) { + e.printStackTrace(); } } } } - static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) - throws IOException { - Files.walk(Paths.get(sourceDirectoryLocation)) - .forEach(source -> { - Path destination = Paths.get(destinationDirectoryLocation, source.toString() - .substring(sourceDirectoryLocation.length())); - try { - if (Files.isDirectory(destination)) { - Files.createDirectories(destination); - } else { - Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING}); + static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) + throws IOException { + Files.walk(Paths.get(sourceDirectoryLocation)) + .forEach(source -> { + Path destination = Paths.get(destinationDirectoryLocation, source.toString() + .substring(sourceDirectoryLocation.length())); + try { + if (Files.isDirectory(destination)) { + Files.createDirectories(destination); + } else { + Files.copy(source, destination, new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES,StandardCopyOption.REPLACE_EXISTING}); } - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } }); } - static void buildDirectoryListings() - throws IOException { - String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString(); - HashMap<String,List<Path>> map = new HashMap<>(); - Iterator<Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator(); - map.put("/",new ArrayList<Path>()); - while (it.hasNext()) { - Path f = it.next(); - if (!f.getFileName().toString().equals(OUTDIR)) { - String myKey = f.toAbsolutePath().toString().replace(startingPath,"").replace(f.getFileName().toString(),""); - //System.out.println(myKey+","+f); - map.putIfAbsent(myKey,new ArrayList<Path>()); - map.get(myKey).add(f); + static void buildDirectoryListings() + throws IOException { + String startingPath=Paths.get(sigPlace.OUTDIR).toAbsolutePath().toString(); + HashMap<String,List<Path>> map = new HashMap<>(); + Iterator<Path> it = Files.walk(Paths.get(sigPlace.OUTDIR)).iterator(); + map.put("/",new ArrayList<Path>()); + while (it.hasNext()) { + Path f = it.next(); + if (!f.getFileName().toString().equals(OUTDIR)) { + String myKey = f.toAbsolutePath().toString().replace(startingPath,"").replace(f.getFileName().toString(),""); + //System.out.println(myKey+","+f); + map.putIfAbsent(myKey,new ArrayList<Path>()); + map.get(myKey).add(f); } } - System.out.println("Directory structure determined:"); - System.out.println(" "+map); - for (String key : map.keySet()) { - System.out.println("Creating directory listing for "+key+"..."); - StringBuilder sb = new StringBuilder(""); - List<String> data = Files.readAllLines(ops.get("%")); - List<String> data2 = Files.readAllLines(ops.get("%")); - for (String d : data) { - for (String k : sigPlace.map.keySet()) { - d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); + System.out.println("Directory structure determined:"); + System.out.println(" "+map); + for (String key : map.keySet()) { + System.out.println("Creating directory listing for "+key+"..."); + StringBuilder sb = new StringBuilder(""); + List<String> data = Files.readAllLines(ops.get("%DEFAULT")); + List<String> data2 = Files.readAllLines(ops.get("%FOOTER")); + for (String d : data) { + for (String k : sigPlace.map.keySet()) { + d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); } - sb.append(d).append("\"); + sb.append(d).append("\n"); } - sb.append("<h2>Directory Listing for "+key+"</h2>"); - sb.append("<div class=\"folderlisting\"><a href=\"") + sb.append("<h2>Directory Listing for "+key+"</h2>"); + sb.append("<div class=\"folderlisting\"><a href=\"") .append(key) - .append("..\" class=\"icon\">x1F4C1;</a><a href=\"") + .append("..\" class=\"icon\">📁</a><a href=\"") .append(key) - .append("..\">.. </a><a href=\"") + .append("..\">.. </a><a href=\"") .append(key) - .append("..\" class=\"nounderline\">(Previous Directory)</a></div>"); - for (Path f : map.get(key)) { - sb.append("<div class=\"").append((Files.isDirectory(f)?"folderlisting":"filelisting")).append("\">") - .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\" class=\"icon\">") - .append((Files.isDirectory(f)?"x1F4C1;":"x1F5CE;")) - .append("</a>") - .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\">") - .append(f.getFileName()) - .append("</a>\") - .append(Files.getLastModifiedTime(f)) - .append("\") - .append(Files.getOwner(f)) - .append("\") - .append(Files.size(f)) - .append("</div>\"); + .append("..\" class=\"nounderline\">(Previous Directory)</a></div>"); + for (Path f : map.get(key)) { + sb.append("<div class=\"").append((Files.isDirectory(f)?"folderlisting":"filelisting")).append("\">") + .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\" class=\"icon\">") + .append((Files.isDirectory(f)?"📁":"🗎")) + .append("</a>") + .append("<a href=\""+(f.toAbsolutePath().toString().replace(Paths.get(OUTDIR).toAbsolutePath().toString(),""))+"\">") + .append(f.getFileName()) + .append("</a>\t") + .append(Files.getLastModifiedTime(f)) + .append("\t") + .append(Files.getOwner(f)) + .append("\t") + .append(Files.size(f)) + .append("</div>\n"); } - for (String d : data2) { - for (String k : sigPlace.map.keySet()) { - d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); + for (String d : data2) { + for (String k : sigPlace.map.keySet()) { + d=d.replaceAll(Pattern.quote(k),sigPlace.map.get(k)); } - sb.append(d).append("\"); + sb.append(d).append("\n"); } - Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes()); - System.out.println(" Added info for ("+map.size()+") files to "+newf.toAbsolutePath()); + Path newf = Files.write(Paths.get(OUTDIR,key,DIRECTORYLISTING_FILENAME),sb.toString().getBytes()); + System.out.println(" Added info for ("+map.size()+") files to "+newf.toAbsolutePath()); } } - private static boolean isArticleFile(Path f) { - return f.getFileName().toString().contains("."); + private static boolean isArticleFile(Path f) { + return f.getFileName().toString().contains(".article"); } - private static boolean isHTMLFile(Path f) { - return f.getFileName().toString().contains("."); + private static boolean isHTMLFile(Path f) { + return f.getFileName().toString().contains(".html"); } - private static void ExportCodeFile() { - try { - Path file = Paths.get("sigServer."); - List<String> data = Files.readAllLines(file); - int i=0; - while (!data.get(i++).contains("sigServer()")&&i<data.size()); - if (i<data.size()) { - Files.write(Paths.get(OUTDIR,""),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + private static void ExportCodeFile() { + try { + Path file = Paths.get("sigServer.java"); + List<String> data = Files.readAllLines(file); + int i=0; + while (!data.get(i++).contains("sigServer()")&&i<data.size()); + if (i<data.size()) { + Files.write(Paths.get(OUTDIR,"codeBackground"),data.subList(i, Math.min(i+40,data.size())),Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); } - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } } diff --git a/out/articles/test articles/DIRECTORY_LISTING b/out/articles/test articles/DIRECTORY_LISTING index 4e27e2a..a772710 100644 --- a/out/articles/test articles/DIRECTORY_LISTING +++ b/out/articles/test articles/DIRECTORY_LISTING @@ -17,12 +17,12 @@
Directory Listing for /articles/test articles/
Directory Listing for /articles/test articles/
A Test Title
+
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.
A Test Title
+
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.
Another test title
+
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.
Another test title
+
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.