Fix other macros as well

This commit is contained in:
Nanne Baars 2021-04-25 17:36:14 +02:00
parent 81c551552b
commit a91d45dea5
No known key found for this signature in database
GPG Key ID: A6D6C06FE4EC14E7
3 changed files with 15 additions and 5 deletions

View File

@ -17,6 +17,9 @@ public class OperatingSystemMacro extends InlineMacroProcessor {
@Override
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
return System.getProperty("os.name");
var osName = System.getProperty("os.name");
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
return createPhraseNode(contentNode, "quoted", osName);
}
}

View File

@ -16,7 +16,11 @@ public class WebGoatTmpDirMacro extends InlineMacroProcessor {
}
@Override
public String process(ContentNode contentNode, String target, Map<String, Object> attributes) {
return EnvironmentExposure.getEnv().getProperty("webgoat.server.directory");
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
var env = EnvironmentExposure.getEnv().getProperty("webgoat.server.directory");
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
return createPhraseNode(contentNode, "quoted", env);
}
}

View File

@ -16,7 +16,10 @@ public class WebGoatVersionMacro extends InlineMacroProcessor {
}
@Override
public String process(ContentNode contentNode, String target, Map<String, Object> attributes) {
return EnvironmentExposure.getEnv().getProperty("webgoat.build.version");
public Object process(ContentNode contentNode, String target, Map<String, Object> attributes) {
var webgoatVersion = EnvironmentExposure.getEnv().getProperty("webgoat.build.version");
//see https://discuss.asciidoctor.org/How-to-create-inline-macro-producing-HTML-In-AsciidoctorJ-td8313.html for why quoted is used
return createPhraseNode(contentNode, "quoted", webgoatVersion);
}
}