77import org .moddingx .java_doclet_meta .DocEnv ;
88import org .moddingx .java_doclet_meta .util .HtmlConverter ;
99
10+ import javax .lang .model .element .Element ;
1011import java .util .*;
1112import java .util .stream .Collectors ;
1213
@@ -23,7 +24,7 @@ default JsonObject json() {
2324
2425 void addProperties (JsonObject json );
2526
26- static List <DocBlockData > fromInline (DocEnv env , DocTreePath basePath , List <DocBlockData > blocks , List <? extends DocTree > inline ) {
27+ static List <DocBlockData > fromInline (DocEnv env , Element context , DocTreePath basePath , List <DocBlockData > blocks , List <? extends DocTree > inline ) {
2728 // Inline return tags in the main description should act as separate block tags.
2829 Set <DocBlockData .Type > knownTypes = new HashSet <>(blocks .stream ().map (DocBlockData ::type ).collect (Collectors .toUnmodifiableSet ()));
2930 List <DocBlockData > inlineBlocks = new ArrayList <>();
@@ -32,7 +33,7 @@ static List<DocBlockData> fromInline(DocEnv env, DocTreePath basePath, List<DocB
3233 @ Override
3334 public Void visitReturn (ReturnTree tree , Void unused ) {
3435 if (tree .isInline () && knownTypes .add (Type .RETURN )) {
35- inlineBlocks .add (new TextBlock (Type .RETURN , HtmlConverter .asDocHtml (env , DocTreePath .getPath (basePath , tree ), tree .getDescription ())));
36+ inlineBlocks .add (new TextBlock (Type .RETURN , HtmlConverter .asDocHtml (env , context , DocTreePath .getPath (basePath , tree ), tree .getDescription ())));
3637 }
3738 return super .visitReturn (tree , unused );
3839 }
@@ -42,33 +43,33 @@ public Void visitReturn(ReturnTree tree, Void unused) {
4243 return List .copyOf (inlineBlocks );
4344 }
4445
45- static Optional <DocBlockData > from (DocEnv env , DocTreePath path , DocTree tree ) {
46+ static Optional <DocBlockData > from (DocEnv env , Element context , DocTreePath path , DocTree tree ) {
4647 // Ignore parameters, they are merged with ParamData
4748 return Optional .ofNullable (switch (tree .getKind ()) {
48- case AUTHOR -> new TextBlock (Type .AUTHOR , HtmlConverter .asDocHtml (env , path , ((AuthorTree ) tree ).getName ()));
49- case DEPRECATED -> new TextBlock (Type .DEPRECATED , HtmlConverter .asDocHtml (env , path , ((DeprecatedTree ) tree ).getBody ()));
49+ case AUTHOR -> new TextBlock (Type .AUTHOR , HtmlConverter .asDocHtml (env , context , path , ((AuthorTree ) tree ).getName ()));
50+ case DEPRECATED -> new TextBlock (Type .DEPRECATED , HtmlConverter .asDocHtml (env , context , path , ((DeprecatedTree ) tree ).getBody ()));
5051 case EXCEPTION -> {
5152 ThrowsTree ex = (ThrowsTree ) tree ;
52- yield ClassTextBlock .from (env , Type .EXCEPTION , path , ex .getExceptionName (), HtmlConverter .asDocHtml (env , path , ex .getDescription ()));
53+ yield ClassTextBlock .from (env , Type .EXCEPTION , path , ex .getExceptionName (), HtmlConverter .asDocHtml (env , context , path , ex .getDescription ()));
5354 }
5455 case THROWS -> {
5556 ThrowsTree ex = (ThrowsTree ) tree ;
56- yield ClassTextBlock .from (env , Type .THROWS , path , ex .getExceptionName (), HtmlConverter .asDocHtml (env , path , ex .getDescription ()));
57+ yield ClassTextBlock .from (env , Type .THROWS , path , ex .getExceptionName (), HtmlConverter .asDocHtml (env , context , path , ex .getDescription ()));
5758 }
5859 case PROVIDES -> {
5960 ProvidesTree provides = (ProvidesTree ) tree ;
60- yield ClassTextBlock .from (env , Type .PROVIDES , path , provides .getServiceType (), HtmlConverter .asDocHtml (env , path , provides .getDescription ()));
61+ yield ClassTextBlock .from (env , Type .PROVIDES , path , provides .getServiceType (), HtmlConverter .asDocHtml (env , context , path , provides .getDescription ()));
6162
6263 }
6364 case USES -> {
6465 UsesTree provides = (UsesTree ) tree ;
65- yield ClassTextBlock .from (env , Type .USES , path , provides .getServiceType (), HtmlConverter .asDocHtml (env , path , provides .getDescription ()));
66+ yield ClassTextBlock .from (env , Type .USES , path , provides .getServiceType (), HtmlConverter .asDocHtml (env , context , path , provides .getDescription ()));
6667
6768 }
68- case RETURN -> new TextBlock (Type .RETURN , HtmlConverter .asDocHtml (env , path , ((ReturnTree ) tree ).getDescription ()));
69- case SERIAL -> new TextBlock (Type .SERIAL , HtmlConverter .asDocHtml (env , path , ((SerialTree ) tree ).getDescription ()));
70- case SINCE -> new TextBlock (Type .SINCE , HtmlConverter .asDocHtml (env , path , ((SinceTree ) tree ).getBody ()));
71- case UNKNOWN_BLOCK_TAG -> new TextBlock (Type .UNKNOWN , HtmlConverter .asDocHtml (env , path , ((UnknownBlockTagTree ) tree ).getContent ()));
69+ case RETURN -> new TextBlock (Type .RETURN , HtmlConverter .asDocHtml (env , context , path , ((ReturnTree ) tree ).getDescription ()));
70+ case SERIAL -> new TextBlock (Type .SERIAL , HtmlConverter .asDocHtml (env , context , path , ((SerialTree ) tree ).getDescription ()));
71+ case SINCE -> new TextBlock (Type .SINCE , HtmlConverter .asDocHtml (env , context , path , ((SinceTree ) tree ).getBody ()));
72+ case UNKNOWN_BLOCK_TAG -> new TextBlock (Type .UNKNOWN , HtmlConverter .asDocHtml (env , context , path , ((UnknownBlockTagTree ) tree ).getContent ()));
7273 default -> null ;
7374 });
7475 }
0 commit comments