javax0.jamal.snippet.SnipLine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jamal-snippet Show documentation
Show all versions of jamal-snippet Show documentation
Jamal macro library snippet macros
The newest version!
package javax0.jamal.snippet;
import javax0.jamal.api.BadSyntax;
import javax0.jamal.api.Input;
import javax0.jamal.api.Macro;
import javax0.jamal.api.Processor;
import javax0.jamal.tools.InputHandler;
import static javax0.jamal.tools.InputHandler.skipWhiteSpaces;
public class SnipLine implements Macro {
@Override
public String evaluate(final Input in, final Processor processor) throws BadSyntax {
skipWhiteSpaces(in);
final var id = InputHandler.fetchId(in);
// the rest of the line is ignored
return "" + (SnippetStore.getInstance(processor).line(id) + 1);
}
@Override
public String getId() {
return "snip:line";
}
}