See the diff output here:

http://www.davidgrant.ca/digg_43things_and_drupal_via_xml_rpc

The codefilter is removing the first space of every line, and that screws up the indentation... This is what it looks like on my site, (I used the pre tag here)

--- blogapi.module.orig 2006-07-30 00:43:52.000000000 -0400
+++ blogapi.module      2006-07-30 02:41:20.000000000 -0400
@@ -191,6 +191,7 @@
  }
  $edit = array();
+  $blogid = 'story';
  $edit['type'] = _blogapi_blogid($blogid);
  // get the node type defaults
  $node_type_default = variable_get('node_options_'. $edit['type'], array('status', 'promote'));

It looks even weirder on drupal.org (using code tag):

--- blogapi.module.orig 2006-07-30 00:43:52.000000000 -0400
+++ blogapi.module      2006-07-30 02:41:20.000000000 -0400
@@ -191,6 +191,7 @@
   }

   $edit = array();
+  $blogid = 'story';
   $edit['type'] = _blogapi_blogid($blogid);
   // get the node type defaults
   $node_type_default = variable_get('node_options_'. $edit['type'], array('status', 'promote'));

Comments

johnalbin’s picture

Status: Active » Postponed (maintainer needs more info)

Perhaps this has been fixed? Your second example looks totally fine to me.

johnalbin’s picture

Title: Removing spaces » Leading space is removed from lines of code
Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

I've now been bitten by this bug while editing Drupal documentation.

johnalbin’s picture

Specifically, the leading spaces in comments are not converted to   like the leading spaces in PHP code are.

john morahan’s picture

Status: Active » Needs review
StatusFileSize
new336 bytes

Even more specifically, codefilter appears to be converting  's to spaces. It correctly avoids doing this when two of them appear together, but does not avoid doing it when a single   appears at the beginning of a line. Witness:

There is no space at the beginning of this line.
 There is one space at the beginning of this line.
  There are two spaces at the beginning of this line.
john morahan’s picture

StatusFileSize
new393 bytes

Hmm, that didn't quite get them all.

cs8c’s picture

John Morahan - Your patch really corrected a major problem, thanks! I was about to give up on pasting code because it was just not showing up right until now, I needed to disable the filter and then re-enable it to show the changes though.

john morahan’s picture

That's to be expected, as filter output is cached; running update.php should also work.

q0rban’s picture

I've got this problem as well inside <?php tags. It's even doing it on drupal.org, as you can see below:

/**
 * This docblock gets it's leading spaces stripped.
 * Each of these lines should have one space in front.
 */

  /**
   * However, if I put more than one space in there, it works fine.
   */
deviantintegral’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

At the least, this is a problem with 6.x.

deviantintegral’s picture

StatusFileSize
new0 bytes

The patch in #5 was not working for me. Here's a patch that does two preg_replace() calls instead for clarity.

I had to test against 6.x-1.0 as 6.x-1.x was causing PHP to segfault on my MAMP installation. As well, this patch can be cherry-picked to master, but I haven't tested that either.

deviantintegral’s picture

StatusFileSize
new923 bytes

Whoops.

cameron tod’s picture

Status: Needs review » Fixed

Commited and pushed to the 6.x-1.x branch, thanks!

cameron tod’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: Unassigned » cameron tod
Status: Fixed » Needs work
Issue tags: +Needs backport to D7
cameron tod’s picture

Status: Needs work » Fixed
Issue tags: -Needs backport to D7

Happy days; this patch applied directly to the 7.x-1.x branch with no modification. Pushed, and thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.