use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class ServiceLocator method filterDuplicates.
private Set<MarkupLanguage> filterDuplicates(Set<MarkupLanguage> markupLanguages) {
Multimap<String, Class<?>> markupLanguageClassesByName = HashMultimap.create();
ImmutableSet.Builder<MarkupLanguage> builder = ImmutableSet.builder();
for (MarkupLanguage language : markupLanguages) {
if (markupLanguageClassesByName.put(language.getName(), language.getClass())) {
builder.add(language);
}
}
return builder.build();
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class HtmlLanguageIntegrationTest method defaultMarkupLanguageHasImageSupport.
@Test
public void defaultMarkupLanguageHasImageSupport() {
MarkupLanguage sourceLanguage = getDefaultMarkupLanguage("Source HTML");
MarkupLanguage targetLanguage = getDefaultMarkupLanguage("Target HTML");
StringWriter stringWriter = new StringWriter();
MarkupParser markupParser = getMarkupParser(sourceLanguage, targetLanguage, stringWriter);
markupParser.parse("Text Before Image<img src=\"/favicon.ico\"/>Text After Image", false);
assertEquals("Text Before Image<img border=\"0\" src=\"/favicon.ico\"/>Text After Image", stringWriter.toString());
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class MarkupToEclipseHelpMojo method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
try {
ensureOutputFolderExists();
ensureSourceFolderExists();
ServiceLocator serviceLocator = ServiceLocator.getInstance(MarkupToEclipseHelpMojo.class.getClassLoader());
Set<MarkupLanguage> markupLanguages = serviceLocator.getAllMarkupLanguages();
if (markupLanguages.isEmpty()) {
throw new MojoFailureException("No markup languages are available");
}
getLog().info(format("Generating Eclipse help content from sources: {0} -> {1}", sourceFolder, outputFolder));
final FileToMarkupLanguage fileToMarkupLanguage = new FileToMarkupLanguage(markupLanguages);
SourceFileTraversal fileTraversal = new SourceFileTraversal(sourceFolder);
final AtomicInteger fileCount = new AtomicInteger();
fileTraversal.traverse(new Visitor() {
@Override
public void accept(String relativePath, File sourceFile) {
fileCount.incrementAndGet();
process(sourceFile, relativePath, fileToMarkupLanguage.get(sourceFile));
}
});
getLog().info(format("Processed {0} files", fileCount.get()));
} catch (BuildFailureException e) {
getLog().error(e.getMessage(), e);
throw new MojoFailureException(e.getMessage(), e.getCause());
}
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class FileToMarkupLanguageTest method getCaseInsensitive.
@Test
public void getCaseInsensitive() {
MarkupLanguage language1 = mockMarkupLanguage("Test");
MarkupLanguage language2 = mockMarkupLanguage("Test2");
FileToMarkupLanguage fileToMarkupLanguage = create(language1, language2);
assertSame(language1, fileToMarkupLanguage.get(mockFile("test.Test")));
assertSame(language1, fileToMarkupLanguage.get(mockFile("test.test")));
assertSame(language2, fileToMarkupLanguage.get(mockFile("test.test2")));
assertSame(language2, fileToMarkupLanguage.get(mockFile("test.tEst2")));
}
use of org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage in project mylyn.docs by eclipse.
the class CreoleLanguageTest method testDiscoverable.
public void testDiscoverable() {
MarkupLanguage language = ServiceLocator.getInstance().getMarkupLanguage("Creole");
assertNotNull(language);
assertTrue(language instanceof CreoleLanguage);
}
Aggregations