Search in sources :

Example 1 with AcronymReplacementToken

use of org.eclipse.mylyn.wikitext.parser.markup.token.AcronymReplacementToken in project mylyn.docs by eclipse.

the class TextileLanguage method addStandardTokens.

@Override
protected void addStandardTokens(PatternBasedSyntax tokenSyntax) {
    // $NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new EntityReferenceReplacementToken("(tm)", "#8482"));
    // $NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new EntityReferenceReplacementToken("(TM)", "#8482"));
    // $NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new EntityReferenceReplacementToken("(c)", "#169"));
    // $NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new EntityReferenceReplacementToken("(C)", "#169"));
    // $NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new EntityReferenceReplacementToken("(r)", "#174"));
    // $NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new EntityReferenceReplacementToken("(R)", "#174"));
    tokenSyntax.add(new FootnoteReferenceReplacementToken());
    if (configuration == null || !configuration.isOptimizeForRepositoryUsage()) {
        ResourceBundle res = ResourceBundle.getBundle(BUNDLE_NAME, configuration == null || configuration.getLocale() == null ? Locale.ENGLISH : configuration.getLocale());
        tokenSyntax.add(new // $NON-NLS-1$//$NON-NLS-2$
        EntityWrappingReplacementToken(// $NON-NLS-1$//$NON-NLS-2$
        "\"", // $NON-NLS-1$//$NON-NLS-2$
        res.getString("quote_left"), // $NON-NLS-1$
        res.getString("quote_right")));
        tokenSyntax.add(new // $NON-NLS-1$//$NON-NLS-2$
        EntityWrappingReplacementToken(// $NON-NLS-1$//$NON-NLS-2$
        "'", // $NON-NLS-1$//$NON-NLS-2$
        res.getString("singlequote_left"), // $NON-NLS-1$
        res.getString("singlequote_right")));
        // apostrophe //$NON-NLS-1$ //$NON-NLS-2$
        tokenSyntax.add(new PatternEntityReferenceReplacementToken("(?:(?<=\\w)(')(?=\\w))", "#8217"));
    }
    // emdash //$NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new PatternEntityReferenceReplacementToken("(?:(--)(?=\\s\\w))", "#8212"));
    // endash //$NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new PatternEntityReferenceReplacementToken("(?:(?<=\\w\\s)(-)(?=\\s\\w))", "#8211"));
    // mul //$NON-NLS-1$ //$NON-NLS-2$
    tokenSyntax.add(new PatternEntityReferenceReplacementToken("(?:(?<=\\d\\s)(x)(?=\\s\\d))", "#215"));
    if (configuration == null || !configuration.isOptimizeForRepositoryUsage()) {
        tokenSyntax.add(new AcronymReplacementToken());
    }
    tokenSyntax.add(new EntityReplacementToken());
}
Also used : EntityReferenceReplacementToken(org.eclipse.mylyn.wikitext.parser.markup.token.EntityReferenceReplacementToken) PatternEntityReferenceReplacementToken(org.eclipse.mylyn.wikitext.parser.markup.token.PatternEntityReferenceReplacementToken) ResourceBundle(java.util.ResourceBundle) PatternEntityReferenceReplacementToken(org.eclipse.mylyn.wikitext.parser.markup.token.PatternEntityReferenceReplacementToken) EntityReplacementToken(org.eclipse.mylyn.wikitext.textile.internal.token.EntityReplacementToken) AcronymReplacementToken(org.eclipse.mylyn.wikitext.parser.markup.token.AcronymReplacementToken) FootnoteReferenceReplacementToken(org.eclipse.mylyn.wikitext.textile.internal.token.FootnoteReferenceReplacementToken)

Aggregations

ResourceBundle (java.util.ResourceBundle)1 AcronymReplacementToken (org.eclipse.mylyn.wikitext.parser.markup.token.AcronymReplacementToken)1 EntityReferenceReplacementToken (org.eclipse.mylyn.wikitext.parser.markup.token.EntityReferenceReplacementToken)1 PatternEntityReferenceReplacementToken (org.eclipse.mylyn.wikitext.parser.markup.token.PatternEntityReferenceReplacementToken)1 EntityReplacementToken (org.eclipse.mylyn.wikitext.textile.internal.token.EntityReplacementToken)1 FootnoteReferenceReplacementToken (org.eclipse.mylyn.wikitext.textile.internal.token.FootnoteReferenceReplacementToken)1