BrightSide Workbench Full Report + Source Code
org.turro.parser.processor.DocumentationProcessor Class Reference
Inheritance diagram for org.turro.parser.processor.DocumentationProcessor:
Collaboration diagram for org.turro.parser.processor.DocumentationProcessor:

Public Member Functions

String getName ()
 
- Public Member Functions inherited from org.turro.parser.processor.AbstractMacroProcessor
 AbstractMacroProcessor ()
 
MacroMap getMacros ()
 
Macro getMacro (String name)
 
void process (MacroProcessorContext context)
 

Protected Member Functions

void doProcess (MacroProcessorContext context)
 
void explainMacros (MacroMap macros)
 
- Protected Member Functions inherited from org.turro.parser.processor.AbstractMacroProcessor
void prepareProperties (ElephantMarker marker, String properties)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.parser.processor.AbstractMacroProcessor
MacroMap macros = new MacroMap()
 

Detailed Description

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

Definition at line 44 of file DocumentationProcessor.java.

Member Function Documentation

◆ doProcess()

void org.turro.parser.processor.DocumentationProcessor.doProcess ( MacroProcessorContext  context)
protected

Reimplemented from org.turro.parser.processor.AbstractMacroProcessor.

Definition at line 52 of file DocumentationProcessor.java.

52  {
53  final MacroAdapter macro = context.getMacro();
54  switch(macro.getName()) {
55  case "provider-macros" -> {
56  ElephantMarker marker = context.getMarker();
57  marker.put("providers", ContentProviders.getProviders());
58  prepareProperties(marker, macro.get("doc-properties"));
59  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
60  }
61  case "social-groups" -> {
62  ElephantMarker marker = context.getMarker();
63  marker.put("socialGroups", SecurityGroups.getAll().stream().sorted().toList());
64  marker.put("roles", Permissions.permissionStringMap());
65  prepareProperties(marker, macro.get("doc-properties"));
66  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
67  }
68  case "elephant-macros" -> {
69  ElephantMarker marker = context.getMarker();
70  marker.put("elephantParsers",
71  Instances.cached().byAnnotation(ExternalParser.class, IParser.class)
72  .stream().filter((p) -> {
73  return "all".equals(macro.get("parser")) ||
74  ((p instanceof AbstractParser) &&
75  ((AbstractParser) p).getParserName().equals(macro.get("parser")));
76  }).collect(Collectors.toList()));
77  marker.put("headers", "true".equals(macro.get("headers")));
78  prepareProperties(marker, macro.get("doc-properties"));
79  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
80  }
81  case "elephant-macro-processors" -> {
82  ElephantMarker marker = context.getMarker();
83  marker.put("elephantProcessors",
84  Instances.cached().bySuper(AbstractMacroProcessor.class, IMacroProcessor.class)
85  .stream().filter((p) -> {
86  return "all".equals(macro.get("processor")) ||
87  ((p instanceof AbstractMacroProcessor) &&
88  ((AbstractMacroProcessor) p).getName().equals(macro.get("processor")));
89  }).collect(Collectors.toList()));
90  marker.put("headers", "true".equals(macro.get("headers")));
91  prepareProperties(marker, macro.get("doc-properties"));
92  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
93  }
94  case "elephant-emojis" -> {
95  ElephantMarker marker = context.getMarker();
96  marker.put("emojimap", EmojiMap.getInstance());
97  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
98  }
99  case "elephant-icons" -> {
100  ElephantMarker marker = context.getMarker();
101  marker.put("iconset", IconSet.getInstance());
102  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
103  }
104  case "elephant-colors" -> {
105  ElephantMarker marker = context.getMarker();
106  marker.put("colors", Colors.getHueList());
107  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
108  }
109  case "elephant-indicators" -> {
110  ElephantMarker marker = context.getMarker();
111  marker.put("elephantIndicators", Indicators.getIndicators().stream().filter((i) -> {
112  return "all".equals(macro.get("indicator")) ||
113  ((i instanceof IElephantIndicator) &&
114  ((IElephantIndicator) i).getRoot().equals(macro.get("indicator")));
115  }).toList());
116  marker.put("headers", "true".equals(macro.get("headers")));
117  prepareProperties(marker, macro.get("doc-properties"));
118  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
119  }
120  case "notice" -> {
121  ElephantMarker marker = context.getMarker();
122  marker.put("notice", Secrets.<List<String>>getObject("key=notice;show=false"));
123  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
124  }
125  case "licenses" -> {
126  ElephantMarker marker = context.getMarker();
127  marker.put("licenses", Secrets.<List<String>>getObject("key=licenses;show=false"));
128  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
129  }
130  case "libraries" -> {
131  ElephantMarker marker = context.getMarker();
132  marker.put("libraries", Secrets.<List<String>>getObject("key=libraries;show=false"));
133  marker.process(context.getTemplateRoot(), context.getTemplate(), context.getWriter());
134  }
135  }
136  }
void prepareProperties(ElephantMarker marker, String properties)
Here is the call graph for this function:

◆ explainMacros()

void org.turro.parser.processor.DocumentationProcessor.explainMacros ( MacroMap  macros)
protected

Reimplemented from org.turro.parser.processor.AbstractMacroProcessor.

Definition at line 139 of file DocumentationProcessor.java.

139  {
140  macros.addSecret("provider-macros")
141  .addParameter(MacroParameter.optional("doc-properties", "*/documentation"))
142  .addTemplate("documentation", "providerMacros");
143  macros.addSecret("social-groups")
144  .addParameter(MacroParameter.optional("doc-properties", "*/documentation"))
145  .addTemplate("documentation", "socialGroups");
146  macros.addSecret("elephant-macros")
147  .addParameter(MacroParameter.optional("parser", "all"))
148  .addParameter(MacroParameter.optional("headers", "true"))
149  .addParameter(MacroParameter.optional("doc-properties", "*/documentation"))
150  .addTemplate("documentation", "elephantMacros");
151  macros.addSecret("elephant-macro-processors")
152  .addParameter(MacroParameter.optional("processor", "all"))
153  .addParameter(MacroParameter.optional("headers", "true"))
154  .addParameter(MacroParameter.optional("doc-properties", "*/documentation"))
155  .addTemplate("documentation", "elephantMacroProcessors");
156  macros.addSecret("elephant-emojis")
157  .addParameter(MacroParameter.optional("tmpl-root", "documentation"))
158  .addTemplate("documentation", "providerEmojis");
159  macros.addSecret("elephant-icons")
160  .addTemplate("documentation", "providerIcons");
161  macros.addSecret("elephant-colors")
162  .addTemplate("documentation", "elephantColors");
163  macros.addSecret("elephant-indicators")
164  .addParameter(MacroParameter.optional("indicator", "all"))
165  .addParameter(MacroParameter.optional("headers", "true"))
166  .addParameter(MacroParameter.optional("doc-properties", "*/documentation"))
167  .addTemplate("documentation", "elephantIndicators");
168  macros.addSecret("notice")
169  .addTemplate("widgets/licenses", "notice");
170  macros.addSecret("licenses")
171  .addTemplate("widgets/licenses", "licenses");
172  macros.addSecret("libraries")
173  .addTemplate("widgets/licenses", "libraries");
174  }

◆ getName()

String org.turro.parser.processor.DocumentationProcessor.getName ( )

Reimplemented from org.turro.parser.processor.AbstractMacroProcessor.

Definition at line 47 of file DocumentationProcessor.java.

47  {
48  return "Documentation";
49  }

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