diff options
author | rsiddharth <rsiddharth@ninthfloor.org> | 2012-11-10 11:29:31 +0530 |
---|---|---|
committer | rsiddharth <rsiddharth@ninthfloor.org> | 2012-11-10 11:29:31 +0530 |
commit | ceed73fa063ffb3b72d21c8a8800122c115acc58 (patch) | |
tree | e6519430ea904e1e7842b17e1ad177a17ef5bfb4 /conversion/FileSieve.java | |
parent | 00a25a7ef03e25864019ef2e4f3fe5813ec292e9 (diff) |
marked-up files should have a '.scruffy' extension from now on. This
commit is an un-stable commit. It has bugs.
removed:
io/PresentFile.java (moved to status/PresentFile.java)
added:
conversion/CreateHtmlFile.java (creates a corresponding '.html' file
for a given '.scruffy' marked-up
file)
(needs some fine-tuning)
status/PresentFile.java (see above)
modified:
conversion/ConvertFile.java (CreatHtmlFile object takes care of
producing a corresponding html 'File')
conversion/FileSieve.java (regex modified to reflect the
'.scruffy' extension)
index/IndexCreator.java (edits to reflect the '.scruffy' extension)
parsers/BackButton.java (edit to reflect the '.scruffy' extension)
parsers/DocumentName.java (edit to reflect the package change for
PresentFile class)
parsers/Header.java (edit to reflect the package change for
PresentFile class)
todo (updated todo)
Diffstat (limited to 'conversion/FileSieve.java')
-rw-r--r-- | conversion/FileSieve.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/conversion/FileSieve.java b/conversion/FileSieve.java index 8d53648..3571433 100644 --- a/conversion/FileSieve.java +++ b/conversion/FileSieve.java @@ -28,9 +28,19 @@ public class FileSieve implements FileFilter { // this method return true, if this file doesn't represent // a html file. public boolean accept(File pathname) { - Pattern pattern = Pattern.compile("(.+\\.(html|png|jpg|css|tar|ttf))|(.+?\\~)|(index)|(\\..+)|(\\#.+?\\#)"); + // check if this is a directory, if yes, accept immediately. + if(pathname.isDirectory() && (!pathname.isHidden())) { + return true; + } + Pattern pattern = Pattern.compile(".+?\\.scruffy$"); + Pattern indexPattern = Pattern.compile("^index\\.scruffy$"); Matcher matcher = pattern.matcher(pathname.getName()); + Matcher indexMatcher = indexPattern.matcher(pathname.getName()); boolean bool = matcher.find(); - return !bool; + if(bool) { + // don't 'accept' if the file is 'index.scruffy'. + bool = !(indexMatcher.find()); + } + return bool; } } |