Code boxes seem to modify syntax

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Member
Joined 2007
Paid Member
Greetings,

I have noticed that the
Code:
 boxes often change what I place in them!  Not desirable!

For example, I can not correctly display this particular line of python code - neither in body text nor in a code box:
GPIO.setup("P9_11", GPIO.OUT)

It looks correct until I post, and then when I read the post it has changed and if I copy/paste, it remains incorrect.

The above GPIO.setup line should have the syntax:
GPIO.setup-leftparen-doublequote-P9_11-doublequote-comma-space-GPIO.OUT-rightparen

Do you receive it correctly?

I am using the most recent Safari in OS X 10.10.5, if that matters.

Thanks for your work...

Frank
 
Last edited:
diyAudio Moderator
Joined 2008
Paid Member
Courier new. I just checked my browser settings to confirm this because I can change it from there, but it's reasonable to assume it is the default in most browsers. It has been my preferred monospace font since it was in common use.
 
diyAudio Moderator
Joined 2008
Paid Member
Showing this font without using the code tags.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Adafruit_BBIO.GPIO as GPIO
import time
import smbus # needed if you later want to add i2c functions
# GPIO setup needed to address pins
GPIO.setup("P9_11", GPIO.OUT)
GPIo_Output("P9_11", GPIO.LOW)
GPIO.setup("P9_12", GPIO.OUT)
GPIo_Output("P9_12", GPIO.LOW)
GPIO.setup("P9_13", GPIO.OUT)
GPIo_Output("P9_13", GPIO.LOW)
rate = 0
rawrate = 0
 
Last edited:
diyAudio Moderator
Joined 2008
Paid Member
OK, I checked that twice before I left and it was OK, now I come back and it is parsed wrongly. I'm going to try it now with the -left bracket-noparse-right bracket- tags.


GPIO.setup("P9_11", GPIO.OUT)
GPIO.output("P9_11", GPIO.LOW)
GPIO.setup("P9_12", GPIO.OUT)
GPIO.output("P9_12", GPIO.LOW)
GPIO.setup("P9_13", GPIO.OUT)
GPIO.output("P9_13", GPIO.LOW)
 

Attachments

  • Untitled.png
    Untitled.png
    18.3 KB · Views: 34
Last edited:
diyAudio Moderator
Joined 2008
Paid Member
OK, I took out the spaces and it changes, taking out the parentheses on the right (first and third lines). The fifth is OK if I take out the first few characters.


GPIO.setup("P9_11",GPIO.OUT)
GPIo_Output("P9_11",GPIO.LOW)
GPIO.setup("P9_12",GPIO.OUT)
GPIo_Output("P9_12",GPIO.LOW)
O.setup("P9_13", GPIO.OUT)
GPIo_Output("P9_13",GPIO.LOW)
 
Last edited:
diyAudio Moderator
Joined 2008
Paid Member
It seems to get left alone using the special tags, I've seen this done before and until now didn't realise why

[special=GPIO.setup("P9_11", GPIO.OUT)
GPIo_Output("P9_11", GPIO.LOW)
GPIO.setup("P9_12", GPIO.OUT)
GPIo_Output("P9_12", GPIO.LOW)
GPIO.setup("P9_13", GPIO.OUT)
GPIo_Output("P9_13", GPIO.LOW)
]%[/special]
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.