Plugin Interface
RWAbstractPlugin.h
RapidWeaver Plugin Development Kit
Please refer to the actual framework (RWPluginUtilities.framework) for the most up-to-date source.
Plugin Class
// Note: Your plugin's -initWithCoder: method will be run on a background
// thread, not the main thread. If you are seeing mysterious problems, use
// the -performSelectorOnMainThread:withObject:waitUntilDone: method inside
// the -initWithCoder: method to perform your initialisation on the main
// thread instead.
+ (BOOL)initializeClass:(NSBundle *)theBundle;
// This method is called when the plugin is loaded, and the plugin's bundle is passed as an argument. If initialization fails, return NO, and if it goes alright, return YES.
+ (NSEnumerator *)pluginsAvailable;
// This should return an NSEnumerator of all the plugins available, initialized and ready for use.
User Interface / Editing Front
+ (NSString *)pluginName;
// This should return the name of the plugin to appear in RapidWeaver's graphical user interface. This name should describe what the plugin does, if possible. For example, if you were making a plugin to maintain a blog, Blog, Journal, or Weblog would all make good plugin names.
+ (NSString *)pluginAuthor;
// The person and/or company responsible for writing the plugin.
+ (NSImage *)pluginIcon;
// The plugin's 32 by 32 icon image for use in RapidWeaver's source list.
+ (NSString *)pluginDescription;
// This should return a human-readable description of what the plugin does.
+ (BOOL)hasHTMLDescription;
// This should return YES if you provide an HTML description for your plugin (rather than an NSString*)
- (NSWindow *)documentWindow;
// Should return stored document window from setDocumentWindow:(NSWindow *)window.
- (void)setDocumentWindow:(NSWindow *)documentWindow;
// RapidWeaver will call this when it loads or shows your plugin's interface. It's so that your plugin can have access to the document window for sheets and the like.
- (NSString *)uniqueID;
// Should return a unique page ID from setUniqueID:(NSString *)uniqueID.
- (void)setUniqueID:(NSString *)uniqueID;
// RapidWeaver will call this when it creates a new page. The unique ID is currently used in the styled plugin.
- (NSView *)userInteractionAndEditingView;
// This should return the view to be shown inside RapidWeaver for editing the attributes and content associated with your plugin. For example, for a blog plugin, this would be a view showing a table view of blog entries and text views for editing each entry.
- (NSView *)optionsAndConfigurationView;
// This should return the view that will appear in the Page Inspector's Page Settings tab
Theme Specific Options
- (id)valueForThemeSpecificOptionKey:(NSString *)key;
// This method should return the stored value for a given theme-specific option key. See below for further information on these values and their use.
- (void)setValue:(id)value forThemeSpecificOptionKey:(NSString *)key;
// This method is called by RapidWeaver if your plugin has any theme-specific options available. These options are for customizing your plugin's output content-wise from theme to theme. For example, if you made a photo album plugin, this concept makes it possible for different themes to use custom picture frame graphics for the same plugin. The custom picture frame graphic would be specified in the theme's file format, where it might acknowledge certain plugins and specify options for them. If you have theme options, and your plugin does not get any input from the theme on how it should look, you should have defaults ready for use.
Plugin Output
+ (NSArray *)extraFilesNeededInExportFolder:(NSDictionary*)parameters;
// This method has the same use as its instance counterpart below, except this class version should be used for copying files specific to the plugin itself, rather than the plugin instance. For example, the - (NSArray *)extraFilesNeededInExportFolder should return the user's photos, and + (NSArray *)extraFilesNeededInExportFolder should return a picture frame graphic.
- (NSArray *)extraFilesNeededInExportFolder:(NSDictionary*)parameters;
// This should return an NSArray of NSString file paths if your plugin needs any files (such as images, audio, style sheets, and others) copied into the export folder when the user exports a site for publishing. The files should be located in some sort of temporary directory. Pass an array with no objects if you don't need any extra files copied.
- (NSString *)contentHTML:(NSDictionary*)parameters;
// This should return all HTML code resulting from user-interaction. The code should be suitable to be placed inside RapidWeaver's content area.
- (NSString *)sidebarHTML:(NSDictionary*)parameters;
// This should return all HTML code generated by the plugin. The code should be suitable to be placed inside RapidWeaver's sidebar area.
- (NSString *)pageContentPrefix:(NSDictionary*)parameters;
// This method should return a string, which will be placed before the HTML DOCTYPE header on the page. This method is optional; if you don't define it, no extra content will be placed before the DOCTYPE header.
- (void)cancelExport;
// Sent from RapidWeaver to inform the plugin to gracefully cancel
Plugin Settings
// return a dirctionary describing the plugin and its exportable settings - (NSDictionary*)pluginSettings; // apply the settings as returned from -pluginSettings to this plugin - (void)setPluginSettings:(NSDictionary*)settings; // return YES if this plugin will accept 'settings' - (BOOL)acceptsPluginSettings:(NSDictionary*)settings; // return YES if this plugin can provide settings (default is NO) - (BOOL)providesPluginSettings;
