use of com.google.api.codegen.util.js.JSCommentReformatter in project toolkit by googleapis.
the class NodeJSGapicSurfaceDocTransformer method generateDoc.
private ViewModel generateDoc(ProtoFile file, GapicProductConfig productConfig) {
ModelTypeTable typeTable = new ModelTypeTable(new JSTypeTable(productConfig.getPackageName()), new NodeJSModelTypeNameConverter(productConfig.getPackageName()));
// Use file path for package name to get file-specific package instead of package for the API.
SurfaceNamer namer = new NodeJSSurfaceNamer(productConfig.getPackageName(), NodeJSUtils.isGcloud(productConfig));
JSCommentReformatter commentReformatter = new JSCommentReformatter();
GrpcDocView.Builder doc = GrpcDocView.newBuilder();
doc.templateFileName(DOC_TEMPLATE_FILENAME);
doc.outputPath(getOutputPath(namer, file));
doc.fileHeader(fileHeaderTransformer.generateFileHeader(productConfig, ImportSectionView.newBuilder().build(), namer));
doc.elementDocs(grpcElementDocTransformer.generateElementDocs(typeTable, namer, file));
return doc.build();
}
use of com.google.api.codegen.util.js.JSCommentReformatter in project toolkit by googleapis.
the class ProtoDocumentLinkTest method testJSCommentReformatter.
@Test
public void testJSCommentReformatter() {
JSCommentReformatter commentReformatter = new JSCommentReformatter();
Truth.assertThat(commentReformatter.reformat("[Shelf][google.example.library.v1.Shelf]")).isEqualTo("Shelf");
Truth.assertThat(commentReformatter.reformat("[$Shelf][google.example.library.v1.Shelf]")).isEqualTo("$Shelf");
// Cloud link may contain special character '$'
Truth.assertThat(commentReformatter.reformat("[cloud docs!](/library/example/link)")).isEqualTo("[cloud docs!](https://cloud.google.com/library/example/link)");
Truth.assertThat(commentReformatter.reformat("[cloud docs!](/library/example/link$)")).isEqualTo("[cloud docs!](https://cloud.google.com/library/example/link$)");
// Absolute link may contain special character '$'
Truth.assertThat(commentReformatter.reformat("[not a cloud link](http://www.google.com)")).isEqualTo("[not a cloud link](http://www.google.com)");
Truth.assertThat(commentReformatter.reformat("[not a cloud link](http://www.google.com$)")).isEqualTo("[not a cloud link](http://www.google.com$)");
}
Aggregations