use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class HtmlLanguageIntegrationTest method emitImageWithoutImageSupport.
@Test
public void emitImageWithoutImageSupport() {
MarkupLanguage sourceLanguage = getDefaultMarkupLanguage("Source HTML");
MarkupLanguage targetLanguageWithNoImageSupport = getMarkupLanguageWithoutImageSupport("Target HTML With No Images");
StringWriter stringWriter = new StringWriter();
MarkupParser markupParser = getMarkupParser(sourceLanguage, targetLanguageWithNoImageSupport, stringWriter);
markupParser.parse("Text Before Image<img src=\"/favicon.ico\"/>Text After Image", false);
assertEquals("Text Before ImageText After Image", stringWriter.toString());
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class ConfluenceLanguageTest method testDiscoverable.
@Test
public void testDiscoverable() {
MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("Confluence");
assertNotNull(language);
assertTrue(language instanceof ConfluenceLanguage);
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class FileToMarkupLanguageTest method mockMarkupLanguage.
private MarkupLanguage mockMarkupLanguage(String name) {
MarkupLanguage mock = mock(MarkupLanguage.class);
doReturn(name).when(mock).getName();
doReturn(Sets.newHashSet(name)).when(mock).getFileExtensions();
return mock;
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class WikiTextTest method getMarkupLanguageForFilenameCopied.
@Test
public void getMarkupLanguageForFilenameCopied() {
MarkupLanguage markupLanguage = WikiText.getMarkupLanguageForFilename("test.textile");
assertNotSame(markupLanguage, WikiText.getMarkupLanguageForFilename("test.textile"));
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class WikiMarkupGenerationContribution method getContributionItems.
@Override
protected IContributionItem[] getContributionItems() {
Map<String, IContributionItem> items = new TreeMap<>();
for (MarkupLanguage markupLanguage : ServiceLocator.getInstance().getAllMarkupLanguages()) {
try {
// test to see if markup generation is supported
markupLanguage.createDocumentBuilder(new StringWriter());
} catch (UnsupportedOperationException e) {
// markup langage doesn't provide document builder
continue;
}
String commandId = ConvertMarkupToMarkup.COMMAND_ID;
// $NON-NLS-1$ //$NON-NLS-2$
String id = commandId + '.' + markupLanguage.getName().replaceAll("\\W", "_");
HashMap<String, String> args = new HashMap<>();
args.put(ConvertMarkupToMarkup.PARAM_MARKUP_LANGUAGE, markupLanguage.getName());
CommandContributionItemParameter parameters = new CommandContributionItemParameter(serviceLocator, id, commandId, CommandContributionItem.STYLE_PUSH);
parameters.label = NLS.bind(Messages.WikiMarkupGenerationContribution_generate_markup, markupLanguage.getName());
parameters.parameters = args;
items.put(markupLanguage.getName(), new CommandContributionItem(parameters));
}
return items.values().toArray(new IContributionItem[items.size()]);
}
Aggregations