/** * Splits given text into lines and returns a list of strings, each one representing a line, * without escaping HTML characters. */ public static List<String> splitLines(String text) { return CommonRenderingUtil.getDocLines(text); }
public List<String> getDocLines(String text) { return CommonRenderingUtil.getDocLines(text); }
/** Converts the given text to doc lines in the format of the current language. */ public List<String> getDocLines(String text) { return CommonRenderingUtil.getDocLines(commentReformatter.reformat(text)); }
/** * Splits given text into lines and returns a list of strings, each one representing a line. * Performs escaping of certain HTML characters. */ public static List<String> getDocLines(String text) { return CommonRenderingUtil.getDocLines(new JavaCommentReformatter().reformat(text)); }
@Test public void testGetDocLines() { // Check that we don't care which form of line break is used. assertThat(CommonRenderingUtil.getDocLines("a\nb\nc")).containsExactly("a", "b", "c").inOrder(); assertThat(CommonRenderingUtil.getDocLines("a\rb\rc")).containsExactly("a", "b", "c").inOrder(); assertThat(CommonRenderingUtil.getDocLines("a\r\nb\r\nc")) .containsExactly("a", "b", "c") .inOrder(); assertThat(CommonRenderingUtil.getDocLines("")).isEmpty(); } }
private PackageInfoView generatePackageInfo( ApiModel model, GapicProductConfig productConfig, SurfaceNamer namer) { String outputPath = productConfig.getPackageName(); String fileName = "doc.go"; PackageInfoView.Builder packageInfo = PackageInfoView.newBuilder(); packageInfo.templateFileName(DOC_TEMPLATE_FILENAME); packageInfo.outputPath(outputPath + File.separator + fileName); packageInfo.serviceTitle(model.getTitle()); packageInfo.importPath(productConfig.getPackageName()); packageInfo.serviceDocs(Collections.<ServiceDocView>emptyList()); packageInfo.packageDoc( CommonRenderingUtil.getDocLines(model.getDocumentationSummary(), COMMENT_LINE_LENGTH)); packageInfo.domainLayerLocation(productConfig.getDomainLayerLocation()); packageInfo.authScopes(model.getAuthScopes(productConfig)); packageInfo.fileHeader( fileHeaderTransformer.generateFileHeader( productConfig, ImportSectionView.newBuilder().build(), namer)); packageInfo.releaseLevel(productConfig.getReleaseLevel()); packageInfo.isInferredBeta(isInferredBetaVersion(productConfig.getPackageName())); return packageInfo.build(); }