-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from jelovirt/feature/tight-list-task
Fix task lists that use tight lists
- Loading branch information
Showing
9 changed files
with
114 additions
and
8 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/com/elovirta/dita/markdown/CleanerFilter.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.elovirta.dita.markdown; | ||
|
||
import static com.elovirta.dita.markdown.renderer.TopicRenderer.TIGHT_LIST_P; | ||
|
||
import java.util.ArrayDeque; | ||
import java.util.Deque; | ||
import org.xml.sax.Attributes; | ||
import org.xml.sax.SAXException; | ||
import org.xml.sax.helpers.XMLFilterImpl; | ||
|
||
public class CleanerFilter extends XMLFilterImpl { | ||
|
||
private Deque<Boolean> retainElementStack = new ArrayDeque<>(); | ||
|
||
@Override | ||
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { | ||
boolean retain = !localName.equals(TIGHT_LIST_P); | ||
retainElementStack.push(retain); | ||
if (retain) { | ||
getContentHandler().startElement(uri, localName, qName, atts); | ||
} | ||
} | ||
|
||
@Override | ||
public void endElement(String uri, String localName, String qName) throws SAXException { | ||
if (retainElementStack.pop()) { | ||
getContentHandler().endElement(uri, localName, qName); | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<task xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" | ||
ditaarch:DITAArchVersion="2.0" | ||
specializations="@props/audience @props/deliveryTarget @props/otherprops @props/platform @props/product" | ||
class="- topic/topic task/task " id="task"> | ||
<title class="- topic/title ">Task </title> | ||
<taskbody class="- topic/body task/taskbody "> | ||
<steps class="- topic/ol task/steps "> | ||
<step class="- topic/li task/step "> | ||
<cmd class="- topic/ph task/cmd ">Command</cmd> | ||
</step> | ||
<step class="- topic/li task/step "> | ||
<cmd class="- topic/ph task/cmd ">Command</cmd> | ||
</step> | ||
</steps> | ||
</taskbody> | ||
</task> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Task {.task} | ||
|
||
1. Command | ||
1. Command |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<topic xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" | ||
class="- topic/topic " ditaarch:DITAArchVersion="2.0" | ||
specializations="(topic hi-d)(topic em-d)" | ||
id="task-task"> | ||
<title class="- topic/title ">Task {.task}</title> | ||
<body class="- topic/body "> | ||
<ol class="- topic/ol "> | ||
<li class="- topic/li "> | ||
<p class="- topic/p ">Command</p> | ||
</li> | ||
<li class="- topic/li "> | ||
<p class="- topic/p ">Command</p> | ||
</li> | ||
</ol> | ||
</body> | ||
</topic> |