Filter links from pipeline
This commit is contained in:
parent
4bc7ba11bf
commit
3ee3c34ffc
|
@ -59,9 +59,7 @@ final class PipelineUnpacker implements BiConsumer<Pipeline, Consumer<Pipeline>>
|
||||||
for (String line : new StreamIterable<>(pipeline.data().lines())) {
|
for (String line : new StreamIterable<>(pipeline.data().lines())) {
|
||||||
Matcher matcher = INCLUDE.matcher(line);
|
Matcher matcher = INCLUDE.matcher(line);
|
||||||
if (!matcher.matches()) newData.append(line);
|
if (!matcher.matches()) newData.append(line);
|
||||||
else {
|
else newData.append(download(matcher.group(1)).data());
|
||||||
newData.append(download(matcher.group(1)).data());
|
|
||||||
}
|
|
||||||
newData.append('\n');
|
newData.append('\n');
|
||||||
}
|
}
|
||||||
processPipeline(new Pipeline(pipeline.name(), newData.toString()), pipelineConsumer, depth + 1);
|
processPipeline(new Pipeline(pipeline.name(), newData.toString()), pipelineConsumer, depth + 1);
|
||||||
|
@ -75,12 +73,16 @@ final class PipelineUnpacker implements BiConsumer<Pipeline, Consumer<Pipeline>>
|
||||||
processPipeline(download(url), pipelineConsumer, depth + 1);
|
processPipeline(download(url), pipelineConsumer, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipeline.data().lines()
|
// Filter
|
||||||
.anyMatch(INCLUDE.asPredicate().negate()
|
StringBuilder newDate = new StringBuilder();
|
||||||
.and(LINK.asPredicate().negate())
|
boolean foundContent = false;
|
||||||
.and(Predicate.not(String::isBlank)))) {
|
for (String line : new StreamIterable<>(pipeline.data().lines())) {
|
||||||
// More than just includes: generate override without include node
|
if (LINK.matcher(line).matches()) continue;
|
||||||
pipelineConsumer.accept(pipeline);
|
if (!line.isBlank()) foundContent = true;
|
||||||
|
newDate.append(line).append('\n');
|
||||||
|
}
|
||||||
|
if (foundContent) {
|
||||||
|
pipelineConsumer.accept(new Pipeline(pipeline.name(), newDate.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue