Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
misc task cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Apr 16, 2015
1 parent 1ef958b commit 9d0ff30
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ private List<PathAndModelSupplier> handleContentDir(FileResource resource, Local
return toAdd;
}

//TODO: apply filter
private List<PathAndModelSupplier> handleStaticDir(FileResource resource, Path defaultOutputPath,
DirPaginationConfiguration dirPaginationConf, Path targetDirPath) throws IOException {
Comparator<Path> comparator = Comparator.comparing((Path p) -> p.getFileName().toString(),//
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/ch/digitalfondue/stampo/resource/FileResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
Expand All @@ -34,24 +33,22 @@ public interface FileResource extends Resource {
StructuredFileExtension getStructuredFileExtension();

/**
* File extensions, ordered last to first.
* File extensions
*
* E.g.
*
* <pre>
* - test -> []
* - test.txt -> [txt]
* - test.txt.peb -> [peb, txt]
* - test.en.txt.peb -> [peb, txt, en]
* - test.txt.peb -> [txt, peb]
* - test.en.txt.peb -> [en, txt, peb]
* </pre>
*
* */
default List<String> getFileExtensions() {
String fileName = getPath().getFileName().toString();
String extensions = fileName.substring(getFileNameWithoutExtensions().length());
List<String> exts = Arrays.stream(extensions.split("\\.")).filter(s->s.length() > 0).collect(Collectors.toCollection(ArrayList::new));
Collections.reverse(exts);
return Collections.unmodifiableList(exts);
return Arrays.stream(extensions.split("\\.")).filter(s->s.length() > 0).collect(Collectors.toCollection(ArrayList::new));
}

default String getFileNameWithoutExtensions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ private Content readContent(ReadMode mode) {
throw new IllegalStateException(ioe);
}
}

// TODO: check possible inconsistency with FileResource.containLocaleInFileExtensions

/* given a list of extensions, return a structured view */
private StructuredFileExtension classifyFileExtension(Path filePath) {
List<String> exts = getFileExtensions();
Collections.reverse(exts);
//

List<String> processorRelated = takeWhile(exts, configuration.getProcessorResourceExtensions()::contains);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public StaticFileResource(StampoGlobalConfiguration configuration, Path path, Re
this.configuration = configuration;
this.path = path;
this.parent = parent;
//TODO: check if order of the rest list is correct
this.structuredFileExtension = new StructuredFileExtension(Collections.emptyList(), Optional.empty(), Optional.empty(), Collections.emptySet(), getFileExtensions());
}

Expand Down

0 comments on commit 9d0ff30

Please sign in to comment.