Leading space is removed from lines of code
dgrant - July 30, 2006 - 06:51
| Project: | Code Filter |
| Version: | 5.x-1.x-dev |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
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'));
#1
Perhaps this has been fixed? Your second example looks totally fine to me.
#2
I've now been bitten by this bug while editing Drupal documentation.
#3
Specifically, the leading spaces in comments are not converted to like the leading spaces in PHP code are.
#4
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.
#5
Hmm, that didn't quite get them all.
#6
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.
#7
That's to be expected, as filter output is cached; running update.php should also work.
#8
I've got this problem as well inside
<?phptags. It's even doing it on drupal.org, as you can see below:<?php
/**
* 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.
*/
?>