diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m
index e75f567f6..89ddb7c3d 100644
--- a/Tools/AGSHtml.m
+++ b/Tools/AGSHtml.m
@@ -1290,17 +1290,13 @@ static NSMutableSet *textNodes = nil;
[self decIndent];
[buf appendString: @"\n"];
- /** handcrafted styles for previous in-line styles */
- [buf appendString: indent];
- [buf appendString: @"\n"];
+ [buf appendString: @"\n"];
+ [buf appendFormat: @"\n",
+ [[NSUserDefaults standardUserDefaults] stringForKey:
+ @"StylesheetURL"]];
#if 0
- /** Css : TODO print.css **/
- [buf appendString:@"\n"];
- [buf appendString:@"\n"];
/** Robots **/
[buf appendString:@"\n"];
#endif
diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m
index 1e79886a5..940530798 100644
--- a/Tools/AGSOutput.m
+++ b/Tools/AGSOutput.m
@@ -24,6 +24,7 @@
#import "Foundation/NSArray.h"
#import "Foundation/NSAutoreleasePool.h"
+#import "Foundation/NSBundle.h"
#import "Foundation/NSCharacterSet.h"
#import "Foundation/NSData.h"
#import "Foundation/NSDictionary.h"
@@ -301,6 +302,7 @@ static BOOL snuggleStart(NSString *t)
*/
- (NSArray*) output: (NSMutableDictionary*)d
{
+ NSFileManager *mgr = [NSFileManager defaultManager];
NSMutableString *str = [NSMutableString stringWithCapacity: 10240];
NSDictionary *classes;
NSDictionary *categories;
@@ -312,6 +314,7 @@ static BOOL snuggleStart(NSString *t)
NSDictionary *macros;
NSMutableArray *files;
NSArray *authors;
+ NSString *style = @"default-styles.css";
NSString *base;
NSString *tmp;
NSString *file;
@@ -328,9 +331,25 @@ static BOOL snuggleStart(NSString *t)
file = [file stringByAppendingPathExtension: @"gsdoc"];
}
dest = [info objectForKey: @"directory"];
- if ([dest length] > 0 && [file isAbsolutePath] == NO)
+ if ([dest length] > 0)
{
- file = [dest stringByAppendingPathComponent: file];
+ style = [dest stringByAppendingPathComponent: style];
+ if ([file isAbsolutePath] == NO)
+ {
+ file = [dest stringByAppendingPathComponent: file];
+ }
+ }
+
+ /* When there is no local default stylesheet present, we copy the
+ * stylesheet from the main bundle.
+ */
+ if ([mgr isReadableFileAtPath: style] == NO)
+ {
+ NSBundle *bundle = [NSBundle mainBundle];
+ NSString *path;
+
+ path = [bundle pathForResource: @"default-styles" ofType: @"css"];
+ [mgr copyPath: path toPath: style handler: nil];
}
classes = [info objectForKey: @"Classes"];
@@ -361,12 +380,9 @@ static BOOL snuggleStart(NSString *t)
tmp = [[NSUserDefaults standardUserDefaults]
stringForKey: @"StylesheetURL"];
}
- if (tmp)
- {
- [str appendString: @" stylesheeturl=\""];
- [str appendString: tmp];
- [str appendString: @"\""];
- }
+ [str appendString: @" stylesheeturl=\""];
+ [str appendString: tmp];
+ [str appendString: @"\""];
tmp = [info objectForKey: @"up"];
if (tmp != nil)
@@ -2370,12 +2386,10 @@ static BOOL snuggleStart(NSString *t)
tmp = [[NSUserDefaults standardUserDefaults]
stringForKey: @"StylesheetURL"];
}
- if (tmp)
- {
- [str appendString: @" stylesheeturl=\""];
- [str appendString: tmp];
- [str appendString: @"\""];
- }
+ [str appendString: @" stylesheeturl=\""];
+ [str appendString: tmp];
+ [str appendString: @"\""];
+
/*
* If a -Up default has been set, create an up link in this
* template file... as long as the specified up link is not
diff --git a/Tools/GNUmakefile b/Tools/GNUmakefile
index 22a03f1df..ca54437e8 100644
--- a/Tools/GNUmakefile
+++ b/Tools/GNUmakefile
@@ -117,6 +117,10 @@ ifneq ($(HAVE_DOT), )
AGSHtml.m_FILE_FLAGS+= -DHAVE_DOT=$(HAVE_DOT)
endif
+autogsdoc_HAS_RESOURCE_BUNDLE = yes
+autogsdoc_RESOURCE_FILES = \
+ default-styles.css
+
# Reset this variable (defined in config.mak) to avoid useless linkage
# against the libraries gnustep-base uses.
CONFIG_SYSTEM_LIBS :=
diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m
index 954b39b9f..a89b82c6e 100644
--- a/Tools/autogsdoc.m
+++ b/Tools/autogsdoc.m
@@ -464,7 +464,8 @@
- StylesheetURL
The URL of a CSS document to be used as the stadard stylesheet for
- generated autogsdoc files.
+ generated autogsdoc files. If this is not specified the default of
+ a local document default-styles.css is used.
- SystemProjects
This value is used to control the automatic inclusion of system
@@ -751,6 +752,7 @@ main(int argc, char **argv, char **env)
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
@"Untitled", @"Project",
+ @"default-styles.css", @"StylesheetURL",
nil]];
// BEGIN test for any unrecognized arguments, or "--help"
diff --git a/Tools/default-styles.css b/Tools/default-styles.css
new file mode 100644
index 000000000..e69de29bb