-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ClaroDocs Now Renders Exported Initializers/Unwrappers
Straightforward modelling of initializers/unwrappers.
- Loading branch information
1 parent
740b928
commit bfa8c47
Showing
7 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/java/com/claro/module_system/clarodocs/html_rendering/initializers/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
java_library( | ||
name = "initializers", | ||
srcs = ["InitializersHtml.java"], | ||
deps = [ | ||
"//src/java/com/claro/module_system/clarodocs/html_rendering:util", | ||
"//src/java/com/claro/module_system/clarodocs/html_rendering/procedures:procedure_html", | ||
"//src/java/com/claro/module_system/module_serialization/proto:serialized_claro_module_java_proto", | ||
], | ||
visibility = [ | ||
"//src/java/com/claro/module_system/clarodocs:__pkg__", | ||
] | ||
) |
33 changes: 33 additions & 0 deletions
33
src/java/com/claro/module_system/clarodocs/html_rendering/initializers/InitializersHtml.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.claro.module_system.clarodocs.html_rendering.initializers; | ||
|
||
import com.claro.module_system.clarodocs.html_rendering.Util; | ||
import com.claro.module_system.clarodocs.html_rendering.procedures.ProcedureHtml; | ||
import com.claro.module_system.module_serialization.proto.SerializedClaroModule; | ||
|
||
import java.util.stream.Collectors; | ||
|
||
import static com.claro.module_system.clarodocs.html_rendering.Util.GrammarPart.INITIALIZERS; | ||
|
||
public class InitializersHtml { | ||
public static final String INITIALIZERS_CLASS = "initializers"; | ||
public static final String INITIALIZERS_BLOCK_TEMPLATE = | ||
INITIALIZERS + " %s {\n%s\n}"; | ||
|
||
public static void renderInitializersBlock( | ||
StringBuilder res, | ||
String initializedTypeName, | ||
SerializedClaroModule.ExportedTypeDefinitions.ProcedureList procedures) { | ||
res.append( | ||
Util.wrapAsDefaultCodeBlock( | ||
INITIALIZERS_CLASS, | ||
initializedTypeName, | ||
String.format( | ||
INITIALIZERS_BLOCK_TEMPLATE, | ||
initializedTypeName, | ||
procedures.getProceduresList().stream() | ||
.map(procedure -> ProcedureHtml.generateProcedureHtmlWithIndentationLevel(procedure, 1)) | ||
.collect(Collectors.joining("\n")) | ||
) | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/java/com/claro/module_system/clarodocs/html_rendering/unwrappers/BUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
java_library( | ||
name = "unwrappers", | ||
srcs = ["UnwrappersHtml.java"], | ||
deps = [ | ||
"//src/java/com/claro/module_system/clarodocs/html_rendering:util", | ||
"//src/java/com/claro/module_system/clarodocs/html_rendering/procedures:procedure_html", | ||
"//src/java/com/claro/module_system/module_serialization/proto:serialized_claro_module_java_proto", | ||
], | ||
visibility = [ | ||
"//src/java/com/claro/module_system/clarodocs:__pkg__", | ||
] | ||
) |
33 changes: 33 additions & 0 deletions
33
src/java/com/claro/module_system/clarodocs/html_rendering/unwrappers/UnwrappersHtml.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.claro.module_system.clarodocs.html_rendering.unwrappers; | ||
|
||
import com.claro.module_system.clarodocs.html_rendering.Util; | ||
import com.claro.module_system.clarodocs.html_rendering.procedures.ProcedureHtml; | ||
import com.claro.module_system.module_serialization.proto.SerializedClaroModule; | ||
|
||
import java.util.stream.Collectors; | ||
|
||
import static com.claro.module_system.clarodocs.html_rendering.Util.GrammarPart.UNWRAPPERS; | ||
|
||
public class UnwrappersHtml { | ||
public static final String UNWRAPPERS_CLASS = "unwrappers"; | ||
public static final String UNWRAPPERS_BLOCK_TEMPLATE = | ||
UNWRAPPERS + " %s {\n%s\n}"; | ||
|
||
public static void renderUnwrappersBlock( | ||
StringBuilder res, | ||
String unwrappedTypeName, | ||
SerializedClaroModule.ExportedTypeDefinitions.ProcedureList procedures) { | ||
res.append( | ||
Util.wrapAsDefaultCodeBlock( | ||
UNWRAPPERS_CLASS, | ||
unwrappedTypeName, | ||
String.format( | ||
UNWRAPPERS_BLOCK_TEMPLATE, | ||
unwrappedTypeName, | ||
procedures.getProceduresList().stream() | ||
.map(procedure -> ProcedureHtml.generateProcedureHtmlWithIndentationLevel(procedure, 1)) | ||
.collect(Collectors.joining("\n")) | ||
) | ||
)); | ||
} | ||
} |