use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.
the class MediaWikiLanguageTest method testComputeOutline.
@Test
public void testComputeOutline() throws IOException {
OutlineParser outlineParser = new OutlineParser();
outlineParser.setMarkupLanguage(new MediaWikiLanguage());
OutlineItem outline = outlineParser.parse(readFully("sample.mediawiki"));
Set<String> topLevelLabels = new LinkedHashSet<String>();
Set<String> topLevelIds = new LinkedHashSet<String>();
List<OutlineItem> children = outline.getChildren();
for (OutlineItem item : children) {
topLevelLabels.add(item.getLabel());
topLevelIds.add(item.getId());
}
assertEquals(children.size(), topLevelIds.size());
assertEquals(children.size(), topLevelLabels.size());
assertTrue("Top-level labels: " + topLevelLabels, topLevelLabels.contains("Task-Focused UI"));
}
use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.
the class MediaWikiLanguageTest method testCloneTemplateExcludes.
@Test
public void testCloneTemplateExcludes() {
markupLanguage.setTemplateExcludes("*foo");
MediaWikiLanguage copy = (MediaWikiLanguage) markupLanguage.clone();
assertEquals(markupLanguage.getTemplateExcludes(), copy.getTemplateExcludes());
}
use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.
the class MediaWikiLanguageTest method testDiscoverable.
@Test
public void testDiscoverable() {
MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("MediaWiki");
assertNotNull(language);
assertTrue(language instanceof MediaWikiLanguage);
}
use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.
the class XslfoDocumentBuilderIntegrationTest method testforTableCellTextAlign_bug336813.
public void testforTableCellTextAlign_bug336813() {
final String markup = "{|\n" + "|- \n |'''Row heading'''\n" + "| align=\"left\" | A longer piece of text. Lorem ipsum...\n |A shorter piece of text.\n" + "|- \n |'''Row heading'''\n" + "| style=\"text-align: right;\" | A longer piece of text. Lorem ipsum... \n |A shorter piece of text.\n" + "|}";
documentBuilder.getConfiguration().setPageNumbering(true);
documentBuilder.getConfiguration().setTitle("Title");
OutlineItem op = new OutlineParser(new MediaWikiLanguage()).parse(markup);
documentBuilder.setOutline(op);
parser.setMarkupLanguage(new MediaWikiLanguage());
parser.parse(markup, true);
final String xslfo = out.toString();
// From "text-align" attribute
assertTrue(Pattern.compile("<table-cell text-align=\"left\"").matcher(xslfo).find());
// From css styling
assertTrue(Pattern.compile("<block font-size=\"10.0pt\" text-align=\"right\">").matcher(xslfo).find());
}
use of org.eclipse.mylyn.wikitext.mediawiki.MediaWikiLanguage in project mylyn.docs by eclipse.
the class XslfoDocumentBuilderIntegrationTest method testforTableCellAlign_bug336813.
public void testforTableCellAlign_bug336813() {
final String markup = "{|\n" + "|- \n |'''Row heading'''\n" + "| valign=\"top\" | A longer piece of text. Lorem ipsum...\n |A shorter piece of text.\n" + "|- \n |'''Row heading'''\n" + "| style=\"vertical-align: bottom;\" | A longer piece of text. Lorem ipsum... \n |A shorter piece of text.\n" + "|}";
documentBuilder.getConfiguration().setPageNumbering(true);
documentBuilder.getConfiguration().setTitle("Title");
OutlineItem op = new OutlineParser(new MediaWikiLanguage()).parse(markup);
documentBuilder.setOutline(op);
parser.setMarkupLanguage(new MediaWikiLanguage());
parser.parse(markup, true);
final String xslfo = out.toString();
// From "valign" attribute
assertTrue(Pattern.compile("<table-cell display-align=\"before\"").matcher(xslfo).find());
// From css styling
assertTrue(Pattern.compile("<block font-size=\"10.0pt\" display-align=\"after\">").matcher(xslfo).find());
}
Aggregations