Skip to content

Commit

Permalink
remove extra spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Dec 15, 2017
1 parent 199055e commit 2009d4c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/sipify.pl
Expand Up @@ -119,22 +119,24 @@ sub write_header_footer {

sub processDoxygenLine {
my $line = $_[0];
# remove prepending spaces
$line =~ s/^\s+//g;
# remove \a formatting
$line =~ s/\\a (.+?)\b/``$1``/g;
# replace :: with . (changes c++ style namespace/class directives to Python style)
$line =~ s/::/./g;
# replace nullptr with None (nullptr means nothing to Python devs)
$line =~ s/\bnullptr\b/None/g;
# replace \returns with :return:
$line =~ s/\\return(s)?/\n :return:/;
$line =~ s/\s*\\return(s)?/\n:return:/;

if ( $line =~ m/\\param / ){
if ( $COMMENT_PARAM_LIST == 0 )
{
$line = "\n$line";
}
$COMMENT_PARAM_LIST = 1;
$line =~ s/\\param (\w+)\b/ :param $1:/g;
$line =~ s/\s*\\param (\w+)\b/:param $1:/g;
}


Expand Down Expand Up @@ -951,19 +953,19 @@ sub detect_comment_block{
foreach my $comment_line (@comment_lines) {
if ( $RETURN_TYPE ne '' && $comment_line =~ m/^\s*\.\. \w/ ){
# return type must be added before any other paragraph-level markup
write_output("CM5", " :rtype: $RETURN_TYPE\n\n");
write_output("CM5", ":rtype: $RETURN_TYPE\n\n");
$RETURN_TYPE = '';
}
write_output("CM2", "$comment_line\n");
if ( $RETURN_TYPE ne '' && $comment_line =~ m/:return:/ ){
# return type must be added before any other paragraph-level markup
write_output("CM5", " :rtype: $RETURN_TYPE\n\n");
write_output("CM5", ":rtype: $RETURN_TYPE\n\n");
$RETURN_TYPE = '';
}
}
}
if ( $RETURN_TYPE ne '' ){
write_output("CM3", "\n :rtype: $RETURN_TYPE\n");
write_output("CM3", "\n:rtype: $RETURN_TYPE\n");
}
write_output("CM4", "%End\n");
}
Expand Down

0 comments on commit 2009d4c

Please sign in to comment.