Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main/java/eu/europa/ted/efx/interfaces/MarkupGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,15 @@ default Markup renderFragmentInvocation(final String name, final PathExpression
Markup renderFragmentInvocation(final String name, final Set<Argument> arguments);

/**
* Given a fragment name (identifier), an evaluation context, and some
* pre-rendered content, this method returns the code that invokes (uses) the
* fragment in a context loop.
* Given an evaluation context, and some pre-rendered content, this method returns the code that
* iterates over the context and repeats the content for each item in the context.
*
* As of version 2.0.0-alpha.4, the method composeFragmentInvocation(String, Set<Argument>)
* has been split into two methods:
* 1. {@link #renderFragmentInvocation(String, Set<Argument>)}
* for rendering the fragment invocation itself, which is the used by the
* context loop.
* 2. {@link #renderContextLoop(String, PathExpression, Markup, Set<Argument>)}
* 2. {@link #renderContextLoop(PathExpression, Markup, Set<Argument>)}
* for rendering the context loop that invokes the fragment.
*
* The EfxTemplateTranslator will call these two methods in sequence to generate the
Expand All @@ -291,13 +290,12 @@ default Markup renderFragmentInvocation(final String name, final PathExpression
* In EFX to XSLT translation, this method would generate the xsl:for-each that will loop
* over the context path expression and invoke the fragment for each item in the loop.
*
* @param name the name of the fragment.
* @param context the context path expression for the loop.
* @param content the content of the fragment.
* @param arguments the arguments to pass to the fragment.
* @return the code that invokes (uses) the fragment in a context loop.
*/
Markup renderContextLoop(final String name, final PathExpression context, final Markup content,
Markup renderContextLoop(final PathExpression context, final Markup content,
Comment thread
rousso marked this conversation as resolved.
final Set<Argument> arguments);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public Markup renderInvocation(MarkupGenerator markupGenerator) {
args.addAll(this.getOwnArguments().stream().map(a -> new Argument.Impl(a.name, markupGenerator.getEfxDataTypeEquivalent(a.dataType), a.value))
.collect(Collectors.toCollection(LinkedHashSet::new)));
var invocation = markupGenerator.renderFragmentInvocation(this.id, args);
return markupGenerator.renderContextLoop(this.id, this.context.relativePath(), invocation, args);
return markupGenerator.renderContextLoop(this.context.relativePath(), invocation, args);
}

// #endregion Render --------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public Markup renderInvocation(MarkupGenerator markupGenerator) {
Set<Argument> arguments = this.getOwnArguments().stream().map(a -> new Argument.Impl(a.name, markupGenerator.getEfxDataTypeEquivalent(a.dataType), a.value))
.collect(Collectors.toCollection(LinkedHashSet::new));
var content = markupGenerator.renderFragmentInvocation(this.id, arguments);
return markupGenerator.renderContextLoop(this.id, this.context.relativePath(), content, arguments);
return markupGenerator.renderContextLoop(this.context.relativePath(), content, arguments);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public Markup composeFragmentDefinition(String name, String number, Set<Conditio
}

@Override
public Markup renderContextLoop(String name, PathExpression context, final Markup content,
public Markup renderContextLoop(PathExpression context, final Markup content,
Set<Argument> arguments) {
return new Markup(String.format("for-each(%s).%s", context.getScript(), content.script));
}
Expand Down