@Test public void shouldRenderSourceDocStringInStep() { List<Feature> features = FeatureParser.parse(featureWithSourceDocStringInStep); final Feature feature = features.get(0); CukedoctorFeatureRenderer featureRenderer = new CukedoctorFeatureRenderer(new DocumentAttributes()); String resultDoc = featureRenderer.renderFeature(feature, new CukedoctorDocumentBuilderImpl().createNestedBuilder().createNestedBuilder()); assertThat(resultDoc).isEqualTo(Expectations.FEATURE_WITH_SOURCE_DOC_STRING); }
@Override public String renderFeature(Feature feature) { CukedoctorDocumentBuilder builder = docBuilder.createPeerBuilder(); if (feature.hasIgnoreDocsTag()) { return ""; } builder.textLine(renderFeatureSectionId(feature)); builder.title(bold(feature.getName())).newLine(); if (notNull(documentAttributes) && hasText(documentAttributes.getBackend())) { String backend = documentAttributes.getBackend(); if((backend.toLowerCase().contains("html") || backend.toLowerCase().contains("all")) && !cukedoctorConfig.isDisableMinMaxExtension()) { builder.append("ifndef::backend-pdf[]").append(newLine()); builder.append("minmax::", feature.getName().replaceAll(",", "").replaceAll(" ", "-")).append("[]").newLine(); builder.append("endif::[]").append(newLine()); } } if (hasText(feature.getDescription())) { final String description = trimAllLines(feature.getDescription()).replaceAll("\\\\", ""); renderDescription(builder, description); } if(feature.hasScenarios()){ builder.append(renderFeatureScenarios(feature, builder)); } return builder.toString(); }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeature(Feature feature) { CukedoctorDocumentBuilder builder = docBuilder.createPeerBuilder(); if (feature.hasIgnoreDocsTag()) { return ""; } builder.textLine(renderFeatureSectionId(feature)); builder.title(bold(feature.getName())).newLine(); if (notNull(documentAttributes) && hasText(documentAttributes.getBackend())) { String backend = documentAttributes.getBackend(); if((backend.toLowerCase().contains("html") || backend.toLowerCase().contains("all")) && !cukedoctorConfig.isDisableMinMaxExtension()) { builder.append("ifndef::backend-pdf[]").append(newLine()); builder.append("minmax::", feature.getName().replaceAll(",", "").replaceAll(" ", "-")).append("[]").newLine(); builder.append("endif::[]").append(newLine()); } } if (hasText(feature.getDescription())) { final String description = trimAllLines(feature.getDescription()).replaceAll("\\\\", ""); renderDescription(builder, description); } if(feature.hasScenarios()){ builder.append(renderFeatureScenarios(feature, builder)); } return builder.toString(); } }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeature(Feature feature) { CukedoctorDocumentBuilder builder = docBuilder.createPeerBuilder(); if (feature.hasIgnoreDocsTag()) { return ""; } builder.textLine(renderFeatureSectionId(feature)); builder.title(bold(feature.getName())).newLine(); if (notNull(documentAttributes) && hasText(documentAttributes.getBackend())) { String backend = documentAttributes.getBackend(); if((backend.toLowerCase().contains("html") || backend.toLowerCase().contains("all")) && !cukedoctorConfig.isDisableMinMaxExtension()) { builder.append("ifndef::backend-pdf[]").append(newLine()); builder.append("minmax::", feature.getName().replaceAll(",", "").replaceAll(" ", "-")).append("[]").newLine(); builder.append("endif::[]").append(newLine()); } } if (hasText(feature.getDescription())) { final String description = trimAllLines(feature.getDescription()).replaceAll("\\\\", ""); renderDescription(builder, description); } if(feature.hasScenarios()){ builder.append(renderFeatureScenarios(feature, builder)); } return builder.toString(); } CukedoctorFeatureRenderer();  CukedoctorFeatureRenderer(DocumentAttributes documentAttributes);  CukedoctorFeatureRenderer(CukedoctorConfig cukedoctorConfig); }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeature(Feature feature) { CukedoctorDocumentBuilder builder = docBuilder.createPeerBuilder(); if (feature.hasIgnoreDocsTag()) { return ""; } builder.textLine(renderFeatureSectionId(feature)); builder.title(bold(feature.getName())).newLine(); if (notNull(documentAttributes) && hasText(documentAttributes.getBackend())) { String backend = documentAttributes.getBackend(); if((backend.toLowerCase().contains("html") || backend.toLowerCase().contains("all")) && !cukedoctorConfig.isDisableMinMaxExtension()) { builder.append("ifndef::backend-pdf[]").append(newLine()); builder.append("minmax::", feature.getName().replaceAll(",", "").replaceAll(" ", "-")).append("[]").newLine(); builder.append("endif::[]").append(newLine()); } } if (hasText(feature.getDescription())) { final String description = trimAllLines(feature.getDescription()).replaceAll("\\\\", ""); renderDescription(builder, description); } if(feature.hasScenarios()){ builder.append(renderFeatureScenarios(feature, builder)); } return builder.toString(); } CukedoctorFeatureRenderer();  CukedoctorFeatureRenderer(DocumentAttributes documentAttributes);  CukedoctorFeatureRenderer(CukedoctorConfig cukedoctorConfig); @Override String renderFeature(Feature feature); @Override String renderFeatures(List<Feature> features); }
CukedoctorFeatureRenderer extends AbstractBaseRenderer implements FeatureRenderer { @Override public String renderFeature(Feature feature) { CukedoctorDocumentBuilder builder = docBuilder.createPeerBuilder(); if (feature.hasIgnoreDocsTag()) { return ""; } builder.textLine(renderFeatureSectionId(feature)); builder.title(bold(feature.getName())).newLine(); if (notNull(documentAttributes) && hasText(documentAttributes.getBackend())) { String backend = documentAttributes.getBackend(); if((backend.toLowerCase().contains("html") || backend.toLowerCase().contains("all")) && !cukedoctorConfig.isDisableMinMaxExtension()) { builder.append("ifndef::backend-pdf[]").append(newLine()); builder.append("minmax::", feature.getName().replaceAll(",", "").replaceAll(" ", "-")).append("[]").newLine(); builder.append("endif::[]").append(newLine()); } } if (hasText(feature.getDescription())) { final String description = trimAllLines(feature.getDescription()).replaceAll("\\\\", ""); renderDescription(builder, description); } if(feature.hasScenarios()){ builder.append(renderFeatureScenarios(feature, builder)); } return builder.toString(); } CukedoctorFeatureRenderer();  CukedoctorFeatureRenderer(DocumentAttributes documentAttributes);  CukedoctorFeatureRenderer(CukedoctorConfig cukedoctorConfig); @Override String renderFeature(Feature feature); @Override String renderFeatures(List<Feature> features);  }