GenPages.pl

From CockosWiki

Jump to: navigation, search
#
# FixUp.pl
#
 
# Generate various Wiki pages and the See Also sctions from REAPER's
# ReaScript API Help Screen based on the name of the function.
 
my @pagetypes = (
    "item",
    "track",
    "take",
    "envelope",
    "time",
    "marker",
    "guid",
    "project",
    "config",
    "ini",
    "midi",
    "pitch",
    "theme",
    "fx",
    "cursor",
    "peak",
    "csurf",
    "lice",
    "oncommand",
    "show",
    "mute",
    "solo",
    "pan",
    "preview",
    "play",
    "pause",
    "stop",
    "pcm",
    "undo",
    "delete",
    "window",
    "repeat"
); my $pagetype;
 
# create all Template files
open(SATS, '>', "SeeAlsoTemplates.wiki") || die;
foreach $pagetype (sort @pagetypes){
    print SATS "{{SeeAlso_$pagetype}}\n\n";
    open($pagetype, ">$pagetype.SeeAlsoTemplate") || die "$! creating $pagetype\n";
    print $pagetype "'''$pagetype:'''\n";
}
close(SATS);
 
my $function_name;
 
my @data = sort <DATA>;
 
foreach (@data){
    chomp;                          # remove \n from end of line
    /"#/;                           # find the string '"#' in $_
    $_ = $';                        # set $_ to everything AFTER that string
    /"/;                            # find the string '"' in $_
    $_ = $`;                        # set $_ to everything BEFORE that string
    $function_name = $_;            # leaving the function name in $_
    # create the See Also WIKI section for this API function.
    open($function_name, '>', "$function_name.SeeAlsoSection");
    print $function_name "==See Also==\n";
    foreach $pagetype (@pagetypes){
         if($function_name =~ /$pagetype/i){
            # It matchess, add this function to the See Also template
            print $pagetype "[[RPR_$function_name|$function_name]],\n";
            # and the template to the function's See Also section
            print $function_name "{{SeeAlso_$pagetype}}\n\n";
        }
    }
    print $function_name "''(Section automatically generated, edits may be overwritten.)''\n";
    close($function_name);
}
 
# close all files
foreach $pagetype (@pagetypes){
    close($pagetype) || die;
}
 
#
# The data below the END marker here should be taken from REAPER's 
#  ReaScript API Help Screen. View the source, paste it here and 
#  chop off header and footer stuff. (Don't forget to delete the 
#  existing stuff here first.)
#
__END__
<td><a href="#AddMediaItemToTrack">AddMediaItemToTrack</a></td>
<td><a href="#format_timestr">format_timestr</a></td>
<td><a href="#GetTrackEnvelope">GetTrackEnvelope</a></td>
<td><a href="#plugin_getImportableProjectFilterList">plugin_getImportableProjectFilterList</a></td></tr>
.
.
.
.
<td><a href="#PlayTrackPreview2">PlayTrackPreview2</a></td>
<td><a href="#ValidatePtr">ValidatePtr</a></td></tr>
<tr><td><a href="#EnumTrackMIDIProgramNamesEx">EnumTrackMIDIProgramNamesEx</a></td>
<td><a href="#GetTrackAutomationMode">GetTrackAutomationMode</a></td>
<td><a href="#plugin_getFilterList">plugin_getFilterList</a></td>
<td><a href="#WDL_VirtualWnd_ScaledBlitBG">WDL_VirtualWnd_ScaledBlitBG</a></td></tr>
Personal tools