summaryrefslogtreecommitdiffstats
path: root/conversion/ConvertFile.java
diff options
context:
space:
mode:
authorrsiddharth <rsiddharth@ninthfloor.org>2012-10-27 16:34:13 +0530
committerrsiddharth <rsiddharth@ninthfloor.org>2012-10-27 16:34:13 +0530
commitf6f99c41dbd86f85ce816ea8d388e44e04aed6cc (patch)
tree467a4ca690cf4cbe2f5c6667c72c55a45ab2391f /conversion/ConvertFile.java
parentd7245231e63111092aa364a48a757d83720137ff (diff)
modified:
.bzrignore conversion/ConvertDirectory.java (bug-fix) It is checked whether file "index" is modified since the last conversion. This check was not performed before. conversion/ConvertFile.java Some optimization there. Now we check if the file content is "empty" before we delve into conversion. index/IndexCreator.java # "index" file is created in the directory, if it is not created. # write() renamed to shouldConvert(). The method now returns true when a link is added to 'index' or when the index.html file does not exists. io/ReadFile.java # Exception message for made verbose. todo
Diffstat (limited to 'conversion/ConvertFile.java')
-rw-r--r--conversion/ConvertFile.java44
1 files changed, 23 insertions, 21 deletions
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();
}
}