String mdText =
"# Markdown Sample\n" +
"\n" +
"##### First section\n" +
"Some content inside *first section*.\n" +
"";
Exception ex = new Exception();
try {
XMLReader reader = new MarkdownReader();
InputSource is = new InputSource(new StringReader(mdText));
is.setSystemId("fake.md");
Source src = new SAXSource(reader, is);
StringWriter sw = new StringWriter();
Result res = new StreamResult(sw);
Transformer newTransformer = TransformerFactoryImpl.newInstance().newTransformer();
newTransformer.transform(src, res);
sw.close();
String dita = sw.toString();
fail();
} catch (Exception e) {
ex = e;
}
assertEquals("Heading level raised from 1 to 5 without intermediate heading level", ex.getMessage());
The com.elovirta.dita.markdown.MarkdownParser.convert(BasedSequence, URI) method throws a ParseException in this case and the transformer doesn't know to handle it and doesn't preserve the exception message.
Maybe the com.elovirta.dita.markdown.MarkdownReader.parse(InputSource) method should catch the ParseException and throw a SaxException instead of it.
I have the following TC:
The com.elovirta.dita.markdown.MarkdownParser.convert(BasedSequence, URI) method throws a ParseException in this case and the transformer doesn't know to handle it and doesn't preserve the exception message.
Maybe the com.elovirta.dita.markdown.MarkdownReader.parse(InputSource) method should catch the ParseException and throw a SaxException instead of it.