@Test public void headline() { String line = "== headline"; List<AsciidocFormatBlock> result = scannerToTest.scan(line); assertNotNull(result); assertEquals(1,result.size()); AsciidocFormatBlock n = result.iterator().next(); assertEquals(AsciidocBlockType.HEADLINE, n.blockType); assertEquals("== headline", n.source.toString()); assertSourcesAddedLikeOrigin(result,line); }
public List<AsciidocFormatBlock> scan(String source) { Context context = new Context(); StringBuilder sb = new StringBuilder(); for (char c: source.toCharArray()) { if (c=='\n') { context.addLine(sb.toString(), true); sb=new StringBuilder(); continue; } sb.append(c); } if (sb.length()>0 ) { context.addLine(sb.toString(), false); } context.closeBlock(); return context.asciidocFormatBlocks; }
AsciidocBlockScanner { public List<AsciidocFormatBlock> scan(String source) { Context context = new Context(); StringBuilder sb = new StringBuilder(); for (char c: source.toCharArray()) { if (c=='\n') { context.addLine(sb.toString(), true); sb=new StringBuilder(); continue; } sb.append(c); } if (sb.length()>0 ) { context.addLine(sb.toString(), false); } context.closeBlock(); return context.asciidocFormatBlocks; } }
AsciidocBlockScanner { public List<AsciidocFormatBlock> scan(String source) { Context context = new Context(); StringBuilder sb = new StringBuilder(); for (char c: source.toCharArray()) { if (c=='\n') { context.addLine(sb.toString(), true); sb=new StringBuilder(); continue; } sb.append(c); } if (sb.length()>0 ) { context.addLine(sb.toString(), false); } context.closeBlock(); return context.asciidocFormatBlocks; }  }
AsciidocBlockScanner { public List<AsciidocFormatBlock> scan(String source) { Context context = new Context(); StringBuilder sb = new StringBuilder(); for (char c: source.toCharArray()) { if (c=='\n') { context.addLine(sb.toString(), true); sb=new StringBuilder(); continue; } sb.append(c); } if (sb.length()>0 ) { context.addLine(sb.toString(), false); } context.closeBlock(); return context.asciidocFormatBlocks; }  List<AsciidocFormatBlock> scan(String source); }
AsciidocBlockScanner { public List<AsciidocFormatBlock> scan(String source) { Context context = new Context(); StringBuilder sb = new StringBuilder(); for (char c: source.toCharArray()) { if (c=='\n') { context.addLine(sb.toString(), true); sb=new StringBuilder(); continue; } sb.append(c); } if (sb.length()>0 ) { context.addLine(sb.toString(), false); } context.closeBlock(); return context.asciidocFormatBlocks; }  List<AsciidocFormatBlock> scan(String source);  }