Missing Title: 285671

4719
3
04-01-2013 09:15 AM
by Anonymous User
Not applicable
Original User: curtvprice

Please try to post code in code blocks in the forums.

This is especially important with Python scripts, as indentation is part of the syntax!

Here's how:

Method 1:

(This is the method to use in the forum's "WYSIWYG mode")

1. Paste your code
2. Select your code
3. Click the "#" button in the interface

([noparse]
[/noparse]
"tags" will be inserted before and after the selection.)

Method 2:

(This method is more suited for old-school types who edit posts in "Source mode".)

1. Enter: [NOPARSE]
 
[/NOPARSE]

2. Paste your code in between [NOPARSE]
[/NOPARSE]
and [NOPARSE][/NOPARSE]

Your post (in "source mode") should look something like this:


[indent][NOPARSE]
[/NOPARSE] try:[INDENT]import arcpy[/INDENT] except: [INDENT]print "Houston, we've had a problem." raise[/INDENT] [NOPARSE]
[/NOPARSE]
[/indent]


Now, click the Preview Post button at the bottom of the page to make sure you did it right. Your code should display in a code block widget:

try:     import arcpy except:     print "We have a problem"     raise


For more details on ArcGIS forum post formatting using BB codes (including some not included as buttons in the forum's "WYSYWYG mode") with examples, visit the BB Code List page. The ArcGIS forum supports most, but not all, of these BB codes.

Thank you!
0 Kudos
3 Replies
PiotrFrankowski
New Contributor
Wouldn't be better to use pastebin.com? It provide colorize syntax. Maybe wysiwyg has a plugin to python code block?
0 Kudos
by Anonymous User
Not applicable
Original User: curtvprice

Wouldn't be better to use pastebin.com? It provide colorize syntax. Maybe wysiwyg has a plugin to python code block?


That's pretty neat. However, I hate to depend on a third-party website, like this or githhub.com's "gist" capability - if you embed from this other website, and the service goes away or changes, we get a hold in our post where the code should be.

Fortunately, I believe this forum setup is going to be replaced in mere weeks with a more modern system that can do in-line formatting a la gisstackexchange.com. Looking forward to that!
0 Kudos
WernerRunge
New Contributor
Relying on third party soluionts is not a good idea. This is what paste bin looks like from behind our firewall...


[INDENT]This Page Cannot Be Displayed
--------------------------------------------------------------------------------
Based on your corporate access policies, access to this web site ( http://pastebin.com/ ) has been blocked because the web category "Online Storage and Backup" is not allowed.
Click here to launch an IT Service Request
If you have questions, please contact the IT Service Desk on the link above and provide the codes shown below.
--------------------------------------------------------------------------------
Notification codes:
(1, WEBCAT, BLOCK-WEBCAT, 0x005dd642, 1398740334.800, AAAEKgAAAAAAAAAAlf8AEP8AAAD/AAAAAAAAAAAAAAE=, http://pastebin.com/)[/INDENT]
0 Kudos