diff --git a/comments/sigplace1.comment b/comments/sigplace1.comment index 9f2cf18..acede71 100644 --- a/comments/sigplace1.comment +++ b/comments/sigplace1.comment @@ -1,4 +1,4 @@ -39 +57 That is a great idea! username,17May2021 08:29:10;GREEN That is a great idea! <p>There used to be folks I worked with who would use the same technique, and it worked great!</p> @@ -77,3 +77,39 @@ fdsa2022-07-28T19:25:51.209453Z[Etc/UTC];GREEN 2022-07-28T20:08:50.191504Z[Etc/UTC];GREEN
Code block now works! 2022-07-28T20:13:09.268431Z[Etc/UTC];GREEN +Very%20nice%2C%20thanks%20for%20sharing! +Sig2022-08-01T16:02:59.075004Z[Etc/UTC];GREEN +testest +test2022-08-01T16:05:35.718759Z[Etc/UTC];GREEN +fdasvdsavd +dvsavda2022-08-01T16:05:46.192305Z[Etc/UTC];GREEN +dasvavdsvsda +ewqfewqfeqw2022-08-01T16:05:49.832914Z[Etc/UTC];GREEN + +2022-08-01T16:05:56.667292Z[Etc/UTC];GREEN +we%20broke%20it +dvsa2022-08-01T16:06:11.783876Z[Etc/UTC];GREEN +%20%20%20%20 +2022-08-01T16:08:10.957080Z[Etc/UTC];GREEN + +2022-08-01T16:08:13.443427Z[Etc/UTC];GREEN +fdsavdsavds +dfsafdsa2022-08-01T16:08:18.820345Z[Etc/UTC];GREEN + +2022-08-01T16:08:24.546240Z[Etc/UTC];GREEN +fdsa +2022-08-01T16:08:28.154518Z[Etc/UTC];GREEN +Cool stuff man +2022-08-01T16:08:43.853845Z[Etc/UTC];GREEN +Bold%20Text +vdsavdsa2022-08-01T16:11:13.185418Z[Etc/UTC];GREEN +//Code goes here. +vdsavdsav2022-08-01T16:11:23.726618Z[Etc/UTC];GREEN +Italic%20Text +vdsavdsavdsa2022-08-01T16:11:29.316553Z[Etc/UTC];GREEN +dvaavsdvdasv +2022-08-01T16:11:33.383089Z[Etc/UTC];GREEN +http%3A%2F%2Flink.%F0%9F%98%8Acom +2022-08-01T16:11:42.223754Z[Etc/UTC];GREEN +//Code go😔es here. +2022-08-01T16:11:57.246254Z[Etc/UTC];GREEN diff --git a/out/DIRECTORY_LISTING b/out/DIRECTORY_LISTING index f366dfb..a10dd1c 100644 --- a/out/DIRECTORY_LISTING +++ b/out/DIRECTORY_LISTING @@ -17,15 +17,15 @@-diff --git a/out/articles/DIRECTORY_LISTING b/out/articles/DIRECTORY_LISTING index 1c2c0c1..fea6942 100644 --- a/out/articles/DIRECTORY_LISTING +++ b/out/articles/DIRECTORY_LISTING @@ -17,13 +17,13 @@Directory Listing for /
- -🗎codeBackground 2022-08-01T15:59:35.214694Z gitpod 2635-🗎otherpage.html 2022-08-01T15:59:35.258694Z gitpod 88370- -🗎testfile.html 2022-08-01T15:59:35.262694Z gitpod 1627-🗎uploadform.html 2022-08-01T15:59:35.262694Z gitpod 1707- -🗎error.html 2022-08-01T15:59:35.262694Z gitpod 1672+Directory Listing for /
+ +🗎codeBackground 2022-08-01T16:11:07.174073Z gitpod 2635+🗎otherpage.html 2022-08-01T16:11:07.230073Z gitpod 88370+ +🗎testfile.html 2022-08-01T16:11:07.230073Z gitpod 1627+🗎uploadform.html 2022-08-01T16:11:07.230073Z gitpod 1707+ +🗎error.html 2022-08-01T16:11:07.230073Z gitpod 1672-diff --git a/out/articles/Love Live! Custom Arcade Controller.article.html b/out/articles/Love Live! Custom Arcade Controller.article.html index cb830e1..48ab7ce 100644 --- a/out/articles/Love Live! Custom Arcade Controller.article.html +++ b/out/articles/Love Live! Custom Arcade Controller.article.html @@ -74,11 +74,32 @@ For over a year since I first got into Love Live! School Idol Festival ~after document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/out/articles/curabitur vel tempus ex.article.html b/out/articles/curabitur vel tempus ex.article.html index da7f984..bd0d65c 100644 --- a/out/articles/curabitur vel tempus ex.article.html +++ b/out/articles/curabitur vel tempus ex.article.html @@ -78,11 +78,32 @@ Curabitur vel tempus ex. Duis cursus sapien nisl, ut pulvinar dui porttitor ut. document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/out/articles/sigplace1.article.html b/out/articles/sigplace1.article.html index 856e9f7..473655a 100644 --- a/out/articles/sigplace1.article.html +++ b/out/articles/sigplace1.article.html @@ -553,11 +553,32 @@ Here we demonstrate the love live logo. But wait, it's literally like in the mid document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/out/articles/test articles/DIRECTORY_LISTING b/out/articles/test articles/DIRECTORY_LISTING index aab4e92..dd5f6da 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 2022-08-01T15:59:35.278694Z gitpod 147-🗎Love Live! Custom Arcade Controller.article 2022-08-01T15:59:34.742695Z gitpod 497-🗎curabitur vel tempus ex.article 2022-08-01T15:59:34.770695Z gitpod 730-🗎sigplace1.article 2022-08-01T15:59:35.210694Z gitpod 80858-🗎Love Live! Custom Arcade Controller.article.html 2022-08-01T15:59:35.278694Z gitpod 8626-🗎curabitur vel tempus ex.article.html 2022-08-01T15:59:35.306694Z gitpod 8835-🗎sigplace1.article.html 2022-08-01T15:59:35.318694Z gitpod 88935+Directory Listing for /articles/
📁test articles 2022-08-01T16:11:07.306073Z gitpod 147+🗎Love Live! Custom Arcade Controller.article 2022-08-01T16:11:06.110074Z gitpod 497+🗎curabitur vel tempus ex.article 2022-08-01T16:11:06.218074Z gitpod 730+🗎sigplace1.article 2022-08-01T16:11:07.170073Z gitpod 80858+🗎Love Live! Custom Arcade Controller.article.html 2022-08-01T16:11:07.310073Z gitpod 9152+🗎curabitur vel tempus ex.article.html 2022-08-01T16:11:07.322073Z gitpod 9361+🗎sigplace1.article.html 2022-08-01T16:11:07.402073Z gitpod 89461-diff --git a/out/articles/test articles/test1.article.html b/out/articles/test articles/test1.article.html index 57f387f..faec2e8 100644 --- a/out/articles/test articles/test1.article.html +++ b/out/articles/test articles/test1.article.html @@ -72,11 +72,32 @@ document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/out/articles/test articles/test2.article.html b/out/articles/test articles/test2.article.html index 90ae303..06424b8 100644 --- a/out/articles/test articles/test2.article.html +++ b/out/articles/test articles/test2.article.html @@ -72,11 +72,32 @@ document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/out/articles/test articles/test3.article.html b/out/articles/test articles/test3.article.html index ec79795..db046d2 100644 --- a/out/articles/test articles/test3.article.html +++ b/out/articles/test articles/test3.article.html @@ -72,11 +72,32 @@ document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/out/codeBackground b/out/codeBackground index c5a43b9..9e16ede 100644 --- a/out/codeBackground +++ b/out/codeBackground @@ -12,7 +12,6 @@ String filename=null; OutputStream stream = null; requestLine=in.readLine(); //Read the first line, this should be our request. - System.out.println(requestLine); if (requestLine!=null) { String[] splitter = requestLine.split(Pattern.quote(" ")); boolean ISPOST = splitter[0].equals("POST"); @@ -38,3 +37,4 @@ System.out.println(line); } } else { + File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename); diff --git a/ref/COMMENT.html b/ref/COMMENT.html index a31b198..9027539 100644 --- a/ref/COMMENT.html +++ b/ref/COMMENT.html @@ -28,11 +28,32 @@ document.getElementById("msg").disabled=false; }) } + function bonus(str) { + switch (str) { + case "^^":{ + return "Bold Text" + }break; + case "**":{ + return "Italic Text" + }break; + case "__":{ + return "Underlined Text" + }break; + case "~~":{ + return "//Code goes here." + }break; + case "[[":{ + return "http://link.com" + }break; + } + } function insert(c1,c2) { if (document.getElementById("msg").selectionStart==document.getElementById("msg").selectionEnd) { //No highlighting. Insert here. if (c2!=undefined) { - document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) + document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+ + bonus(c1)+ + c2+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } else { document.getElementById("msg").value=document.getElementById("msg").value.substring(0,document.getElementById("msg").selectionStart)+c1+document.getElementById("msg").value.substring(document.getElementById("msg").selectionStart) } diff --git a/sigServer.java b/sigServer.java index 52986f8..f7da196 100644 --- a/sigServer.java +++ b/sigServer.java @@ -159,215 +159,219 @@ public class sigServer { if (location.equals("COMMENTS")&&requestParams.containsKey("message")&&requestParams.containsKey("name")&&requestParams.containsKey("color")) { //System.out.println(requestParams); String finalMsg = requestParams.get("message").replaceAll(Pattern.quote("%0A"),"Directory Listing for /articles/test articles/
🗎test1.article 2022-08-01T15:59:34.738695Z gitpod 1085-🗎test2.article 2022-08-01T15:59:34.738695Z gitpod 781-🗎test3.article 2022-08-01T15:59:34.742695Z gitpod 994-🗎test1.article.html 2022-08-01T15:59:35.266694Z gitpod 9154-🗎test2.article.html 2022-08-01T15:59:35.274694Z gitpod 8850-🗎test3.article.html 2022-08-01T15:59:35.278694Z gitpod 9063+Directory Listing for /articles/test articles/
🗎test1.article 2022-08-01T16:11:06.050074Z gitpod 1085+🗎test2.article 2022-08-01T16:11:06.102074Z gitpod 781+🗎test3.article 2022-08-01T16:11:06.106074Z gitpod 994+🗎test1.article.html 2022-08-01T16:11:07.234073Z gitpod 9680+🗎test2.article.html 2022-08-01T16:11:07.302073Z gitpod 9376+🗎test3.article.html 2022-08-01T16:11:07.306073Z gitpod 9589
").replaceAll(Pattern.quote("%3C"),"<"); - boolean boldBlock=false; - boolean italicBlock=false; - boolean underlineBlock=false; - boolean codeBlock=false; - boolean linkBlock=false; - StringBuilder storedLink=new StringBuilder(); - StringBuilder codeBlockMsg = new StringBuilder(); - StringBuilder buildMsg = new StringBuilder(); - for (int i=0;i"; - int startPos=0; - String endText=s.substring(s.indexOf("~~")+"~~".length(),s.length()); - s=""; - for (int j=0;j "; - } else - if (storedCodeBlock.charAt(j)=='\n'&&inComment) { - inComment=false; - s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+""; - startPos=j+1; - } - if (!inComment&&!inMultiLineComment&&(j>0&&storedCodeBlock.charAt(j-1)!='\\'&&(!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)))) { - inString=!inString; - if (inString) { - stringChar=storedCodeBlock.charAt(j); - s+=SPAN("string")+stringChar; - } else { - s+=stringChar; + if (finalMsg.length()>0) { + boolean boldBlock=false; + boolean italicBlock=false; + boolean underlineBlock=false; + boolean codeBlock=false; + boolean linkBlock=false; + StringBuilder storedLink=new StringBuilder(); + StringBuilder codeBlockMsg = new StringBuilder(); + StringBuilder buildMsg = new StringBuilder(); + for (int i=0;i "; + int startPos=0; + String endText=s.substring(s.indexOf("~~")+"~~".length(),s.length()); + s=""; + for (int j=0;j "; + } else + if (storedCodeBlock.charAt(j)=='\n'&&inComment) { + inComment=false; + s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+""; startPos=j+1; } - } else - if (!inString) { - if (canBeNumericalConstant&&validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j)) { - lengthOfConstant++; - //System.out.println("Length of Constant now "+lengthOfConstant); - } - if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='*'||inMultiLineComment) { - if (!inMultiLineComment) { - inMultiLineComment=true; + if (!inComment&&!inMultiLineComment&&(j>0&&storedCodeBlock.charAt(j-1)!='\\'&&(!inString&&(storedCodeBlock.charAt(j)=='"'||storedCodeBlock.charAt(j)=='\'')||inString&&(storedCodeBlock.charAt(j)==stringChar)))) { + inString=!inString; + if (inString) { + stringChar=storedCodeBlock.charAt(j); + s+=SPAN("string")+stringChar; } else { - if (storedCodeBlock.charAt(j-1)=='*'&&storedCodeBlock.charAt(j)=='/') { - inMultiLineComment=false; - s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+""; - startPos=j+1; - } + s+=stringChar; + s+=""; + startPos=j+1; } - //Stops further execution since we're in a comment. } else - if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='/'||inComment) { - if (!inComment) { - inComment=true; + if (!inString) { + if (canBeNumericalConstant&&validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j)) { + lengthOfConstant++; + //System.out.println("Length of Constant now "+lengthOfConstant); } - //Stops further execution since we're in a comment. - } else - if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j))) { - s+=SPAN("number")+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. - s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); - startPos=j+1; - } else - if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("true")&&!isAlphanumeric(storedCodeBlock,j-4)&&!isAlphanumeric(storedCodeBlock,j+1)) { - s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+""; - startPos=j+1; - } else - if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("false")&&!isAlphanumeric(storedCodeBlock,j-5)&&!isAlphanumeric(storedCodeBlock,j+1)) { - s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+""; - startPos=j+1; - } else - if (storedCodeBlock.charAt(j)=='(') { - s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); - startPos=j+1; - } else - if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') { - //Previous section was a keyword. - keyword=true; - s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); - startPos=j+1; - } else - if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) { - //Previous section was a keyword. - //keyword=true; - s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); - startPos=j+1; - } else - if (keyword&&!(storedCodeBlock.charAt(j)=='_'||storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) { - keyword=false; - s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); - startPos=j+1; - } else - if (!isAlphanumeric(storedCodeBlock,j)){ - if (startPos 0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='*'||inMultiLineComment) { + if (!inMultiLineComment) { + inMultiLineComment=true; + } else { + if (storedCodeBlock.charAt(j-1)=='*'&&storedCodeBlock.charAt(j)=='/') { + inMultiLineComment=false; + s+=SPAN("comment")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+""; + startPos=j+1; + } + } + //Stops further execution since we're in a comment. + } else + if (j>0&&storedCodeBlock.charAt(j)=='/'&&storedCodeBlock.charAt(j+1)=='/'||inComment) { + if (!inComment) { + inComment=true; + } + //Stops further execution since we're in a comment. + } else + if (canBeNumericalConstant&&lengthOfConstant>0&&!(validNumericalConstantCharacters(storedCodeBlock,lengthOfConstant, j))) { + s+=SPAN("number")+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. + s+=SPAN("class")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); + startPos=j+1; + } else + if (j>3&&storedCodeBlock.substring(j-3,j+1).equals("true")&&!isAlphanumeric(storedCodeBlock,j-4)&&!isAlphanumeric(storedCodeBlock,j+1)) { + s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+""; + startPos=j+1; + } else + if (j>4&&storedCodeBlock.substring(j-4,j+1).equals("false")&&!isAlphanumeric(storedCodeBlock,j-5)&&!isAlphanumeric(storedCodeBlock,j+1)) { + s+=SPAN("number")+storedCodeBlock.substring(startPos,j)+storedCodeBlock.charAt(j)+""; + startPos=j+1; + } else + if (storedCodeBlock.charAt(j)=='(') { + s+=SPAN("function")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); + startPos=j+1; + } else + if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && storedCodeBlock.charAt(j)==' '&&storedCodeBlock.charAt(j-1)!=' ') { + //Previous section was a keyword. + keyword=true; + s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); + startPos=j+1; + } else + if (j>0&&isAlphanumeric(storedCodeBlock,j-1) && (storedCodeBlock.charAt(j)==';'||storedCodeBlock.charAt(j)==':')) { + //Previous section was a keyword. + //keyword=true; + s+=SPAN("keyword")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); + startPos=j+1; + } else + if (keyword&&!(storedCodeBlock.charAt(j)=='_'||storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9'||storedCodeBlock.charAt(j)>='A'&&storedCodeBlock.charAt(j)<='Z'||storedCodeBlock.charAt(j)>='a'&&storedCodeBlock.charAt(j)<='z'||storedCodeBlock.charAt(j)==' ')) { + keyword=false; + s+=SPAN("variable")+storedCodeBlock.substring(startPos,j)+""+storedCodeBlock.charAt(j); + startPos=j+1; + } else + if (!isAlphanumeric(storedCodeBlock,j)){ + if (startPos ='0'&&storedCodeBlock.charAt(j)<='9')) { - canBeNumericalConstant=false; + if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) { + canBeNumericalConstant=false; + } + if (!canBeNumericalConstant&&!isAlphanumeric(storedCodeBlock,j)) { + canBeNumericalConstant=true; + lengthOfConstant=0; + //System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric..."); + } } - if (!canBeNumericalConstant&&!isAlphanumeric(storedCodeBlock,j)) { - canBeNumericalConstant=true; - lengthOfConstant=0; - //System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric..."); + for (int j=0;j "); + } else { + buildMsg.append(""); } - s=" "+s; - s+=endText; - buildMsg.append(s); - } else { - codeBlockMsg=codeBlockMsg.delete(0, codeBlockMsg.length()); + boldBlock=!boldBlock; + i+=5; + continue; } - i+=1; - codeBlock=!codeBlock; - continue; - } else - if (codeBlock) { - codeBlockMsg.append(finalMsg.charAt(i));continue; - } - if (foundSub("%5E%5E",finalMsg,i)) { - if (boldBlock) { - buildMsg.append(""); - } else { - buildMsg.append(""); + if (i"); + } else { + buildMsg.append(""); + } + italicBlock=!italicBlock; + i+=1; + continue; } - boldBlock=!boldBlock; - i+=5; - continue; - } - if (i "); - } else { - buildMsg.append(""); + if (i "); + } else { + buildMsg.append(""); + } + underlineBlock=!underlineBlock; + i+=1; + continue; } - italicBlock=!italicBlock; - i+=1; - continue; - } - if (i "); - } else { - buildMsg.append(""); + if (foundSub("%5B%5B",finalMsg,i)||foundSub("%5D%5D",finalMsg,i)) { + if (linkBlock) { + buildMsg.append("\">").append(storedLink).append(""); + } else { + storedLink.delete(0,storedLink.length()); + buildMsg.append("").append(storedLink).append(""); - } else { - storedLink.delete(0,storedLink.length()); - buildMsg.append(" data = Files.readAllLines(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article"))); + data.set(0,Integer.toString(Integer.parseInt(data.get(0))+1)); + data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color")); + Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + } else { + List data = new ArrayList (); + data.add("1"); + data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color")); + Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE,StandardOpenOption.CREATE_NEW); } - buildMsg.append(finalMsg.charAt(i)); - } - if (Files.exists(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")))) { - List data = Files.readAllLines(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article"))); - data.set(0,Integer.toString(Integer.parseInt(data.get(0))+1)); - data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color")); - Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + CreateRequest(client,"200","OK",Paths.get(sigPlace.OUTDIR,"testfile.html")); } else { - List data = new ArrayList (); - data.add("1"); - data.add(buildMsg.toString()+"\n"+requestParams.get("name")+ZonedDateTime.now()+";"+requestParams.get("color")); - Files.write(Paths.get(sigPlace.COMMENTSDIR,requestParams.get("article")), data, StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE,StandardOpenOption.CREATE_NEW); + CreateRequest(client,"304","Not Modified",Paths.get(sigPlace.OUTDIR,"testfile.html")); } - CreateRequest(client,"200","OK",Paths.get(sigPlace.OUTDIR,"testfile.html")); } else { if (modifiedDate==null||Files.exists(file)&&modifiedDate.isBefore(GetLastModifiedDate(file))) { @@ -476,6 +480,7 @@ public class sigServer { if (contentType!=null&&contentType.equals("text/html")) { clientOutput.write((" Webpage generated in "+(System.currentTimeMillis()-startTime)+"ms\r\n").getBytes()); } + System.out.println("Sent "+file+" with status ["+statusCode+"] "+statusMsg); } clientOutput.write("\r\n\r\n".getBytes()); clientOutput.flush();