BrightSide Workbench Full Report + Source Code
org.turro.parser.wiki.WikiProcessors Class Reference

Public Member Functions

WikiProcessors constructor (IConstructor constructor)
 
WikiProcessors contact (IContact contact)
 
String resolve (String value)
 
String help ()
 

Static Public Member Functions

static WikiProcessors instance ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file WikiProcessors.java.

Member Function Documentation

◆ constructor()

WikiProcessors org.turro.parser.wiki.WikiProcessors.constructor ( IConstructor  constructor)

Definition at line 34 of file WikiProcessors.java.

34  {
35  this.constructor = constructor;
36  return this;
37  }

◆ contact()

WikiProcessors org.turro.parser.wiki.WikiProcessors.contact ( IContact  contact)

Definition at line 39 of file WikiProcessors.java.

39  {
40  this.contact = contact;
41  return this;
42  }

◆ help()

String org.turro.parser.wiki.WikiProcessors.help ( )

Definition at line 64 of file WikiProcessors.java.

64  {
65  StringBuilder sb = new StringBuilder();
66  for(IMacroProcessor processor : Instances.cached().byInterface(IMacroProcessor.class, IMacroProcessor.class)) {
67  for(String name : processor.locateNames(constructor)) {
68  String expanded = processor.help(constructor, name);
69  if(expanded != null) {
70  sb.append(expanded);
71  }
72  }
73  }
74  return sb.toString();
75  }
Here is the caller graph for this function:

◆ instance()

static WikiProcessors org.turro.parser.wiki.WikiProcessors.instance ( )
static

Definition at line 86 of file WikiProcessors.java.

86  {
87  return new WikiProcessors();
88  }
Here is the caller graph for this function:

◆ resolve()

String org.turro.parser.wiki.WikiProcessors.resolve ( String  value)

Definition at line 44 of file WikiProcessors.java.

44  {
45  Final<String> result = Final.empty();
46  if("@w{help}".equals(value)) {
47  result.set(help());
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);
52  for(IMacroProcessor processor : Instances.cached().byInterface(IMacroProcessor.class, IMacroProcessor.class)) {
53  String expanded = processor.expand(constructor, contact, name, pars);
54  if(expanded != null) {
55  result.set(expanded);
56  break;
57  }
58  }
59  });
60  }
61  return result.isEmpty() ? notFound(value) : result.get();
62  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: