diff --git a/JavaProjectTemplate.jar b/JavaProjectTemplate.jar new file mode 100644 index 0000000..46a59da Binary files /dev/null and b/JavaProjectTemplate.jar differ diff --git a/bin/ArcadeReader$1.class b/bin/ArcadeReader$1.class new file mode 100644 index 0000000..bac1e40 Binary files /dev/null and b/bin/ArcadeReader$1.class differ diff --git a/bin/ArcadeReader.class b/bin/ArcadeReader.class new file mode 100644 index 0000000..8dbaea3 Binary files /dev/null and b/bin/ArcadeReader.class differ diff --git a/bin/readers/DDRReader.class b/bin/readers/DDRReader.class new file mode 100644 index 0000000..35c712c Binary files /dev/null and b/bin/readers/DDRReader.class differ diff --git a/bin/readers/ITGReader.class b/bin/readers/ITGReader.class new file mode 100644 index 0000000..6849b7e Binary files /dev/null and b/bin/readers/ITGReader.class differ diff --git a/bin/readers/LoveLiveReader.class b/bin/readers/LoveLiveReader.class new file mode 100644 index 0000000..1049d3b Binary files /dev/null and b/bin/readers/LoveLiveReader.class differ diff --git a/bin/readers/SoundVoltexReader.class b/bin/readers/SoundVoltexReader.class new file mode 100644 index 0000000..798d4a7 Binary files /dev/null and b/bin/readers/SoundVoltexReader.class differ diff --git a/bin/readers/TestReader.class b/bin/readers/TestReader.class new file mode 100644 index 0000000..98c63d7 Binary files /dev/null and b/bin/readers/TestReader.class differ diff --git a/bin/sigPlace.class b/bin/sigPlace.class new file mode 100644 index 0000000..6409d82 Binary files /dev/null and b/bin/sigPlace.class differ diff --git a/bin/sigServer.class b/bin/sigServer.class new file mode 100644 index 0000000..99337b0 Binary files /dev/null and b/bin/sigServer.class differ diff --git a/manifest b/manifest new file mode 100644 index 0000000..9e5e701 --- /dev/null +++ b/manifest @@ -0,0 +1 @@ +Main-Class: sigPlace diff --git a/readers/Box.class b/readers/Box.class new file mode 100644 index 0000000..946d240 Binary files /dev/null and b/readers/Box.class differ diff --git a/readers/ColorRange.class b/readers/ColorRange.class new file mode 100644 index 0000000..ea03060 Binary files /dev/null and b/readers/ColorRange.class differ diff --git a/readers/PopnReader.class b/readers/PopnReader.class new file mode 100644 index 0000000..7ff3ecc Binary files /dev/null and b/readers/PopnReader.class differ diff --git a/readers/Reader.class b/readers/Reader.class new file mode 100644 index 0000000..4e578a6 Binary files /dev/null and b/readers/Reader.class differ diff --git a/readers/fonts/Font.class b/readers/fonts/Font.class new file mode 100644 index 0000000..719dddd Binary files /dev/null and b/readers/fonts/Font.class differ diff --git a/readers/fonts/Glyph.class b/readers/fonts/Glyph.class new file mode 100644 index 0000000..0d272bc Binary files /dev/null and b/readers/fonts/Glyph.class differ diff --git a/scripts/jar.sh b/scripts/jar.sh new file mode 100755 index 0000000..0a392e6 --- /dev/null +++ b/scripts/jar.sh @@ -0,0 +1,17 @@ +#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar. +#Java +source ${LANGUAGE}/scripts/version_info +rm -Rf bin/* +javac -d bin *.java +printf "\n\n\nGenerating Manifest...\n\n" +touch manifest +echo "Main-Class: ${MAIN_CLASS}" > manifest +printf "\n\n\nCreating Jar...\n\n" +ORIGINAL_LOC=$(pwd) +cd ${OUT_DIR} +jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest . +jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ . +printf "\n\n\nRunning Program...\n\n" +mv sigPlace.jar .. +cd .. +java ${CUSTOM_PARAMS} -Djava.library.path="${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@" diff --git a/sig b/sig index c93b1cf..7e91c1a 100755 --- a/sig +++ b/sig @@ -1,12 +1,14 @@ -if [ -z "$1" ] - then - echo "" - echo " Usage: ./sig {args}" - echo "" - echo " Command List:" - ls -1 ./scripts | sed -e 's/\.sh$//' | sed -e 's/^/ /' - echo "" - exit -fi +export AUTO_UPDATE=true + +source utils/define.sh + +define PROJECT_NAME "sigPlace" +define PROJECT_DIR "." +define MAIN_CLASS "${PROJECT_NAME}" +define OUT_DIR "bin" +define LIBRARY_PATH "lib" +define CLASS_PATH "${PROJECT_DIR}" +define CUSTOM_PARAMS "" +define LANGUAGE "Java" ./scripts/$1.sh "${*:2}" \ No newline at end of file diff --git a/sigPlace.jar b/sigPlace.jar new file mode 100644 index 0000000..8ca9abb Binary files /dev/null and b/sigPlace.jar differ diff --git a/sigPlace.java b/sigPlace.java index afb78f0..00c2ca9 100644 --- a/sigPlace.java +++ b/sigPlace.java @@ -86,358 +86,362 @@ public class sigPlace { final static int TRANSPARENT = new Color(0,0,0,0).getRGB(); public static void main(String[] args) { - populateDatabase(); - /*String fontName = "sdvx_EXScore"; - String value = "00457"; - Path f = Paths.get("tests","sdvx8.png"); - BufferedImage img; - try { - img = ImageIO.read(f.toFile()); - Box scoreBox = new Box(630,1142,110,16); - - int[] arr = img.getRGB(scoreBox.x, scoreBox.y, scoreBox.w, scoreBox.h, null, 0, scoreBox.w); + if (args.length>0&&args[0].equals("arcade")) { + System.out.println("Arcade"); + } else { + populateDatabase(); + /*String fontName = "sdvx_EXScore"; + String value = "00457"; + Path f = Paths.get("tests","sdvx8.png"); + BufferedImage img; + try { + img = ImageIO.read(f.toFile()); + Box scoreBox = new Box(630,1142,110,16); + + int[] arr = img.getRGB(scoreBox.x, scoreBox.y, scoreBox.w, scoreBox.h, null, 0, scoreBox.w); - BufferedImage newImg = new BufferedImage(scoreBox.w,scoreBox.h,BufferedImage.TYPE_INT_ARGB); - int width=scoreBox.w; - - final ColorRange TARGETCOLOR = new ColorRange(230,255,180,255,20,255); - final ColorRange SEEKINGCOLOR = new ColorRange(180,255,140,255,15,255); - final Color FINALCOLOR = Color.MAGENTA; - for (int i=0;i data; + try { + data = Files.readAllLines(secretFile); + SECRET = data.get(0); + } catch (IOException e1) { + System.out.println("Client secret must be included in .clientsecret!"); + e1.printStackTrace(); } - newImg.setRGB(0,0,scoreBox.w,scoreBox.h,arr,0,scoreBox.w); - ImageIO.write(newImg,"png",new File("test.png")); - Font.TrainFont(fontName,value,newImg); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - }*/ - //new PopnReader().interpretBoxes(Paths.get("tests","popn8.png"),true); - //ArcadeReader.runTests(); - /*BufferedImage img; - ArcadeReader.submitToDatabase(Paths.get("tests","sdvx1.png")); - ArcadeReader.submitToDatabase(Paths.get("tests","sdvx2.png")); - ArcadeReader.submitToDatabase(Paths.get("tests","sdvx3.png")); - ArcadeReader.submitToDatabase(Paths.get("tests","sdvx4.png"));*/ - //System.out.println(RECENT_PLAYS); - //System.out.println(RECENT_RECORDS); - /* Path secretFile = Paths.get(".clientsecret"); - List data; - try { - data = Files.readAllLines(secretFile); - SECRET = data.get(0); - } catch (IOException e1) { - System.out.println("Client secret must be included in .clientsecret!"); - e1.printStackTrace(); - } - if (args.length>0&&args.length%2==0) { - int i=0; - while (i0&&args.length%2==0) { + int i=0; + while (i items = Files.walk(Paths.get("out")).filter((p)->!p.toAbsolutePath().toString().contains("images/")).iterator(); - ParseArticleFiles(items); + System.out.println("Copying files over to output directory..."); + try { + copyDirectory("sitefiles","out"); + Iterator items = Files.walk(Paths.get("out")).filter((p)->!p.toAbsolutePath().toString().contains("images/")).iterator(); + ParseArticleFiles(items); - items = Files.walk(Paths.get("out")).iterator(); - ConvertArticleReferences(items); - items = Files.walk(Paths.get("out","articles")).iterator(); - GenerateArticleFiles(items); - }catch (IOException e) { - e.printStackTrace(); - System.err.println("Copying files over failed!"); - return; - } + items = Files.walk(Paths.get("out")).iterator(); + ConvertArticleReferences(items); + items = Files.walk(Paths.get("out","articles")).iterator(); + GenerateArticleFiles(items); + }catch (IOException e) { + e.printStackTrace(); + System.err.println("Copying files over failed!"); + return; + } - System.out.println("Building directory listings..."); - try { - buildDirectoryListings(); - } catch (IOException e) { - e.printStackTrace(); - System.err.println("Failed to build directory listings!"); - return; - } + System.out.println("Building directory listings..."); + try { + buildDirectoryListings(); + } catch (IOException e) { + e.printStackTrace(); + System.err.println("Failed to build directory listings!"); + return; + } - System.out.println("Site has been built into the "+OUTDIR+" directory."); + System.out.println("Site has been built into the "+OUTDIR+" directory."); - ExportCodeFile(); + ExportCodeFile(); - System.out.println("\nStarting web server..."); - new sigServer(); - } - + System.out.println("\nStarting web server..."); + new sigServer(); + } + - private static String JSON(HashMap testMap) { - StringBuilder sb = new StringBuilder(); - String temp = testMap.toString(); - if (temp.charAt(0)=='{') { - sb.append("{"); - int marker=1; - boolean ending=false; - while (marker testMap) { + StringBuilder sb = new StringBuilder(); + String temp = testMap.toString(); + if (temp.charAt(0)=='{') { + sb.append("{"); + int marker=1; + boolean ending=false; + while (marker items) { - while (items.hasNext()) { - Path f = items.next(); - System.out.println(" Found "+f.getFileName()); - if (Files.isRegularFile(f)) { - try { + private static void ParseArticleFiles(Iterator items) { + while (items.hasNext()) { + Path f = items.next(); + System.out.println(" Found "+f.getFileName()); + if (Files.isRegularFile(f)) { + try { - System.out.println(" Preparing "+f.getFileName()); + System.out.println(" Preparing "+f.getFileName()); - List content = Files.readAllLines(f); - if (isHTMLFile(f)) { - content.addAll(0,Files.readAllLines(ops.get("%NAVBAR"))); - content.addAll(0,Files.readAllLines(ops.get("%DEFAULT"))); - content.addAll(Files.readAllLines(ops.get("%FOOTER"))); - } + List content = Files.readAllLines(f); + if (isHTMLFile(f)) { + content.addAll(0,Files.readAllLines(ops.get("%NAVBAR"))); + content.addAll(0,Files.readAllLines(ops.get("%DEFAULT"))); + content.addAll(Files.readAllLines(ops.get("%FOOTER"))); + } - System.out.println(" Parsing "+f.getFileName()); - for (int i=0;i0&&(isHTMLFile(f)||isArticleFile(f))) { - if (!inCodeBlock) { - if (s.trim().equals("
")) {
-                                    //System.out.println("Inside 
");
-                                    inCodeBlock=true;
-                                    storedCodeBlock="";
-                                    s=s.substring(0,s.indexOf("
"));
-                                }
-                            }
-                            if (inCodeBlock&&s.trim().equals("
")) { - inCodeBlock=false; - boolean keyword=false; - boolean inString=false; - boolean inComment=false; - boolean inMultiLineComment=false; - char stringChar=' '; - boolean canBeNumericalConstant=false; - int lengthOfConstant=0; - storedCodeBlock+=s.substring(0,s.indexOf("
")); - storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2"); - storedCodeBlock+="
"; - int startPos=0; - String endText=s.substring(s.indexOf("")+"".length(),s.length()); - s=""; - for (int j=0;j"; - startPos=j+1; + System.out.println(" Parsing "+f.getFileName()); + for (int i=0;i0&&(isHTMLFile(f)||isArticleFile(f))) { + if (!inCodeBlock) { + if (s.trim().equals("
")) {
+                                        //System.out.println("Inside 
");
+                                        inCodeBlock=true;
+                                        storedCodeBlock="";
+                                        s=s.substring(0,s.indexOf("
"));
                                     }
-                                    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 (inCodeBlock&&s.trim().equals("
")) { + inCodeBlock=false; + boolean keyword=false; + boolean inString=false; + boolean inComment=false; + boolean inMultiLineComment=false; + char stringChar=' '; + boolean canBeNumericalConstant=false; + int lengthOfConstant=0; + storedCodeBlock+=s.substring(0,s.indexOf("
")); + storedCodeBlock=storedCodeBlock.replaceAll(Pattern.quote("<"),"\2"); + storedCodeBlock+="
"; + int startPos=0; + String endText=s.substring(s.indexOf("")+"".length(),s.length()); + s=""; + for (int j=0;j"; startPos=j+1; } - } else - if (!inString) { - if (canBeNumericalConstant&&validNumericalConstantCharacters(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(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(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(j-4)&&!isAlphanumeric(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(j-5)&&!isAlphanumeric(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(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(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(j)){ - if (startPos0&&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(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(j-4)&&!isAlphanumeric(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(j-5)&&!isAlphanumeric(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(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(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(j)){ + if (startPos='0'&&storedCodeBlock.charAt(j)<='9')) { - canBeNumericalConstant=false; - } - if (!canBeNumericalConstant&&!isAlphanumeric(j)) { - canBeNumericalConstant=true; - lengthOfConstant=0; - //System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric..."); + if (canBeNumericalConstant&&lengthOfConstant==0&&!(storedCodeBlock.charAt(j)>='0'&&storedCodeBlock.charAt(j)<='9')) { + canBeNumericalConstant=false; + } + if (!canBeNumericalConstant&&!isAlphanumeric(j)) { + canBeNumericalConstant=true; + lengthOfConstant=0; + //System.out.println("Found "+storedCodeBlock.charAt(j)+", can be numeric..."); + } } - } - for (int j=0;j0&&isArticleFile(f)&&!inCodeBlock) { - //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 there's more text to be shown than can fit. - } else - if (s.startsWith("===")) { - 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: - //:,,, - String[] splitter = s.split(Pattern.quote(",")); - StringBuilder captionText = new StringBuilder(splitter[3]); - for (int j=4;j0&&isArticleFile(f)&&!inCodeBlock) { + //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 there's more text to be shown than can fit. + } else + if (s.startsWith("===")) { + 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: + //:,,, + String[] splitter = s.split(Pattern.quote(",")); + StringBuilder captionText = new StringBuilder(splitter[3]); + for (int j=4;j
"+captionText.toString()+"
"; + } else { + //It's regular content, so add paragraphs. + s="

\n"+s+"\n

"; } - s="
"+captionText.toString()+"
"; } else { - //It's regular content, so add paragraphs. - s="

\n"+s+"\n

"; + if (s.length()==0&&isArticleFile(f)&&!inCodeBlock) { + s="
"; //Setup a line break here. + } } - } else { - if (s.length()==0&&isArticleFile(f)&&!inCodeBlock) { - s="
"; //Setup a line break here. + if (!endPreLine) { + for (String key : map.keySet()) { + s=s.replaceAll(Pattern.quote(key),map.get(key)); + } } - } - if (!endPreLine) { - for (String key : map.keySet()) { - s=s.replaceAll(Pattern.quote(key),map.get(key)); + if (s.trim().length()==0) { + content.remove(i--); + } else { + content.set(i,s); } } - if (s.trim().length()==0) { - content.remove(i--); - } else { - content.set(i,s); - } - } - System.out.println(" Writing to "+f.toAbsolutePath()); + System.out.println(" Writing to "+f.toAbsolutePath()); - Files.write(f, content, Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); - - System.out.println(" "+f.getFileName() + " conversion complete!"); + Files.write(f, content, Charset.defaultCharset(),StandardOpenOption.CREATE,StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.WRITE); + + System.out.println(" "+f.getFileName() + " conversion complete!"); - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } } - } - } */ + } */ + } } private static void populateDatabase() { Iterator files; diff --git a/utils/define.sh b/utils/define.sh new file mode 100644 index 0000000..e87f88d --- /dev/null +++ b/utils/define.sh @@ -0,0 +1,9 @@ +export VARS=("") + +export LANGUAGE="" + +function define() { + VARS+=("$1") + value="${*:2}" + eval export "$1"='$value' +} \ No newline at end of file