Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // WikiArticle_MakerAppDelegate.m
- // WikiArticle Maker
- //
- // Created by Adrien Bertrand on 08/07/11.
- // Copyright 2011 __MyCompanyName__. All rights reserved.
- //
- #import "WikiArticle_MakerAppDelegate.h"
- @implementation WikiArticle_MakerAppDelegate
- @synthesize window, title, partof, sinceversion, description, arg1name, arg1type, arg1desc, arg2name, arg2type, arg2desc, arg3name, arg3type, arg3desc, arg4name, arg4type, arg4desc, example, link1, link2, link3, link4, categ1, categ2, resultat, copyButton, resetButton;
- - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
- {
- pasteBoard = [NSPasteboard generalPasteboard];
- }
- - (IBAction) copy:(id)sender {
- [self writeToPasteBoard:[[resultat textStorage] string]];
- }
- - (BOOL) writeToPasteBoard:(NSString *)stringToWrite
- {
- [pasteBoard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
- return [pasteBoard setString:stringToWrite forType:NSStringPboardType];
- }
- - (IBAction) reset:(id)sender {
- NSLog(@"not yet implemented");
- }
- - (IBAction) combine:(id)sender {
- NSString *finalString;
- NSString *arguments;
- NSString *argDesc;
- NSString *table;
- argDesc = @"";
- if ([[arg1name stringValue] length] != 0)
- argDesc = [NSString stringWithFormat:@"\n| <u><center>%@</center></u> || %@ || %@ \n|-", [arg1name stringValue], [arg1type stringValue], [arg1desc stringValue]];
- if ([[arg2name stringValue] length] != 0)
- argDesc = [NSString stringWithFormat:@"%@\n| <u><center>%@</center></u> || %@ || %@ \n|-", argDesc, [arg2name stringValue], [arg2type stringValue], [arg2desc stringValue]];
- if ([[arg3name stringValue] length] != 0)
- argDesc = [NSString stringWithFormat:@"%@\n| <u><center>%@</center></u> || %@ || %@ \n|-", argDesc, [arg3name stringValue], [arg3type stringValue], [arg3desc stringValue]];
- if ([[arg4name stringValue] length] != 0)
- argDesc = [NSString stringWithFormat:@"%@\n| <u><center>%@</center></u> || %@ || %@ \n|-", argDesc, [arg4name stringValue], [arg4type stringValue], [arg4desc stringValue]];
- arguments = [NSString stringWithFormat:@"%@, %@, %@, %@",[arg1name stringValue], [arg2name stringValue], [arg3name stringValue], [arg4name stringValue]];
- if ([argDesc length] == 0) {
- arguments = @"";
- table = @"";
- } else {
- table = [NSString stringWithFormat:@"{| class=\"wikitable\"\n|-\n! Parameter !! Type !! Description\n|-%@\n|}\n",argDesc];
- }
- finalString = [NSString stringWithFormat:@"'''%@''' is a function that is part of [[:Category:%@|%@]].\n\n%@\n\n<br /> {{Since|%@}}\n\n==Syntax==\n%@:'''%@'''(%@)\n\n%@\n== Example == \n<syntaxhighlight>%@</syntaxhighlight>\n\n<br /><br />\n[[Category:%@]]\n[[Category:%@]]",[title stringValue], [partof stringValue], [partof stringValue], [description stringValue], [sinceversion stringValue], [partof stringValue], [title stringValue], arguments, table, [example stringValue], [categ1 stringValue], [categ2 stringValue]];
- [resultat setString:finalString];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement