19 package org.turro.parser.wiki;
22 import org.turro.elephant.context.IConstructor;
23 import org.turro.parser.MacroParser;
24 import org.turro.plugin.contacts.IContact;
25 import org.turro.reflection.Instances;
26 import org.turro.util.Final;
35 this.constructor = constructor;
40 this.contact = contact;
45 Final<String> result = Final.empty();
46 if(
"@w{help}".equals(value)) {
48 }
else if(value.contains(MACRO_START)) {
49 MacroParser.of(MACRO_START, MACRO_END).process(value, content -> {
50 String name = MacroParser.macroName(content);
51 Map<String, String> pars = MacroParser.parameterMap(content);
53 String expanded = processor.expand(constructor, contact, name, pars);
54 if(expanded != null) {
61 return result.isEmpty() ? notFound(value) : result.get();
65 StringBuilder sb =
new StringBuilder();
67 for(String name : processor.locateNames(constructor)) {
68 String expanded = processor.help(constructor, name);
69 if(expanded !=
null) {
80 private String notFound(String value) {
81 return "<span style='color:red'>(WM " + value +
")</span>";
90 private static final String MACRO_START =
"@w{", MACRO_END =
"}";
WikiProcessors contact(IContact contact)
WikiProcessors constructor(IConstructor constructor)
static WikiProcessors instance()
String resolve(String value)