@@ -53,6 +53,7 @@ class Asciidoctor {
53
53
54
54
private static String PLACEHOLDER = "¯\\ _(ツ)_/¯" ;
55
55
private static final Pattern JAVADOC_CODE = Pattern .compile ("\\ {\\ @(link|code|literal)\\ s*(.*?)\\ }" );
56
+ private static final Pattern LINE_BREAKS = Pattern .compile ("\\ <\\ s*br\\ s*\\ >" );
56
57
private static final Logger LOG = LoggerFactory .getLogger (Asciidoctor .class );
57
58
58
59
private static final Optional <DocumentationSource > DOC_SOURCE = getSpringModulithDocsSource ()
@@ -190,6 +191,10 @@ public String renderPublishedEvents(ApplicationModule module) {
190
191
191
192
for (EventType eventType : events ) {
192
193
194
+ if (!module .isExposed (eventType .getType ())) {
195
+ continue ;
196
+ }
197
+
193
198
var documentation = docSource .flatMap (it -> it .getDocumentation (eventType .getType ()))
194
199
.map (" -- " ::concat );
195
200
@@ -310,28 +315,6 @@ private static String toTypeAndMethod(String type, Optional<String> methodSignat
310
315
}
311
316
312
317
private String toInlineCode (ArchitecturallyEvidentType type ) {
313
-
314
- var javaType = type .getType ();
315
- var code = toInlineCode (javaType );
316
-
317
- if (type .isEventListener ()) {
318
-
319
- if (!docSource .isPresent ()) {
320
-
321
- var referenceTypes = type .getReferenceTypes ();
322
-
323
- return "%s listening to %s" .formatted ( //
324
- toInlineCode (javaType ), //
325
- toInlineCode (referenceTypes ));
326
- }
327
-
328
- String header = "%s listening to:" .formatted (withDocumentation (code , javaType ) + System .lineSeparator ());
329
-
330
- return header + type .getReferenceMethods ()
331
- .map (it -> renderReferenceMethod (it , 1 ))
332
- .collect (joining (System .lineSeparator ()));
333
- }
334
-
335
318
return withDocumentation (toInlineCode (type .getType ()), type .getType ());
336
319
}
337
320
@@ -342,6 +325,15 @@ private String renderReferenceMethod(ReferenceMethod it, int level) {
342
325
() -> "Method %s must have at least one parameter!" .formatted (method ));
343
326
344
327
var parameterType = method .getRawParameterTypes ().get (0 );
328
+
329
+ var typeExposed = modules .getModuleByType (parameterType )
330
+ .map (module -> module .isExposed (parameterType ))
331
+ .orElse (true );
332
+
333
+ if (!typeExposed ) {
334
+ return "" ;
335
+ }
336
+
345
337
var isAsync = it .isAsync () ? "(async) " : "" ;
346
338
var indent = "*" .repeat (level + 1 );
347
339
@@ -389,6 +381,11 @@ public String toAsciidoctor(String source) {
389
381
source = source .replace (matcher .group (), toInlineCode (type ));
390
382
}
391
383
384
+ source = source .replaceAll ("<p>\\ s*" , System .lineSeparator () + "+" + System .lineSeparator ());
385
+ source = source .replace ("</p>" , "" );
386
+
387
+ source = LINE_BREAKS .matcher (source ).replaceAll (System .lineSeparator ());
388
+
392
389
return source ;
393
390
}
394
391
0 commit comments