use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class MarkupLanguageProviderTest method getMarkupLanguagesDuplicatedNames.
@Test
public void getMarkupLanguagesDuplicatedNames() {
MarkupLanguageProvider provider = new MarkupLanguageProvider() {
@Override
protected Set<MarkupLanguage> loadMarkupLanguages() {
return ImmutableSet.<MarkupLanguage>of(new MockMarkupLanguage("Test"), new MockMarkupLanguage("Test"));
}
};
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Language name 'Test' must not be provided more than once");
provider.getMarkupLanguages();
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class WikiTextExtensionPointReader method getMarkupLanguageForFilename.
/**
* Get a markup language for a file. A markup language is selected based on the registered languages and their
* expected file extensions.
*
* @param name
* the name of the file for which a markup language is desired
* @return the markup language, or null if no markup language is registered for the specified file name
* @see #getMarkupLanguageForFilename(String)
*/
public MarkupLanguage getMarkupLanguageForFilename(String name) {
if (languageByFileExtension == null) {
initializeMarkupLanguages();
}
int lastIndexOfDot = name.lastIndexOf('.');
String extension = lastIndexOfDot == -1 ? name : name.substring(lastIndexOfDot + 1);
Class<? extends MarkupLanguage> languageClass = languageByFileExtension.get(extension);
if (languageClass != null) {
String languageName = null;
for (Map.Entry<String, Class<? extends MarkupLanguage>> ent : languageByName.entrySet()) {
if (ent.getValue() == languageClass) {
languageName = ent.getKey();
break;
}
}
return instantiateMarkupLanguage(languageName, languageClass);
}
return null;
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage 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.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class MarkdownLanguageTest method testDiscoverable.
public void testDiscoverable() {
MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("Markdown");
assertNotNull(language);
assertTrue(language instanceof MarkdownLanguage);
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class TextileLanguageTest method testDiscoverable.
@Test
public void testDiscoverable() {
MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("Textile");
assertNotNull(language);
assertTrue(language instanceof TextileLanguage);
}
Aggregations