Sonar

API : new extension point to add code colorization on new languages

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.12
  • Component/s: API
  • Labels:
    None
  • Number of attachments :
    0

Description

The new module sonar-colorizer supports Java and Groovy by default. Plugins can add support of new languages by implementing the class org.sonar.api.web.CodeColorizerFormat. Example :

public class PhpColorizerFormat extends org.sonar.api.web.CodeColorizerFormat {

  public PhpColorizerFormat() {
    super(Php.KEY);
  }

  @Override
  public List<Tokenizer> getTokenizersForHtml() {
    return Arrays.asList(
        new StringTokenizer("<span class=\"s\">", "</span>"),
        new KeywordsTokenizer("<span class=\"k\">", "</span>", PhpKeywords.get())
    );
  }
}

See the module sonar-colorizer for more details.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: