Merge branch 'fix/markdown-lists' into feature/more-html-tags

This commit is contained in:
sk 2022-11-30 10:55:26 +01:00
commit 74ad40f67c
1 changed files with 2 additions and 10 deletions

View File

@ -94,12 +94,6 @@ public class HtmlParser{
ssb.append(textNode.text()); ssb.append(textNode.text());
}else if(node instanceof Element el){ }else if(node instanceof Element el){
switch(el.nodeName()){ switch(el.nodeName()){
case "p" -> {
Node sib=el.previousSibling();
// compensate for missing empty line after </ul> to match the empty
// line added by the <p> before <ul> elements
if(sib!=null && !sib.nodeName().equals("p")) ssb.append('\n');
}
case "a" -> { case "a" -> {
String href=el.attr("href"); String href=el.attr("href");
LinkSpan.Type linkType; LinkSpan.Type linkType;
@ -143,7 +137,7 @@ public class HtmlParser{
if(node instanceof Element el){ if(node instanceof Element el){
if("span".equals(el.nodeName()) && el.hasClass("ellipsis")){ if("span".equals(el.nodeName()) && el.hasClass("ellipsis")){
ssb.append("", new DeleteWhenCopiedSpan(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ssb.append("", new DeleteWhenCopiedSpan(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}else if("p".equals(el.nodeName())){ }else if("p".equals(el.nodeName()) || "ul".equals(el.nodeName()) || "ol".equals(el.nodeName())){
if(node.nextSibling()!=null) if(node.nextSibling()!=null)
ssb.append("\n\n"); ssb.append("\n\n");
}else if(!openSpans.isEmpty()){ }else if(!openSpans.isEmpty()){
@ -153,9 +147,7 @@ public class HtmlParser{
openSpans.remove(openSpans.size()-1); openSpans.remove(openSpans.size()-1);
} }
if("li".equals(el.nodeName())) { if("li".equals(el.nodeName())) {
ssb.append('\n'); if(node.nextSibling()!=null) ssb.append('\n');
Node sib=node.nextSibling();
if(sib!=null && !sib.nodeName().equals("li")) ssb.append('\n');
} }
} }
} }