Skip to content

Commit 2009d4c

Browse files
committed
remove extra spaces
1 parent 199055e commit 2009d4c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

scripts/sipify.pl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,24 @@ sub write_header_footer {
119119

120120
sub processDoxygenLine {
121121
my $line = $_[0];
122+
# remove prepending spaces
123+
$line =~ s/^\s+//g;
122124
# remove \a formatting
123125
$line =~ s/\\a (.+?)\b/``$1``/g;
124126
# replace :: with . (changes c++ style namespace/class directives to Python style)
125127
$line =~ s/::/./g;
126128
# replace nullptr with None (nullptr means nothing to Python devs)
127129
$line =~ s/\bnullptr\b/None/g;
128130
# replace \returns with :return:
129-
$line =~ s/\\return(s)?/\n :return:/;
131+
$line =~ s/\s*\\return(s)?/\n:return:/;
130132

131133
if ( $line =~ m/\\param / ){
132134
if ( $COMMENT_PARAM_LIST == 0 )
133135
{
134136
$line = "\n$line";
135137
}
136138
$COMMENT_PARAM_LIST = 1;
137-
$line =~ s/\\param (\w+)\b/ :param $1:/g;
139+
$line =~ s/\s*\\param (\w+)\b/:param $1:/g;
138140
}
139141

140142

@@ -951,19 +953,19 @@ sub detect_comment_block{
951953
foreach my $comment_line (@comment_lines) {
952954
if ( $RETURN_TYPE ne '' && $comment_line =~ m/^\s*\.\. \w/ ){
953955
# return type must be added before any other paragraph-level markup
954-
write_output("CM5", " :rtype: $RETURN_TYPE\n\n");
956+
write_output("CM5", ":rtype: $RETURN_TYPE\n\n");
955957
$RETURN_TYPE = '';
956958
}
957959
write_output("CM2", "$comment_line\n");
958960
if ( $RETURN_TYPE ne '' && $comment_line =~ m/:return:/ ){
959961
# return type must be added before any other paragraph-level markup
960-
write_output("CM5", " :rtype: $RETURN_TYPE\n\n");
962+
write_output("CM5", ":rtype: $RETURN_TYPE\n\n");
961963
$RETURN_TYPE = '';
962964
}
963965
}
964966
}
965967
if ( $RETURN_TYPE ne '' ){
966-
write_output("CM3", "\n :rtype: $RETURN_TYPE\n");
968+
write_output("CM3", "\n:rtype: $RETURN_TYPE\n");
967969
}
968970
write_output("CM4", "%End\n");
969971
}

0 commit comments

Comments
 (0)