Code snippets in post

Code can be posted using the code tag at the top of the text panel and looks like this.
[code language=”css”]
your code here
[/code]

This says put it inside a pre tag (ie pre inside <> and at end pre inside </>)
which works to a degree. Format (colours etc) set at bottom of style.css.

public class GameBoard extends View {
   public GameBoard(Context context, AttributeSet aSet) {
   super(context, aSet);
   p = new Paint();
   sprite1 = new Point(-1,-1);
   m = new Matrix();
   bm1 = BitmapFactory.decodeResource(getResources(), R.drawable.b1);
}

But I found that xml would not be displayed fully as the tags are ignored. This raises as an option a major update of a kses.php file but concludes that the simplest way – though not ideal – is to use a text editor (eg Notepad) to replace each < or > with lt or gt, preceded by an ampersand and followed by a semicolon.

Note also that seems easier to work in Text tab than in Visual: easier to get text formatting as required.

This entry was posted in Wordpress. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *