Search in sources :

Example 1 with MarkdownLanguage

use of org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage in project mylyn.docs by eclipse.

the class MarkdownLanguageTest method testIdGenerationStrategy.

public void testIdGenerationStrategy() {
    IdGenerationStrategy strategy = new MarkdownLanguage().getIdGenerationStrategy();
    assertNotNull(strategy);
    assertEquals(GfmIdGenerationStrategy.class, strategy.getClass());
}
Also used : MarkdownLanguage(org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage) GfmIdGenerationStrategy(org.eclipse.mylyn.wikitext.markdown.internal.GfmIdGenerationStrategy) IdGenerationStrategy(org.eclipse.mylyn.wikitext.parser.markup.IdGenerationStrategy)

Example 2 with MarkdownLanguage

use of org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage in project mylyn.docs by eclipse.

the class LinkDefinitionValidationRule method findProblems.

@Override
public List<ValidationProblem> findProblems(String markup, int offset, int length) {
    MarkupParser parser = new MarkupParser(new MarkdownLanguage());
    MarkdownContentStateDocumentBuilder builder = new MarkdownContentStateDocumentBuilder();
    parser.setBuilder(builder);
    parser.parse(markup);
    MarkdownContentState markdownContentState = builder.markdownContentState;
    LinkDefinitionUsageTracker linkDefinitionUsageTracker = markdownContentState.getLinkDefinitionUsageTracker();
    List<ValidationProblem> problems = new ArrayList<ValidationProblem>();
    List<Position> missingLinkDefinitionPositions = linkDefinitionUsageTracker.getMissingLinkDefinitionPositions();
    for (Position position : missingLinkDefinitionPositions) {
        problems.add(new ValidationProblem(Severity.ERROR, MessageFormat.format(// $NON-NLS-1$
        Messages.getString("LinkDefinitionValidationRule.missing"), position.getId()), position.getOffset(), position.getLength()));
    }
    List<Position> unusedLinkDefinitionPositions = linkDefinitionUsageTracker.getUnusedLinkDefinitionPositions();
    for (Position position : unusedLinkDefinitionPositions) {
        problems.add(new ValidationProblem(Severity.WARNING, MessageFormat.format(// $NON-NLS-1$
        Messages.getString("LinkDefinitionValidationRule.unused"), position.getId()), position.getOffset(), position.getLength()));
    }
    return problems;
}
Also used : LinkDefinitionUsageTracker(org.eclipse.mylyn.wikitext.markdown.internal.LinkDefinitionUsageTracker) Position(org.eclipse.mylyn.wikitext.markdown.internal.LinkDefinitionUsageTracker.Position) MarkdownLanguage(org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage) ArrayList(java.util.ArrayList) ValidationProblem(org.eclipse.mylyn.wikitext.validation.ValidationProblem) MarkdownContentState(org.eclipse.mylyn.wikitext.markdown.internal.MarkdownContentState) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 3 with MarkdownLanguage

use of org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage in project mylyn.docs by eclipse.

the class MarkdownLanguageTestBase method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    parser = new MarkupParser(new MarkdownLanguage());
}
Also used : MarkdownLanguage(org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 4 with MarkdownLanguage

use of org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage 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);
}
Also used : MarkdownLanguage(org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage) AbstractMarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.AbstractMarkupLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)

Example 5 with MarkdownLanguage

use of org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage in project mylyn.docs by eclipse.

the class MarkdownLanguageTest method testCreateDocumentBuilder.

public void testCreateDocumentBuilder() {
    AbstractMarkupLanguage lang = new MarkdownLanguage();
    DocumentBuilder builder = lang.createDocumentBuilder(new StringWriter());
    assertNotNull(builder);
    assertTrue(builder instanceof MarkdownDocumentBuilder);
}
Also used : MarkdownDocumentBuilder(org.eclipse.mylyn.wikitext.markdown.internal.MarkdownDocumentBuilder) StringWriter(java.io.StringWriter) DocumentBuilder(org.eclipse.mylyn.wikitext.parser.DocumentBuilder) MarkdownDocumentBuilder(org.eclipse.mylyn.wikitext.markdown.internal.MarkdownDocumentBuilder) MarkdownLanguage(org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage) AbstractMarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.AbstractMarkupLanguage)

Aggregations

MarkdownLanguage (org.eclipse.mylyn.wikitext.markdown.MarkdownLanguage)5 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)2 AbstractMarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.AbstractMarkupLanguage)2 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 GfmIdGenerationStrategy (org.eclipse.mylyn.wikitext.markdown.internal.GfmIdGenerationStrategy)1 LinkDefinitionUsageTracker (org.eclipse.mylyn.wikitext.markdown.internal.LinkDefinitionUsageTracker)1 Position (org.eclipse.mylyn.wikitext.markdown.internal.LinkDefinitionUsageTracker.Position)1 MarkdownContentState (org.eclipse.mylyn.wikitext.markdown.internal.MarkdownContentState)1 MarkdownDocumentBuilder (org.eclipse.mylyn.wikitext.markdown.internal.MarkdownDocumentBuilder)1 DocumentBuilder (org.eclipse.mylyn.wikitext.parser.DocumentBuilder)1 IdGenerationStrategy (org.eclipse.mylyn.wikitext.parser.markup.IdGenerationStrategy)1 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)1 ValidationProblem (org.eclipse.mylyn.wikitext.validation.ValidationProblem)1