Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[sipify] format section/subsection to RST
because one should write some Perl everyday to realize how life is nicer without it
  • Loading branch information
3nids committed Jul 9, 2020
1 parent 167b718 commit ca89fdf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/sipify.pl
Expand Up @@ -185,6 +185,15 @@ sub processDoxygenLine {
# replace nullptr with None (nullptr means nothing to Python devs)
$line =~ s/\bnullptr\b/None/g;

if ( $line =~ m/^\\(?<SUB>sub)?section/) {
my $sep = "-";
$sep = "~" if defined $+{SUB};
$line =~ s/\^\\(sub)?section //;
my $sep_line = $line =~ s/[\w ()]/$sep/gr;
# Use \Q to autoescape any potentially problematic characters in your variable.
$line .= "\n".$sep_line;
}

# convert ### style headings
if ( $line =~ m/^###\s+(.*)$/) {
$line = "$1\n".('-' x length($1));
Expand Down

0 comments on commit ca89fdf

Please sign in to comment.