com.atlassian.renderer.v2.macro.code
Interface SourceCodeFormatter

All Known Implementing Classes:
AbstractFormatter, ActionScriptFormatter, JavaFormatter, JavaScriptFormatter, NoneFormatter, SqlFormatter, XmlFormatter

public interface SourceCodeFormatter

Strategy for converting a block of source code into pretty-printed HTML. SourceCodeFormatters MUST be forgiving: they will be dealing with user-supplied input, so they can't afford to blow up on bad data.


Method Summary
 String format(String code, String language)
          Convert source code into HTML.
 String[] getSupportedLanguages()
          Inform the CodeMacro which languages this formatter supports.
 

Method Detail

getSupportedLanguages

String[] getSupportedLanguages()
Inform the CodeMacro which languages this formatter supports. So if someone writes {code:java}, then only the formatter that returns "java" from this method will be used to format it.

Returns:
an array of languages that this formatter supports

format

String format(String code,
              String language)
Convert source code into HTML.

Parameters:
code - the source code as a string
language - the programming language that it is believed this code is written in
Returns:
the source code formatted as HTML


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.