summaryrefslogtreecommitdiffstats
path: root/conversion/ConvertDirectory.java
diff options
context:
space:
mode:
authorrsiddharth <rsiddharth@ninthfloor.org>2012-12-21 09:21:15 +0530
committerrsiddharth <rsiddharth@ninthfloor.org>2012-12-21 09:21:15 +0530
commit86c7e3798569604e83e9f13adfe232021cdb0967 (patch)
tree29b185937090e09f800bc01a907891389505f7d2 /conversion/ConvertDirectory.java
parent92f629c0109fd23ed5859beb8b5f126318451469 (diff)
[bug-fix]: Each directory is checked if it contains the style.css, if
not present a new style.css in copied to the respective location. To reflect this, styling.StyleChecker class is used in conversion.ConvertDirectory instead of scruf.Scruf. modified: Scruf.java conversion/ConvertDirectory.java
Diffstat (limited to 'conversion/ConvertDirectory.java')
-rw-r--r--conversion/ConvertDirectory.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/conversion/ConvertDirectory.java b/conversion/ConvertDirectory.java
index a5717bb..32446da 100644
--- a/conversion/ConvertDirectory.java
+++ b/conversion/ConvertDirectory.java
@@ -25,14 +25,18 @@ import java.io.*;
import scruf.index.*;
import scruf.status.*;
import scruf.conversion.ignore.*;
+import scruf.styling.*;
public class ConvertDirectory {
private ConvertFile html;
private CanConvert canConvert;
private boolean can;
+ private StyleChecker styleSheet;
+ private boolean styleFlag;
public ConvertDirectory() {
- html = new ConvertFile();
- canConvert = new CanConvert();
+ html = new ConvertFile();
+ canConvert = new CanConvert();
+ styleSheet = new StyleChecker();
}
public void convert(File directory) {
if(!directory.isDirectory()) {
@@ -47,14 +51,18 @@ public class ConvertDirectory {
IndexCreator index = new IndexCreator(directory);
// iterate through the directory.
System.out.println("Current Directory: "+directory.getAbsolutePath());
+ // reset styleFlag.
+ styleFlag = false;
for(File file:directory.listFiles(new FileSieve())) {
if(file.isFile()) {
- can = canConvert.check(file);
- if(can) {
- System.out.println("Converting..."+file.getAbsolutePath());
- html.convert(file);
- index.add(file);
- }
+ can = canConvert.check(file);
+ if(can) {
+ System.out.println("Converting..."+file.getAbsolutePath());
+ html.convert(file);
+ index.add(file);
+ // set styleFlag.
+ styleFlag = true;
+ }
}
else if(file.isDirectory()) {
// Perform conversion, only if, directory
@@ -65,6 +73,11 @@ public class ConvertDirectory {
}
}
}
+ // if styleFlag is set, check for style sheet in
+ // in the directory.
+ if(styleFlag) {
+ styleSheet.resolve(directory);
+ }
boolean convertIndex = (index.shouldConvert() ||
canConvert.check(index.indexFile()));
if(convertIndex) {