Skip to content
Permalink
Browse files

[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 ca89fdff122a0519bebc7cf1ba2aa80368ea3538
Showing with 9 additions and 0 deletions.
  1. +9 −0 scripts/sipify.pl
@@ -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));

0 comments on commit ca89fdf

Please sign in to comment.
You can’t perform that action at this time.