mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Create (and use if no -StylesheetURL is given) a default stylesheet, by copying an existing resource.
This commit is contained in:
parent
2c8528d973
commit
db0d5a15e7
5 changed files with 41 additions and 25 deletions
|
@ -1290,17 +1290,13 @@ static NSMutableSet *textNodes = nil;
|
||||||
[self decIndent];
|
[self decIndent];
|
||||||
[buf appendString: @"</title>\n"];
|
[buf appendString: @"</title>\n"];
|
||||||
|
|
||||||
/** handcrafted styles for previous in-line styles */
|
[buf appendString: @"<meta http-equiv=\"Content-Style-Type\""
|
||||||
[buf appendString: indent];
|
@" content=\"text/css\"/>\n"];
|
||||||
[buf appendString: @"<style type=\"text/css\">\n"];
|
[buf appendFormat: @"<link rel=\"stylesheet\" type=\"text/css\""
|
||||||
[buf appendString: indent];
|
@" href=\"%@\" media=\"screen\" title=\"Normal\" />\n",
|
||||||
[buf appendString: @"hr.method-separator { width:25%; margin-left:0; }\n"];
|
[[NSUserDefaults standardUserDefaults] stringForKey:
|
||||||
[buf appendString: indent];
|
@"StylesheetURL"]];
|
||||||
[buf appendString: @"</style>\n"];
|
|
||||||
#if 0
|
#if 0
|
||||||
/** Css : TODO print.css **/
|
|
||||||
[buf appendString:@"<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"/>\n"];
|
|
||||||
[buf appendString:@"<link rel=\"stylesheet\" type=\"text/css\" href=\"screen.css\" media=\"screen\" title=\"Normal\" />\n"];
|
|
||||||
/** Robots **/
|
/** Robots **/
|
||||||
[buf appendString:@"<meta name=\"robots\" content=\"all\" />\n"];
|
[buf appendString:@"<meta name=\"robots\" content=\"all\" />\n"];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#import "Foundation/NSArray.h"
|
#import "Foundation/NSArray.h"
|
||||||
#import "Foundation/NSAutoreleasePool.h"
|
#import "Foundation/NSAutoreleasePool.h"
|
||||||
|
#import "Foundation/NSBundle.h"
|
||||||
#import "Foundation/NSCharacterSet.h"
|
#import "Foundation/NSCharacterSet.h"
|
||||||
#import "Foundation/NSData.h"
|
#import "Foundation/NSData.h"
|
||||||
#import "Foundation/NSDictionary.h"
|
#import "Foundation/NSDictionary.h"
|
||||||
|
@ -301,6 +302,7 @@ static BOOL snuggleStart(NSString *t)
|
||||||
*/
|
*/
|
||||||
- (NSArray*) output: (NSMutableDictionary*)d
|
- (NSArray*) output: (NSMutableDictionary*)d
|
||||||
{
|
{
|
||||||
|
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||||
NSMutableString *str = [NSMutableString stringWithCapacity: 10240];
|
NSMutableString *str = [NSMutableString stringWithCapacity: 10240];
|
||||||
NSDictionary *classes;
|
NSDictionary *classes;
|
||||||
NSDictionary *categories;
|
NSDictionary *categories;
|
||||||
|
@ -312,6 +314,7 @@ static BOOL snuggleStart(NSString *t)
|
||||||
NSDictionary *macros;
|
NSDictionary *macros;
|
||||||
NSMutableArray *files;
|
NSMutableArray *files;
|
||||||
NSArray *authors;
|
NSArray *authors;
|
||||||
|
NSString *style = @"default-styles.css";
|
||||||
NSString *base;
|
NSString *base;
|
||||||
NSString *tmp;
|
NSString *tmp;
|
||||||
NSString *file;
|
NSString *file;
|
||||||
|
@ -328,9 +331,25 @@ static BOOL snuggleStart(NSString *t)
|
||||||
file = [file stringByAppendingPathExtension: @"gsdoc"];
|
file = [file stringByAppendingPathExtension: @"gsdoc"];
|
||||||
}
|
}
|
||||||
dest = [info objectForKey: @"directory"];
|
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"];
|
classes = [info objectForKey: @"Classes"];
|
||||||
|
@ -361,12 +380,9 @@ static BOOL snuggleStart(NSString *t)
|
||||||
tmp = [[NSUserDefaults standardUserDefaults]
|
tmp = [[NSUserDefaults standardUserDefaults]
|
||||||
stringForKey: @"StylesheetURL"];
|
stringForKey: @"StylesheetURL"];
|
||||||
}
|
}
|
||||||
if (tmp)
|
[str appendString: @" stylesheeturl=\""];
|
||||||
{
|
[str appendString: tmp];
|
||||||
[str appendString: @" stylesheeturl=\""];
|
[str appendString: @"\""];
|
||||||
[str appendString: tmp];
|
|
||||||
[str appendString: @"\""];
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp = [info objectForKey: @"up"];
|
tmp = [info objectForKey: @"up"];
|
||||||
if (tmp != nil)
|
if (tmp != nil)
|
||||||
|
@ -2370,12 +2386,10 @@ static BOOL snuggleStart(NSString *t)
|
||||||
tmp = [[NSUserDefaults standardUserDefaults]
|
tmp = [[NSUserDefaults standardUserDefaults]
|
||||||
stringForKey: @"StylesheetURL"];
|
stringForKey: @"StylesheetURL"];
|
||||||
}
|
}
|
||||||
if (tmp)
|
[str appendString: @" stylesheeturl=\""];
|
||||||
{
|
[str appendString: tmp];
|
||||||
[str appendString: @" stylesheeturl=\""];
|
[str appendString: @"\""];
|
||||||
[str appendString: tmp];
|
|
||||||
[str appendString: @"\""];
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* If a -Up default has been set, create an up link in this
|
* If a -Up default has been set, create an up link in this
|
||||||
* template file... as long as the specified up link is not
|
* template file... as long as the specified up link is not
|
||||||
|
|
|
@ -117,6 +117,10 @@ ifneq ($(HAVE_DOT), )
|
||||||
AGSHtml.m_FILE_FLAGS+= -DHAVE_DOT=$(HAVE_DOT)
|
AGSHtml.m_FILE_FLAGS+= -DHAVE_DOT=$(HAVE_DOT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
autogsdoc_HAS_RESOURCE_BUNDLE = yes
|
||||||
|
autogsdoc_RESOURCE_FILES = \
|
||||||
|
default-styles.css
|
||||||
|
|
||||||
# Reset this variable (defined in config.mak) to avoid useless linkage
|
# Reset this variable (defined in config.mak) to avoid useless linkage
|
||||||
# against the libraries gnustep-base uses.
|
# against the libraries gnustep-base uses.
|
||||||
CONFIG_SYSTEM_LIBS :=
|
CONFIG_SYSTEM_LIBS :=
|
||||||
|
|
|
@ -464,7 +464,8 @@
|
||||||
</item>
|
</item>
|
||||||
<item><strong>StylesheetURL</strong>
|
<item><strong>StylesheetURL</strong>
|
||||||
The URL of a CSS document to be used as the stadard stylesheet for
|
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.
|
||||||
</item>
|
</item>
|
||||||
<item><strong>SystemProjects</strong>
|
<item><strong>SystemProjects</strong>
|
||||||
This value is used to control the automatic inclusion of system
|
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 = [NSUserDefaults standardUserDefaults];
|
||||||
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
|
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
@"Untitled", @"Project",
|
@"Untitled", @"Project",
|
||||||
|
@"default-styles.css", @"StylesheetURL",
|
||||||
nil]];
|
nil]];
|
||||||
|
|
||||||
// BEGIN test for any unrecognized arguments, or "--help"
|
// BEGIN test for any unrecognized arguments, or "--help"
|
||||||
|
|
0
Tools/default-styles.css
Normal file
0
Tools/default-styles.css
Normal file
Loading…
Add table
Add a link
Reference in a new issue