Skip to content

Commit

Permalink
[sipify] also create links in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Dec 19, 2017
1 parent 336995d commit db8a7c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/sipify.pl
Expand Up @@ -146,6 +146,7 @@ sub processDoxygenLine {
if ( $line =~ m/\\since .*?([\d\.]+)/i ) {
return "\n.. versionadded:: $1\n";
}
# create links in see also
if ( $line =~ m/\\see +(\w+(\.\w+)*(\(\))?)/ ) {
my $seealso = $1;
if ( $seealso =~ m/^Qgs[A-Z]\w+$/ ) {
Expand All @@ -161,6 +162,9 @@ sub processDoxygenLine {
return "\n.. seealso:: $seealso\n";
}
}
# create links in plain text too (less performant)
$line =~ s/\b(Qgs[A-Z]\w+)\b(\.?$|[^\w]{2})/:py:class:`$1`$2/g;
$line =~ s/\b(Qgs[A-Z]\w+\.[a-z]\w+\(\))(\.|\b|$)/:py:func:`$1`/g;
if ( $line =~ m/[\\@]note (.*)/ ) {
return "\n.. note::\n\n $1\n";
}
Expand Down

0 comments on commit db8a7c6

Please sign in to comment.