You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/12/09 15:11:29 UTC

[isis] branch master updated: ISIS-2473: render static methods differently (italic)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e551c1  ISIS-2473: render static methods differently (italic)
4e551c1 is described below

commit 4e551c1134b1650c06a74fa74e83e5c1cf19a00c
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Dec 9 16:10:46 2020 +0100

    ISIS-2473: render static methods differently (italic)
---
 .../system/modules/generated/pages/index/UserMemento.adoc      | 10 +++++-----
 .../org/apache/isis/tooling/cli/doclet/AdocletContext.java     |  5 ++++-
 .../java/org/apache/isis/tooling/cli/doclet/ToAsciiDoc.java    |  7 ++++++-
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/antora/components/system/modules/generated/pages/index/UserMemento.adoc b/antora/components/system/modules/generated/pages/index/UserMemento.adoc
index e171d3c..8063e5b 100644
--- a/antora/components/system/modules/generated/pages/index/UserMemento.adoc
+++ b/antora/components/system/modules/generated/pages/index/UserMemento.adoc
@@ -6,23 +6,23 @@ Immutable serializable value holding details about a user and its roles.
 
 
 
-* `*system*()` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
+* `*_system_*()` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
 +
 The framework's internal user with unrestricted privileges.
 
-* `*ofName*(String name)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
+* `*_ofName_*(String name)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
 +
 Creates a new user with the specified name and no roles.
 
-* `*ofNameAndRoles*(String name, xref:system:generated:index/RoleMemento.adoc[RoleMemento]... roles)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
+* `*_ofNameAndRoles_*(String name, xref:system:generated:index/RoleMemento.adoc[RoleMemento]... roles)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
 +
 Creates a new user with the specified name and assigned roles.
 
-* `*ofNameAndRoleNames*(String name, String... roleNames)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
+* `*_ofNameAndRoleNames_*(String name, String... roleNames)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
 +
 Creates a new user with the specified name and assigned role names.
 
-* `*ofNameAndRoleNames*(String name, Stream<String> roleNames)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
+* `*_ofNameAndRoleNames_*(String name, Stream<String> roleNames)` : `xref:system:generated:index/UserMemento.adoc[UserMemento]`
 +
 Creates a new user with the specified name and assigned role names.
 
diff --git a/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/AdocletContext.java b/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/AdocletContext.java
index 4b5603d..fd48a33 100644
--- a/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/AdocletContext.java
+++ b/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/AdocletContext.java
@@ -42,6 +42,9 @@ public class AdocletContext {
     private final @NonNull String methodFormat = "`%s %s(%s)`"; // return-type | name | param-list
     
     @Builder.Default
+    private final @NonNull String staticMethodFormat = "`%s _%s_(%s)`"; // return-type | name | param-list
+    
+    @Builder.Default
     private final @NonNull String methodDescriptionFormat = "\n<.> %s %s\n"; // method | description
     
     @Builder.Default
@@ -78,8 +81,8 @@ public class AdocletContext {
     
     public static AdocletContextBuilder compactFormat() {
         return AdocletContext.builder()
-                .xrefPageIdFormat("system:generated:index/%s.adoc")
                 .methodFormat("`*%2$s*(%3$s)` : `%1$s`") // return-type | name | param-list)
+                .staticMethodFormat("`*_%2$s_*(%3$s)` : `%1$s`") // return-type | name | param-list)
                 .methodDescriptionFormat("\n* %s\n+\n%s\n") // method | description
                 .includeJavaSource(false)
                 ;        
diff --git a/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/ToAsciiDoc.java b/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/ToAsciiDoc.java
index c95eb08..1720028 100644
--- a/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/ToAsciiDoc.java
+++ b/tooling/cli/src/main/java/org/apache/isis/tooling/cli/doclet/ToAsciiDoc.java
@@ -38,7 +38,12 @@ class ToAsciiDoc {
     private final AdocletContext docletContext;
 
     public String methodDeclaration(final @NonNull MethodDeclaration md) {
-        return String.format(docletContext.getMethodFormat(), 
+        
+        val methodFormat = md.isStatic()
+                ? docletContext.getStaticMethodFormat()
+                : docletContext.getMethodFormat();
+        
+        return String.format(methodFormat, 
                 type(md.getType()),
                 md.getNameAsString(), 
                 md.getParameters()