The title says it all. Why does code collapse from a vertical formatted structure to a horizontal unformatted structure when people reply with code? Is there anyway to view the original formatted code?
Solved! Go to Solution.
two reasons
first, people weren't using Code formatting ... the Community Version - Esri Community
to format their code
second, threads that pre-date the transition from "GeoNet" to "esri Community" were often collapsed because the pre-existing code formatting structure didn't carry forward, leaving most/many posts with their code flattened. Check the date of the pre-existing code, if it was before Nov 2020 it in all likelihood has flattened code. You can copy and recover the code, but you will have to recreate the indentation levels while parsing into lines of code.
For example, from Transect lines, parallel lines, offset lines - Esri Community
rads = np.deg2rad(bearing) dx = np.sin(rads) * dist dy = np.cos(rads) * dist # n = len(bearing) N = [N, n][n>1] # either the number of lines or bearings
has to be reformatted to read
rads = np.deg2rad(bearing)
dx = np.sin(rads) * dist
dy = np.cos(rads) * dist
#
n = len(bearing)
N = [N, n][n>1] # either the number of lines or bearings;
two reasons
first, people weren't using Code formatting ... the Community Version - Esri Community
to format their code
second, threads that pre-date the transition from "GeoNet" to "esri Community" were often collapsed because the pre-existing code formatting structure didn't carry forward, leaving most/many posts with their code flattened. Check the date of the pre-existing code, if it was before Nov 2020 it in all likelihood has flattened code. You can copy and recover the code, but you will have to recreate the indentation levels while parsing into lines of code.
For example, from Transect lines, parallel lines, offset lines - Esri Community
rads = np.deg2rad(bearing) dx = np.sin(rads) * dist dy = np.cos(rads) * dist # n = len(bearing) N = [N, n][n>1] # either the number of lines or bearings
has to be reformatted to read
rads = np.deg2rad(bearing)
dx = np.sin(rads) * dist
dy = np.cos(rads) * dist
#
n = len(bearing)
N = [N, n][n>1] # either the number of lines or bearings;
Thanks @DanPatterson. You are always very helpful.
That explains it all. Very unfortunate that happened in the transition as some code isn’t as simple to reformat as your example above.
Tell me about it... I have over 100 blog posts that got de-formatted 😉