19 package org.turro.parser.processor;
21 import java.util.List;
22 import java.util.stream.Collectors;
23 import org.turro.action.Secrets;
24 import org.turro.action.content.ContentProviders;
25 import org.turro.annotation.ExternalParser;
26 import org.turro.emoji.EmojiMap;
27 import org.turro.html.Colors;
28 import org.turro.icon.IconSet;
29 import org.turro.indicator.IElephantIndicator;
30 import org.turro.indicator.Indicators;
31 import org.turro.marker.ElephantMarker;
32 import org.turro.parser.AbstractParser;
33 import org.turro.parser.IParser;
34 import org.turro.parser.MacroMap;
35 import org.turro.parser.MacroParameter;
36 import org.turro.reflection.Instances;
37 import org.turro.security.Permissions;
38 import org.turro.security.SecurityGroups;
48 return "Documentation";
55 case "provider-macros" -> {
61 case "social-groups" -> {
68 case "elephant-macros" -> {
70 marker.
put(
"elephantParsers",
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")));
81 case "elephant-macro-processors" -> {
83 marker.
put(
"elephantProcessors",
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")));
94 case "elephant-emojis" -> {
96 marker.
put(
"emojimap", EmojiMap.getInstance());
99 case "elephant-icons" -> {
101 marker.
put(
"iconset", IconSet.getInstance());
104 case "elephant-colors" -> {
106 marker.
put(
"colors", Colors.getHueList());
109 case "elephant-indicators" -> {
112 return
"all".equals(macro.get(
"indicator")) ||
113 ((i instanceof IElephantIndicator) &&
114 ((IElephantIndicator) i).getRoot().equals(macro.get(
"indicator")));
116 marker.
put(
"headers",
"true".equals(macro.
get(
"headers")));
122 marker.
put(
"notice",
Secrets.<List<String>>getObject(
"key=notice;show=false"));
127 marker.
put(
"licenses",
Secrets.<List<String>>getObject(
"key=licenses;show=false"));
130 case "libraries" -> {
132 marker.
put(
"libraries",
Secrets.<List<String>>getObject(
"key=libraries;show=false"));
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");
static List< IContentProvider > getProviders()
static List< IElephantIndicator > getIndicators()
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
void prepareProperties(ElephantMarker marker, String properties)
void explainMacros(MacroMap macros)
void doProcess(MacroProcessorContext context)
ElephantMarker getMarker()
static SortedMap< String, SortedSet< String > > permissionStringMap()
static Collection< SecurityGroup > getAll()