Created
June 23, 2016 03:43
-
-
Save esivres/de91b39dd81a1f585feefe10d0e5035d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: maven-confluence-core/src/main/java/org/bsc/markdown/ToConfluenceSerializer.java | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- maven-confluence-core/src/main/java/org/bsc/markdown/ToConfluenceSerializer.java (date 1464927651000) | |
+++ maven-confluence-core/src/main/java/org/bsc/markdown/ToConfluenceSerializer.java (date 1466652636000) | |
@@ -60,6 +60,9 @@ | |
*/ | |
public abstract class ToConfluenceSerializer implements Visitor { | |
+ //list level | |
+ private int listLevel = 0; | |
+ | |
private StringBuilder _buffer = new StringBuilder( 500 * 1024 ); | |
private final java.util.Stack<Node> nodeStack = new java.util.Stack<Node>(); | |
@@ -370,7 +373,7 @@ | |
public void visit(ExpLinkNode eln) { | |
_buffer.append( '['); | |
visitChildren(eln); | |
- _buffer.append( format( "|%s|%s]", eln.url, eln.title)); | |
+ _buffer.append(format("|%s|%s]", eln.url, eln.title)); | |
} | |
@@ -390,7 +393,7 @@ | |
.append('\n') | |
.append(vn.getText()) | |
.append('\n') | |
- .append( "{noformat}") | |
+ .append("{noformat}") | |
.append('\n') | |
; | |
return; | |
@@ -400,7 +403,7 @@ | |
.append('\n') | |
.append(vn.getText()) | |
.append('\n') | |
- .append( "{code}") | |
+ .append("{code}") | |
.append('\n') | |
; | |
} | |
@@ -448,18 +451,6 @@ | |
} | |
@Override | |
- public void visit(BulletListNode bln) { | |
- | |
- _buffer.append('\n'); | |
- for (Node child : bln.getChildren()) { | |
- _buffer.append("* "); | |
- child.accept(this); | |
- _buffer.append('\n'); | |
- } | |
- _buffer.append('\n'); | |
- | |
- } | |
- @Override | |
public void visit(ListItemNode lin) { | |
visitChildren(lin); | |
} | |
@@ -645,14 +636,34 @@ | |
@Override | |
public void visit(OrderedListNode oln) { | |
+ | |
_buffer.append('\n'); | |
+ listLevel++; | |
for (Node child : oln.getChildren()) { | |
- _buffer.append("# "); | |
+ for(int i = 0 ; i < listLevel ; i++) _buffer.append('#'); | |
+ _buffer.append(' '); | |
child.accept(this); | |
_buffer.append('\n'); | |
} | |
_buffer.append('\n'); | |
+ listLevel--; | |
+ | |
} | |
+ | |
+ @Override | |
+ public void visit(BulletListNode bln) { | |
+ | |
+ _buffer.append('\n'); | |
+ listLevel++; | |
+ for (Node child : bln.getChildren()) { | |
+ _buffer.append("* "); | |
+ child.accept(this); | |
+ _buffer.append('\n'); | |
+ } | |
+ _buffer.append('\n'); | |
+ listLevel--; | |
+ } | |
+ | |
@Override | |
public void visit(QuotedNode qn) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment