Search in sources :

Example 1 with TagEscapeTextilePhraseModifier

use of org.eclipse.mylyn.wikitext.textile.internal.phrase.TagEscapeTextilePhraseModifier in project mylyn.docs by eclipse.

the class TextileLanguage method addStandardPhraseModifiers.

@Override
protected void addStandardPhraseModifiers(PatternBasedSyntax phraseModifierSyntax) {
    boolean escapingHtml = configuration == null ? false : configuration.isEscapingHtmlAndXml();
    phraseModifierSyntax.add(new TagEscapeTextilePhraseModifier());
    phraseModifierSyntax.add(new HtmlEndTagPhraseModifier(escapingHtml));
    phraseModifierSyntax.add(new HtmlStartTagPhraseModifier(escapingHtml));
    // $NON-NLS-1$
    phraseModifierSyntax.beginGroup("(?:(?<=[\\s\\.,\\\"'?!;:\\)\\(\\{\\}\\[\\]])|^)(?:", 0);
    phraseModifierSyntax.add(new EscapeTextilePhraseModifier());
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("**", SpanType.BOLD, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("??", SpanType.CITATION, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("__", SpanType.ITALIC, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("_", SpanType.EMPHASIS, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("*", SpanType.STRONG, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("+", SpanType.INSERTED, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("~", SpanType.SUBSCRIPT, Mode.NORMAL));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("^", SpanType.SUPERSCRIPT, Mode.NORMAL));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("@", SpanType.CODE, Mode.SPECIAL));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("%", SpanType.SPAN, Mode.NESTING));
    // $NON-NLS-1$
    phraseModifierSyntax.add(new SimpleTextilePhraseModifier("-", SpanType.DELETED, Mode.NESTING));
    phraseModifierSyntax.add(new ImageTextilePhraseModifier());
    // hyperlinks are actually a phrase modifier see bug 283093
    phraseModifierSyntax.add(new HyperlinkPhraseModifier());
    // $NON-NLS-1$
    phraseModifierSyntax.endGroup(")(?=\\W|$)", 0);
}
Also used : TagEscapeTextilePhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.TagEscapeTextilePhraseModifier) TagEscapeTextilePhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.TagEscapeTextilePhraseModifier) EscapeTextilePhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.EscapeTextilePhraseModifier) HyperlinkPhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.HyperlinkPhraseModifier) HtmlEndTagPhraseModifier(org.eclipse.mylyn.wikitext.parser.markup.phrase.HtmlEndTagPhraseModifier) SimpleTextilePhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.SimpleTextilePhraseModifier) HtmlStartTagPhraseModifier(org.eclipse.mylyn.wikitext.parser.markup.phrase.HtmlStartTagPhraseModifier) ImageTextilePhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.ImageTextilePhraseModifier)

Example 2 with TagEscapeTextilePhraseModifier

use of org.eclipse.mylyn.wikitext.textile.internal.phrase.TagEscapeTextilePhraseModifier in project mylyn.docs by eclipse.

the class TagEscapeTextilePhraseModifierTest method assertMatch.

private void assertMatch(int offset, String content, String markup) {
    String regex = new TagEscapeTextilePhraseModifier().getPattern(0);
    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(markup);
    assertTrue(matcher.find());
    assertEquals(offset, matcher.start());
    assertEquals(content, matcher.group(1));
}
Also used : TagEscapeTextilePhraseModifier(org.eclipse.mylyn.wikitext.textile.internal.phrase.TagEscapeTextilePhraseModifier) Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher)

Aggregations

TagEscapeTextilePhraseModifier (org.eclipse.mylyn.wikitext.textile.internal.phrase.TagEscapeTextilePhraseModifier)2 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 HtmlEndTagPhraseModifier (org.eclipse.mylyn.wikitext.parser.markup.phrase.HtmlEndTagPhraseModifier)1 HtmlStartTagPhraseModifier (org.eclipse.mylyn.wikitext.parser.markup.phrase.HtmlStartTagPhraseModifier)1 EscapeTextilePhraseModifier (org.eclipse.mylyn.wikitext.textile.internal.phrase.EscapeTextilePhraseModifier)1 HyperlinkPhraseModifier (org.eclipse.mylyn.wikitext.textile.internal.phrase.HyperlinkPhraseModifier)1 ImageTextilePhraseModifier (org.eclipse.mylyn.wikitext.textile.internal.phrase.ImageTextilePhraseModifier)1 SimpleTextilePhraseModifier (org.eclipse.mylyn.wikitext.textile.internal.phrase.SimpleTextilePhraseModifier)1