use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class ConfluenceLanguageTest method testNote2.
@Test
public void testNote2() {
StringWriter out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out);
builder.setUseInlineStyles(false);
parser.setBuilder(builder);
parser.parse("{note}this is a note {note}\n\n* one thing\n* two things");
String html = out.toString();
assertTrue(html.contains("<body><div class=\"note\"><p>this is a note </p></div><ul><li>one thing</li><li>two things</li></ul></body>"));
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class MarkupToEclipseHelpMojo method processMarkup.
protected void processMarkup(File sourceFile, String relativePath, MarkupLanguage markupLanguage) {
getLog().info(format("Processing markup file: {0}", sourceFile));
String name = sourceFile.getName();
if (name.lastIndexOf('.') != -1) {
name = name.substring(0, name.lastIndexOf('.'));
}
File htmlOutputFile = computeHtmlFile(relativePath, name);
if (!htmlOutputFile.exists() || htmlOutputFile.lastModified() < sourceFile.lastModified()) {
String markupContent = readFully(sourceFile);
if (!htmlOutputFile.getParentFile().exists()) {
if (!htmlOutputFile.getParentFile().mkdirs()) {
throw new BuildFailureException(format("Cannot create folder {0}", htmlOutputFile.getParentFile()));
}
}
Writer writer = createWriter(htmlOutputFile);
try {
HtmlDocumentBuilder builder = createRootBuilder(writer, name, relativePath);
SplittingStrategy splittingStrategy = createSplittingStrategy();
SplittingOutlineParser outlineParser = createOutlineParser(markupLanguage, splittingStrategy);
SplitOutlineItem rootTocItem = outlineParser.parse(markupContent);
rootTocItem.setSplitTarget(htmlOutputFile.getName());
SplittingHtmlDocumentBuilder splittingBuilder = createSplittingBuilder(builder, rootTocItem, htmlOutputFile, relativePath);
MarkupParser parser = new MarkupParser();
parser.setMarkupLanguage(markupLanguage);
parser.setBuilder(splittingBuilder);
parser.parse(markupContent);
createEclipseHelpToc(rootTocItem, sourceFile, relativePath, htmlOutputFile, name);
} finally {
close(writer, htmlOutputFile);
}
}
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class SubstitutionBlockStrategyTest method before.
@Before
public void before() {
writer = new StringWriter();
builder = new HtmlDocumentBuilder(writer);
builder.setEmitAsDocument(false);
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class HtmlLanguageTest method assertProcessContent.
protected void assertProcessContent(String expectedHtml, String sourceHtml, boolean asDocument, boolean parseCleansHtml) {
Writer out = new StringWriter();
HtmlDocumentBuilder builder = new HtmlDocumentBuilder(out);
HtmlLanguage language = new HtmlLanguage();
language.setParseCleansHtml(parseCleansHtml);
MarkupParser markupParser = new MarkupParser(language, builder);
markupParser.parse(sourceHtml, asDocument);
assertEquals(expectedHtml, out.toString());
}
use of org.eclipse.mylyn.wikitext.parser.builder.HtmlDocumentBuilder in project mylyn.docs by eclipse.
the class HtmlLanguageTest method newDocumentBuilder.
@Test
public void newDocumentBuilder() {
Writer out = new StringWriter();
DocumentBuilder builder = new HtmlLanguage().createDocumentBuilder(out);
assertNotNull(builder);
assertTrue(builder instanceof HtmlDocumentBuilder);
}
Aggregations