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())) {
|
||||
Matcher matcher = INCLUDE.matcher(line);
|
||||
if (!matcher.matches()) newData.append(line);
|
||||
else {
|
||||
newData.append(download(matcher.group(1)).data());
|
||||
}
|
||||
else newData.append(download(matcher.group(1)).data());
|
||||
newData.append('\n');
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
if (pipeline.data().lines()
|
||||
.anyMatch(INCLUDE.asPredicate().negate()
|
||||
.and(LINK.asPredicate().negate())
|
||||
.and(Predicate.not(String::isBlank)))) {
|
||||
// More than just includes: generate override without include node
|
||||
pipelineConsumer.accept(pipeline);
|
||||
// Filter
|
||||
StringBuilder newDate = new StringBuilder();
|
||||
boolean foundContent = false;
|
||||
for (String line : new StreamIterable<>(pipeline.data().lines())) {
|
||||
if (LINK.matcher(line).matches()) continue;
|
||||
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