use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class HtmlTextPresentationParserTest method testSignificantWhitespaceLossBug236367.
/**
* Test for bug# 236367
*/
@Test
public void testSignificantWhitespaceLossBug236367() throws SAXException, IOException {
String html = new MarkupParser(new TextileLanguage()).parseToHtml("one *two* three *four* five *six* seven");
parser.parse(html);
String text = parser.getText();
assertTrue(text.contains("one two three four five six seven"));
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class OutlineItemTest method testGetSectionLength.
public void testGetSectionLength() {
OutlineParser outlineParser = new OutlineParser(new TextileLanguage());
String markup = "h1. First Header\n\nh2. First Header First Child\n\nh1. Third Header\n";
OutlineItem outline = outlineParser.parse(markup);
OutlineItem firstHeader = outline.getChildren().get(0);
OutlineItem secondHeader = outline.getChildren().get(1);
OutlineItem firstHeaderFirstChild = firstHeader.getChildren().get(0);
assertEquals(markup.length(), outline.getSectionLength());
assertEquals(48, firstHeader.getSectionLength());
assertEquals(17, secondHeader.getSectionLength());
assertEquals(30, firstHeaderFirstChild.getSectionLength());
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class OutlineItemTest method testContains.
public void testContains() {
OutlineParser outlineParser = new OutlineParser(new TextileLanguage());
OutlineItem outline = outlineParser.parse("h1. First Header\n\nh2. First Header First Child\n\nh1. Third Header\n");
OutlineItem firstHeader = outline.getChildren().get(0);
OutlineItem secondHeader = outline.getChildren().get(1);
OutlineItem firstHeaderFirstChild = firstHeader.getChildren().get(0);
assertTrue(outline.contains(firstHeader));
assertTrue(outline.contains(secondHeader));
assertTrue(firstHeader.contains(firstHeader));
assertTrue(secondHeader.contains(secondHeader));
assertFalse(firstHeader.contains(secondHeader));
assertFalse(secondHeader.contains(firstHeader));
assertFalse(firstHeaderFirstChild.contains(firstHeader));
assertTrue(firstHeader.contains(firstHeaderFirstChild));
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class HtmlDocumentBuilder2Test method setUp.
@Override
public void setUp() {
parser = new MarkupParser();
parser.setMarkupLanguage(new TextileLanguage());
out = new StringWriter();
builder = new HtmlDocumentBuilder(out) {
@Override
protected void checkFileReadable(File file) {
if (!fileToUrl.containsKey(file)) {
super.checkFileReadable(file);
}
}
@Override
protected Reader getReader(File inputFile) throws FileNotFoundException {
URL url = fileToUrl.get(inputFile);
if (url != null) {
try {
return new InputStreamReader(url.openStream());
} catch (IOException e) {
throw new FileNotFoundException(String.format("%s (%s)", inputFile, url));
}
}
return super.getReader(inputFile);
}
};
parser.setBuilder(builder);
}
use of org.eclipse.mylyn.wikitext.textile.TextileLanguage in project mylyn.docs by eclipse.
the class XslfoDocumentBuilderIntegrationTest method testforXslFoLinks.
public void testforXslFoLinks() {
final String markup = "\"INTERN-LABEL\":#intern_label\n" + "\"*INTERN-BOLD-LABEL*\":#intern_bold_label\n" + "\"EXTERN-LABEL\":http://extern-label.com/\n";
documentBuilder.getConfiguration().setPageNumbering(false);
documentBuilder.getConfiguration().setTitle("Title");
parser.setMarkupLanguage(new TextileLanguage());
parser.parse(markup);
final String xslfo = out.toString();
assertTrue(xslfo.contains("<basic-link internal-destination=\"intern_label\">INTERN-LABEL</basic-link>"));
assertTrue(xslfo.contains("<basic-link internal-destination=\"intern_bold_label\"><inline font-weight=\"bold\">INTERN-BOLD-LABEL</inline></basic-link>"));
assertTrue(xslfo.contains("<basic-link external-destination=\"url(http://extern-label.com/)\">EXTERN-LABEL</basic-link>"));
}
Aggregations