@Test public void testSplitInLi() { Document doc = Jsoup.parseBodyFragment("<li>This is <br />some text</li>"); m.manipulate(doc); assertEquals(doc.body().select("li > p").size(), 2); }
@Override public void manipulate(Document document) { Set<Element> elementsWithBr = new HashSet<>(); document.select("br").forEach(e -> elementsWithBr.add(e.parent())); elementsWithBr.forEach( e -> { List<Element> runs = collectRuns(document, e); if (!runs.isEmpty()) { addRunsToDom(e, runs); } }); }
NewLineToNewParagraph implements ContentManipulator { @Override public void manipulate(Document document) { Set<Element> elementsWithBr = new HashSet<>(); document.select("br").forEach(e -> elementsWithBr.add(e.parent())); elementsWithBr.forEach( e -> { List<Element> runs = collectRuns(document, e); if (!runs.isEmpty()) { addRunsToDom(e, runs); } }); } }
NewLineToNewParagraph implements ContentManipulator { @Override public void manipulate(Document document) { Set<Element> elementsWithBr = new HashSet<>(); document.select("br").forEach(e -> elementsWithBr.add(e.parent())); elementsWithBr.forEach( e -> { List<Element> runs = collectRuns(document, e); if (!runs.isEmpty()) { addRunsToDom(e, runs); } }); }  }
NewLineToNewParagraph implements ContentManipulator { @Override public void manipulate(Document document) { Set<Element> elementsWithBr = new HashSet<>(); document.select("br").forEach(e -> elementsWithBr.add(e.parent())); elementsWithBr.forEach( e -> { List<Element> runs = collectRuns(document, e); if (!runs.isEmpty()) { addRunsToDom(e, runs); } }); }  @Override void manipulate(Document document); }
NewLineToNewParagraph implements ContentManipulator { @Override public void manipulate(Document document) { Set<Element> elementsWithBr = new HashSet<>(); document.select("br").forEach(e -> elementsWithBr.add(e.parent())); elementsWithBr.forEach( e -> { List<Element> runs = collectRuns(document, e); if (!runs.isEmpty()) { addRunsToDom(e, runs); } }); }  @Override void manipulate(Document document);  }