summaryrefslogtreecommitdiffstats
path: root/conversion
diff options
context:
space:
mode:
Diffstat (limited to 'conversion')
-rw-r--r--conversion/ConvertDirectory.java5
-rw-r--r--conversion/ConvertFile.java44
2 files changed, 26 insertions, 23 deletions
diff --git a/conversion/ConvertDirectory.java b/conversion/ConvertDirectory.java
index 3cc6a36..3b70a71 100644
--- a/conversion/ConvertDirectory.java
+++ b/conversion/ConvertDirectory.java
@@ -55,8 +55,9 @@ public class ConvertDirectory {
}
}
- boolean modified = index.write();
- if(modified)
+ boolean convertIndex = (index.shouldConvert() ||
+ canConvert.check(index.indexFile()));
+ if(convertIndex)
html.convert(index.indexFile());
}
}
diff --git a/conversion/ConvertFile.java b/conversion/ConvertFile.java
index 37da060..6767717 100644
--- a/conversion/ConvertFile.java
+++ b/conversion/ConvertFile.java
@@ -30,28 +30,30 @@ public class ConvertFile {
private List<Parser> parsers;
private ReadFile readFile;
public ConvertFile() {
- parsers = new ParserList().list();
+ parsers = new ParserList().list();
}
public void convert(File file) {
- /**
- * footer is optional, so it is null
- * by default.
- */
- PresentFile.footer = null;
- /**
- * takes the present file reference
- * for use outside this method.
- */
- PresentFile.file = file;
- readFile = new ReadFile(file);
- String fileContent = readFile.getContent();
- // start conversion.
- for(Parser p:parsers) {
- fileContent = p.parse(fileContent);
- }
-
- // Write converted file to respective html file.
- File outputFile = new File(file.getAbsolutePath()+".html");
- new WriteFile(outputFile,fileContent).write();
+ /**
+ * footer is optional, so it is null
+ * by default.
+ */
+ PresentFile.footer = null;
+ /**
+ * takes the present file reference
+ * for use outside this method.
+ */
+ PresentFile.file = file;
+ readFile = new ReadFile(file);
+ String fileContent = readFile.getContent();
+ if(!fileContent.equals("")) {
+ // start conversion.
+ for(Parser p:parsers) {
+ fileContent = p.parse(fileContent);
+
+ }
+ }
+ // Write converted file to respective html file.
+ File outputFile = new File(file.getAbsolutePath()+".html");
+ new WriteFile(outputFile,fileContent).write();
}
}