@Test public void three_headlines_with_same_name_got_numbering_first_has_no_number() throws Exception { AsciiDoctorScriptModel asciidoctorScriptModel = builderToTest.build("== Headline1\nsometext\n\n== Headline1\nsometext\n\n== Headline1\nsometext\n\n"); assertThat(asciidoctorScriptModel). hasHeadlines(3). hasHeadlineWithId("_headline1"). hasHeadlineWithId("_headline1_2"). hasHeadlineWithId("_headline1_3"); }
public AsciiDoctorScriptModel build(String asciidoctorScript) throws AsciiDoctorScriptModelException { AsciiDoctorScriptModel model = new AsciiDoctorScriptModel(); Collection<AsciiDoctorHeadline> headlines = headlineParser.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> includes = INCLUDE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> images = IMAGE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> plantuml = PLANTUML_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> ditaa = DITAA_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorInlineAnchor> inlineAnchors = inlineAnchorParser.parse(asciidoctorScript); model.getHeadlines().addAll(headlines); model.getIncludes().addAll(includes); model.getInlineAnchors().addAll(inlineAnchors); model.getImages().addAll(images); model.getDiagrams().addAll(plantuml); model.getDiagrams().addAll(ditaa); handleHeadlinesWithAnchorsBefore(model); handleHeadlinesWithSameCalculatedIdsWhereNoIdSet(model); return model; }
AsciiDoctorScriptModelBuilder { public AsciiDoctorScriptModel build(String asciidoctorScript) throws AsciiDoctorScriptModelException { AsciiDoctorScriptModel model = new AsciiDoctorScriptModel(); Collection<AsciiDoctorHeadline> headlines = headlineParser.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> includes = INCLUDE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> images = IMAGE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> plantuml = PLANTUML_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> ditaa = DITAA_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorInlineAnchor> inlineAnchors = inlineAnchorParser.parse(asciidoctorScript); model.getHeadlines().addAll(headlines); model.getIncludes().addAll(includes); model.getInlineAnchors().addAll(inlineAnchors); model.getImages().addAll(images); model.getDiagrams().addAll(plantuml); model.getDiagrams().addAll(ditaa); handleHeadlinesWithAnchorsBefore(model); handleHeadlinesWithSameCalculatedIdsWhereNoIdSet(model); return model; } }
AsciiDoctorScriptModelBuilder { public AsciiDoctorScriptModel build(String asciidoctorScript) throws AsciiDoctorScriptModelException { AsciiDoctorScriptModel model = new AsciiDoctorScriptModel(); Collection<AsciiDoctorHeadline> headlines = headlineParser.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> includes = INCLUDE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> images = IMAGE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> plantuml = PLANTUML_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> ditaa = DITAA_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorInlineAnchor> inlineAnchors = inlineAnchorParser.parse(asciidoctorScript); model.getHeadlines().addAll(headlines); model.getIncludes().addAll(includes); model.getInlineAnchors().addAll(inlineAnchors); model.getImages().addAll(images); model.getDiagrams().addAll(plantuml); model.getDiagrams().addAll(ditaa); handleHeadlinesWithAnchorsBefore(model); handleHeadlinesWithSameCalculatedIdsWhereNoIdSet(model); return model; }  }
AsciiDoctorScriptModelBuilder { public AsciiDoctorScriptModel build(String asciidoctorScript) throws AsciiDoctorScriptModelException { AsciiDoctorScriptModel model = new AsciiDoctorScriptModel(); Collection<AsciiDoctorHeadline> headlines = headlineParser.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> includes = INCLUDE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> images = IMAGE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> plantuml = PLANTUML_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> ditaa = DITAA_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorInlineAnchor> inlineAnchors = inlineAnchorParser.parse(asciidoctorScript); model.getHeadlines().addAll(headlines); model.getIncludes().addAll(includes); model.getInlineAnchors().addAll(inlineAnchors); model.getImages().addAll(images); model.getDiagrams().addAll(plantuml); model.getDiagrams().addAll(ditaa); handleHeadlinesWithAnchorsBefore(model); handleHeadlinesWithSameCalculatedIdsWhereNoIdSet(model); return model; }  AsciiDoctorScriptModel build(String asciidoctorScript); }
AsciiDoctorScriptModelBuilder { public AsciiDoctorScriptModel build(String asciidoctorScript) throws AsciiDoctorScriptModelException { AsciiDoctorScriptModel model = new AsciiDoctorScriptModel(); Collection<AsciiDoctorHeadline> headlines = headlineParser.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> includes = INCLUDE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> images = IMAGE_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> plantuml = PLANTUML_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorFileReference> ditaa = DITAA_PARSER.parse(asciidoctorScript); Collection<AsciiDoctorInlineAnchor> inlineAnchors = inlineAnchorParser.parse(asciidoctorScript); model.getHeadlines().addAll(headlines); model.getIncludes().addAll(includes); model.getInlineAnchors().addAll(inlineAnchors); model.getImages().addAll(images); model.getDiagrams().addAll(plantuml); model.getDiagrams().addAll(ditaa); handleHeadlinesWithAnchorsBefore(model); handleHeadlinesWithSameCalculatedIdsWhereNoIdSet(model); return model; }  AsciiDoctorScriptModel build(String asciidoctorScript);  }