Merge pull request #440 from gnustep/agsdoc-html-style

Agsdoc html style update
This commit is contained in:
rfm 2024-11-08 14:48:10 +00:00 committed by GitHub
commit a8e453fe7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 512 additions and 121 deletions

View file

@ -1,3 +1,10 @@
2024-11-08 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSFileHandle.h:
* Source/GSFileHandle.m:
* Source/NSFileHandle.m:
Add -truncateAtOffset:error: method (issue 325)
2024-11-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: Fix case where positive result of asking
@ -31,9 +38,10 @@
* Source/NSDatePrivate.h:
NSDate is now a small object in slot 6, when configuring GNUstep with the
clang/libobjc2 toolchain. This is done by compressing the binary64 fp
holding the seconds since reference date (because someone at Apple thought
it would be a good idea to represent a time interval as a fp). Note that
this assumes that IEEE 754 is used.
holding the seconds since reference date (because someone at Apple
thought it would be a good idea to represent a time interval as a fp).
Note that this assumes that IEEE 754 is used.
* Source/NSCalendarDate.m:
Remove access to the NSDate private concrete Class
and implement -timeIntervalSinceReferenceDate instead.

View file

@ -99,6 +99,11 @@ GS_EXPORT_CLASS
- (void) synchronizeFile;
- (void) truncateFileAtOffset: (unsigned long long)pos;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_15, GS_API_LATEST)
- (BOOL) truncateAtOffset: (unsigned long long)offset
error: (out NSError **)error;
#endif
@end
// Notification names.

View file

@ -243,7 +243,8 @@ GCObject.h \
# directory.
#
Base_AGSDOC_FLAGS = \
-MakeFrames YES \
-MakeFrames NO \
-IndexFile Base \
-DocumentationDirectory ../Documentation/Base \
-HeaderDirectory ../Headers/Foundation \
-Declared Foundation \
@ -252,14 +253,14 @@ Base_AGSDOC_FLAGS = \
-ConstantsTemplate TypesAndConstants \
-FunctionsTemplate Functions \
-MacrosTemplate Functions \
-StylesheetURL gnustepStyle \
-TypedefsTemplate TypesAndConstants \
-VariablesTemplate TypesAndConstants \
-WordMap '{\
}' -Up Base
BaseAdditions_AGSDOC_FLAGS = \
-MakeFrames YES \
-MakeFrames NO \
-IndexFile BaseAdditions \
-DocumentationDirectory ../Documentation/BaseAdditions \
-HeaderDirectory ../Headers/GNUstepBase \
-Declared GNUstepBase \

View file

@ -1722,7 +1722,6 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{
[NSException raise: NSFileHandleOperationException
format: @"attempt to truncate invalid file"];
}
if (ftruncate(descriptor, pos) < 0)
{
@ -1732,6 +1731,21 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
[self seekToFileOffset: pos];
}
- (BOOL) truncateAtOffset: (unsigned long long)offset
error: (out NSError **)error
{
if (ftruncate((isStandardFile ? descriptor : -1), offset) < 0)
{
if (error)
{
*error = [NSError _last];
}
return NO;
}
[self seekToFileOffset: offset];
return YES;
}
- (void) writeInBackgroundAndNotify: (NSData*)item forModes: (NSArray*)modes
{
NSMutableDictionary* info;

View file

@ -467,6 +467,12 @@ static Class NSFileHandle_ssl_class = nil;
[self subclassResponsibility: _cmd];
}
- (BOOL) truncateAtOffset: (unsigned long long)offset
error: (out NSError **)error
{
[self subclassResponsibility: _cmd];
return NO;
}
@end

View file

@ -50,6 +50,7 @@
unsigned sssect;
BOOL isContentsDoc;
BOOL ivarsAtEnd;
BOOL cssNavigation;
BOOL verbose;
BOOL warn;
}
@ -61,6 +62,9 @@
- (NSString*) makeLink: (NSString*)r
ofType: (NSString*)t
isRef: (BOOL)f;
- (NSString*) makeURL: (NSString*)r
ofType: (NSString*)t
isRef: (BOOL)f;
- (NSString*) makeLink: (NSString*)r
ofType: (NSString*)t
inUnit: (NSString*)u

View file

@ -253,6 +253,7 @@ static NSMutableSet *textNodes = nil;
project = RETAIN([defs stringForKey: @"Project"]);
verbose = [defs boolForKey: @"Verbose"];
warn = [defs boolForKey: @"Warn"];
cssNavigation = [defs boolForKey: @"MakeFrames"] ? NO : YES;
}
return self;
}
@ -261,7 +262,7 @@ static NSMutableSet *textNodes = nil;
* Calls -makeLink:ofType:isRef: or -makeLink:ofType:inUnit:isRef: to
* create the first part of an anchor, and fills in the text content
* of the anchor with n (the specified name). Returns an entire anchor
* string as a result.<br />
* string as a result.<br/>
* This method is used to create all the anchors in the html output.
*/
- (NSString*) makeAnchor: (NSString*)r
@ -336,9 +337,9 @@ static NSMutableSet *textNodes = nil;
/**
* Make a link for the element r, with the specified type t,
* in a particular unit u. Only the start of
* the html element is returned (&lt;a ...&gt;).<br />
* the html element is returned (&lt;a ...&gt;).<br>
* If the boolean f is YES, then the link is a reference to somewhere,
* otherwise the link is an anchor for some element being output.<br />
* otherwise the link is an anchor for some element being output.<br>
* If there is an error, the method returns nil.
*/
- (NSString*) makeLink: (NSString*)r
@ -431,12 +432,8 @@ static NSMutableSet *textNodes = nil;
buf = [NSMutableString stringWithCapacity: 4096];
/* Declaration */
[buf appendString: @"<!DOCTYPE html PUBLIC "];
[buf appendString: @"\"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"];
[buf appendString: @"\"http://www.w3.org/TR/xhtml1/DTD/"];
[buf appendString: @"xhtml1-strict.dtd\">\n"];
[buf appendString: @"<html xmlns=\"http://www.w3.org/1999/xhtml\" "];
[buf appendString: @"xml:lang=\"en\" lang=\"en\">\n"];
[buf appendString: @"<!DOCTYPE html>\n"];
[buf appendString: @"<html lang=\"en\">\n"];
[self incIndent];
[self outputNodeList: node to: buf];
@ -447,6 +444,24 @@ static NSMutableSet *textNodes = nil;
return buf;
}
/** Output all the nodes containing xml elements from this one onwards.
* Text and entity ref nodes are ignored (to remove whitespace etc
* between elements).
*/
- (void) outputElemList: (GSXMLNode*)node to: (NSMutableString*)buf
{
while (node != nil)
{
GSXMLNode *next = [node nextElement];
if ([node type] == XML_ELEMENT_NODE)
{
[self outputNode: node to: buf];
}
node = next;
}
}
- (void) outputIndex: (NSString*)type
scope: (NSString*)scope
title: (NSString*)title
@ -459,7 +474,16 @@ static NSMutableSet *textNodes = nil;
NSArray *a;
unsigned c;
unsigned i;
BOOL isBareStyle = [@"bare" isEqualToString: style];
BOOL isBareStyle = NO;
if ([@"bare" isEqualToString: style])
{
isBareStyle = YES;
}
else if ([@"cssNavigation" isEqualToString: style])
{
isBareStyle = YES;
}
if (globalRefs != nil && [scope isEqual: @"global"] == YES)
{
@ -496,7 +520,9 @@ static NSMutableSet *textNodes = nil;
/* Put the index in a div with a class identifying its scope and type
* so that CSS can be used to style it.
*/
[buf appendFormat: @"<div class=\"%@_%@_index\">\n", scope, type];
[buf appendString: indent];
[buf appendFormat: @"<p class=\"%@_%@_index\">\n", scope, type];
[self incIndent];
if ([type isEqual: @"title"] == YES)
{
@ -505,7 +531,9 @@ static NSMutableSet *textNodes = nil;
if (!isBareStyle)
{
[buf appendString: indent];
[buf appendFormat: @"<b>%@ Index</b>\n", title];
[buf appendFormat:
@"<h3 class=\"index-section-header\">%@ Index</h3>\n",
title];
[buf appendString: indent];
[buf appendString: @"<ul>\n"];
[self incIndent];
@ -556,7 +584,7 @@ static NSMutableSet *textNodes = nil;
}
else
{
[buf appendString: @"<br/>"];
[buf appendString: @"<br>"];
}
[buf appendString: @"\n"];
}
@ -636,7 +664,8 @@ static NSMutableSet *textNodes = nil;
[buf appendString: indent];
if (!isBareStyle)
{
[buf appendFormat: @"<b>%@</b>\n", title];
[buf appendFormat:
@"<h3 class=\"index-section-header\">%@</h3>\n", title];
}
[buf appendString: indent];
if (!isBareStyle)
@ -719,7 +748,7 @@ static NSMutableSet *textNodes = nil;
}
else
{
[buf appendString: @"<br/>"];
[buf appendString: @"<br>"];
}
[buf appendString: @"\n"];
@ -733,7 +762,10 @@ static NSMutableSet *textNodes = nil;
}
[buf appendString: @"\n"];
}
[buf appendString: @"</div>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</p>\n"];
}
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
@ -765,7 +797,7 @@ static NSMutableSet *textNodes = nil;
[self outputNodeList: children to: buf];
[buf appendString: indent];
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
if (prevFile != nil)
{
[buf appendString: indent];
@ -783,18 +815,28 @@ static NSMutableSet *textNodes = nil;
}
[self decIndent];
[buf appendString: indent];
[buf appendString: indent];
if (cssNavigation)
{
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; //content-pane-body
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; //content-pane
}
if (isContentsDoc)
{
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"];
}
[buf appendString: indent];
[buf appendString: @"</body>\n"];
}
else if ([name isEqual: @"br"] == YES)
{
[buf appendString: @"<br/>"];
[buf appendString: @"<br>"];
}
else if ([name isEqual: @"category"] == YES)
{
@ -891,7 +933,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br/>\n"];
[buf appendString: @";<br>\n"];
node = firstElement(children);
@ -928,7 +970,7 @@ static NSMutableSet *textNodes = nil;
unsigned l = 0;
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr class=\"section-separator\">\n"];
[buf appendString: indent];
[buf appendString: @"<h3>Contents -</h3>\n"];
@ -1005,7 +1047,7 @@ static NSMutableSet *textNodes = nil;
l--;
}
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr class=\"section-separator\">\n"];
}
}
else if ([name isEqual: @"declared"] == YES)
@ -1204,7 +1246,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @");<br />\n"];
[buf appendString: @");<br>\n"];
node = firstElement(children);
@ -1253,7 +1295,7 @@ static NSMutableSet *textNodes = nil;
([stylesheetURL rangeOfString: @"gsdoc_contents"].length > 0))
? YES : NO;
[self outputNodeList: children to: buf];
[self outputElemList: children to: buf];
}
}
else if ([name isEqual: @"head"] == YES)
@ -1263,6 +1305,11 @@ static NSMutableSet *textNodes = nil;
[buf appendString: indent];
[buf appendString: @"<head>\n"];
[self incIndent];
/** charset/encoding should be in first 1024 bytes, so before title */
[buf appendString: indent];
[buf appendString: @"<meta charset=\"utf-8\">\n"];
children = firstElement(children);
[buf appendString: indent];
[buf appendString: @"<title>"];
@ -1271,17 +1318,13 @@ static NSMutableSet *textNodes = nil;
[self decIndent];
[buf appendString: @"</title>\n"];
/** handcrafted styles for previous in-line styles */
[buf appendString: indent];
[buf appendString: @"<style type=\"text/css\">\n"];
[buf appendString: indent];
[buf appendString: @"hr.method-separator { width:25%; margin-left:0; }\n"];
[buf appendString: indent];
[buf appendString: @"</style>\n"];
[buf appendString: @"<meta http-equiv=\"Content-Style-Type\""
@" content=\"text/css\"/>\n"];
[buf appendFormat: @"<link rel=\"stylesheet\" type=\"text/css\""
@" href=\"%@\" media=\"screen\" title=\"Normal\" />\n",
[[NSUserDefaults standardUserDefaults] stringForKey:
@"StylesheetURL"]];
#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 **/
[buf appendString:@"<meta name=\"robots\" content=\"all\" />\n"];
#endif
@ -1297,8 +1340,160 @@ static NSMutableSet *textNodes = nil;
{
[buf appendString: indent];
[buf appendString: @"<div class=\"ToC\">\n"];
[self incIndent];
}
if (cssNavigation)
{
[buf appendString: indent];
[buf appendString: @"<div class=\"content-bar\">\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<div class=\"content-bar-top\">\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<div class=\"content-bar-top-body\">\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-classes\">Classes</a><br>\n"];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-protocols\">Protocols</a><br>\n"];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-constants\">Constants</a><br>\n"];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-functions\">Functions</a><br>\n"];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-macros\">Macros</a><br>\n"];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-types\">Types</a><br>\n"];
[buf appendString: indent];
[buf appendString:
@"<a href=\"#nav-bar-variables\">Variables</a><br>\n"];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; // content-bar-top-body
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; // content-bar-top
[buf appendString: indent];
[buf appendString: @"<div class=\"content-bar-bottom\">\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<div class=\"content-bar-bottom-body\">\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString: @"<a name=\"nav-bar-classes\">Classes</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"class"
scope: @"project"
title: @"Project classes"
style: @"cssNavigation"
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString:
@"<a name=\"nav-bar-protocols\">Protocols</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"protocol"
scope: @"project"
title: @"Project protocols"
style: @"cssNavigation"
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString:
@"<a name=\"nav-bar-constants\">Constants</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"constant"
scope: @"project"
title: @"Project constants"
style: @"cssNavigation"
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString:
@"<a name=\"nav-bar-functions\">Functions</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"function"
scope: @"project"
title: @"Project functions"
style: @"cssNavigation"
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString:
@"<a name=\"nav-bar-macros\">Macros</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"macro"
scope: @"project"
title: @"Project macros"
style: @"cssNavigation"
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString: @"<a name=\"nav-bar-types\">Types</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"type"
scope: @"project"
title: @"Project types"
style: @"cssNavigation"
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<h3 class=\"content-bar-index-section-header\">"];
[buf appendString: @"<a name=\"nav-bar-variables\">Variables</a>"];
[buf appendString: @"</h3>\n"];
[self outputIndex: @"variable"
scope: @"project"
title: @"Project variables"
style: @"cssNavigation"
target: nil
to: buf];
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; // bar-bottom-body
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; // bar-bottom
[self decIndent];
[buf appendString: indent];
[buf appendString: @"</div>\n"]; // content-bar
[buf appendString: indent];
[buf appendString: @"<div class=\"content-pane\">\n"];
[self incIndent];
[buf appendString: indent];
[buf appendString: @"<div class=\"content-pane-body\">\n"];
[self incIndent];
}
if (prevFile != nil)
{
[buf appendString: indent];
@ -1317,7 +1512,7 @@ static NSMutableSet *textNodes = nil;
if (prevFile != nil || upFile != nil || nextFile != nil)
{
[buf appendString: indent];
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
}
[buf appendString: indent];
@ -1538,7 +1733,7 @@ static NSMutableSet *textNodes = nil;
{
v = @"public";
}
[buf appendFormat: @"%@@%@ %@ <b>%@</b>;<br />\n", indent, v, t, n];
[buf appendFormat: @"%@@%@ %@ <b>%@</b>;<br>\n", indent, v, t, n];
/*
* List standards with which ivar complies
@ -1656,7 +1851,7 @@ static NSMutableSet *textNodes = nil;
{
[buf appendString: @")"];
}
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
node = firstElement(children);
@ -1679,7 +1874,7 @@ static NSMutableSet *textNodes = nil;
}
[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
else if ([name isEqual: @"method"] == YES)
{
@ -1803,7 +1998,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br />\n"];
[buf appendString: @";<br>\n"];
node = firstElement(children);
@ -1821,23 +2016,23 @@ static NSMutableSet *textNodes = nil;
&& [str boolValue] == YES)
{
[buf appendString: @"This is a designated initialiser "
@"for the class.<br />\n"];
@"for the class.<br>\n"];
}
str = [prop objectForKey: @"override"];
if ([str isEqual: @"subclass"] == YES)
{
[buf appendString: @"Subclasses <strong>must</strong> "
@"override this method.<br />\n"];
@"override this method.<br>\n"];
}
else if ([str isEqual: @"dummy"] == YES)
{
[buf appendString: @"An empty method provided for subclasses "
@"to override.<br />\n"];
@"to override.<br>\n"];
}
else if ([str isEqual: @"never"] == YES)
{
[buf appendString: @"Subclasses must <strong>NOT</strong> "
@"override this method.<br />\n"];
@"override this method.<br>\n"];
}
if ([[node name] isEqual: @"desc"])
@ -1845,7 +2040,7 @@ static NSMutableSet *textNodes = nil;
[self outputNode: node to: buf];
}
[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
[buf appendString:@"</div>\n"];
}
@ -2019,7 +2214,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br />\n"];
[buf appendString: @";<br>\n"];
node = firstElement(children);
@ -2042,7 +2237,7 @@ static NSMutableSet *textNodes = nil;
}
[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
else if ([name isEqual: @"uref"] == YES)
{
@ -2097,7 +2292,7 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br/>\n"];
[buf appendString: @";<br>\n"];
node = firstElement(children);
@ -2120,7 +2315,7 @@ static NSMutableSet *textNodes = nil;
}
[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
else
{
@ -2138,8 +2333,7 @@ static NSMutableSet *textNodes = nil;
LEAVE_POOL
}
/**
* Output all the nodes from this one onwards ... try to output
/** Output all the nodes from this one onwards ... try to output
* as text first, if not possible, call the main method to output
* each node.
*/
@ -2550,27 +2744,28 @@ static NSMutableSet *textNodes = nil;
@" fontsize=24 width=0.5 shape=rectangle style=filled]\n"];
if (sNam)
{
[dot appendFormat: @" %@ [class=figure_super", sNam];
if (url)
{
[dot appendFormat: @" %@ [URL=\"%@\"]\n", sNam, url];
}
else
{
[dot appendFormat: @" %@\n", sNam];
[dot appendFormat: @" URL=\"%@\"", url];
}
[dot appendString: @"]\n"];
[dot appendFormat: @" %@ [class=figure_class fontcolor=\"green\"]\n",
cNam];
}
else
{
sNam = cNam; // This is a root class ...
[dot appendFormat: @" %@ [class=figure_root fontcolor=\"green\"]\n",
cNam];
}
[dot appendFormat: @" %@ [fontcolor=\"green\"]\n", cNam];
if (protocols)
{
e = [protocols keyEnumerator];
while ((p = [e nextObject]) != nil)
{
[dot appendFormat:
@" p_%@ [label=\"%@\" URL=\"%@\" shape=hexagon]\n",
[dot appendFormat: @" p_%@ [class=figure_protocol"
@" label=\"%@\" URL=\"%@\" shape=hexagon]\n",
p, p, [protocols objectForKey: p]];
}
}
@ -2666,16 +2861,16 @@ static NSMutableSet *textNodes = nil;
{
ibuf = ivarBuf;
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr class=\"section-separator\">\n"];
[buf appendString: indent];
[buf appendFormat: @"<a href=\"#_%@_ivars\">Instance Variables</a>\n",
classname];
[buf appendString: indent];
[buf appendString: @"<br/><br/>\n"];
[buf appendString: @"<br><br>\n"];
[ibuf appendFormat: @"<a name=\"_%@_ivars\"/>", classname];
}
[ibuf appendString: indent];
[ibuf appendString: @"<br/><hr width=\"50%\" align=\"left\" />\n"];
[ibuf appendString: @"<br><hr class=\"section-separator\">\n"];
[ibuf appendString: indent];
[ibuf appendFormat: @"<h2>Instance Variables for %@ Class</h2>\n",
classname];
@ -2685,7 +2880,7 @@ static NSMutableSet *textNodes = nil;
node = [node nextElement];
}
[ibuf appendString: indent];
[ibuf appendString: @"<br/><hr width=\"50%\" align=\"left\" /><br/>\n"];
[ibuf appendString: @"<br><hr class=\"section-separator\"><br>\n"];
}
a = [localRefs methodsInUnit: unit];
@ -2698,7 +2893,7 @@ static NSMutableSet *textNodes = nil;
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr class=\"section-separator\">\n"];
while (node != nil)
{
if ([[node name] isEqual: @"method"] == YES)
@ -2823,7 +3018,7 @@ static NSMutableSet *textNodes = nil;
}
}
[buf appendString:@"</div>\n"];
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
}
else if ([gvadd length] > 0)
{
@ -2841,14 +3036,14 @@ static NSMutableSet *textNodes = nil;
[buf appendString: @" deprecated at "];
[buf appendString: gvdep];
}
[buf appendString: @"<br/>\n"];
[buf appendString: @"<br>\n"];
if ([gvrem length] > 0)
{
[buf appendString: @" Likely to be changed/moved/removed at "];
[buf appendString: gvrem];
}
[buf appendString:@"</div>\n"];
[buf appendString: @"<br/>\n"];
[buf appendString: @"<br>\n"];
}
}

View file

@ -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
@ -2383,7 +2397,7 @@ static BOOL snuggleStart(NSString *t)
*/
if (up != nil && [up isEqual: [name lastPathComponent]] == NO)
{
[str appendString: @"\" up=\""];
[str appendString: @" up=\""];
[str appendString: up];
[str appendString: @"\""];
}

View file

@ -1345,6 +1345,7 @@ recheck:
if (buffer[pos + 1] == '/')
{
[self skipRemainderOfLine];
break;
}
else if (buffer[pos + 1] == '*')
{
@ -1854,34 +1855,21 @@ recheck:
*/
if ([self parseSpace] < length && buffer[pos] == '<')
{
unsigned save = pos;
NSString *p;
NSArray *protocols = [self parseProtocolList];
do
{
pos++;
p = [self parseIdentifier];
if (p != nil)
{
[a addObject: p];
}
}
while ([self parseSpace] < length && buffer[pos] == ',');
if ('>' == buffer[pos])
{
pos++;
[self parseSpace];
if (protocols)
{
[a addObjectsFromArray: protocols];
[a sortUsingSelector: @selector(compare:)];
[t appendString: @"<"];
[t appendString: [a componentsJoinedByString: @","]];
[t appendString: @">"];
[a removeAllObjects];
}
else
{
pos = save;
[self skipGeneric];
}
}
else
{
[self skipGeneric];
}
}
baseType = t;
}
@ -2463,7 +2451,7 @@ fail:
{
pos++;
if ((base = [self parseIdentifier]) == nil
|| [self parseSpace] >= length)
|| [self parseSpaceOrGeneric] >= length)
{
[self log: @"@interface with bad base class"];
goto fail;
@ -2560,7 +2548,7 @@ fail:
}
if ((name = [self parseIdentifier]) == nil
|| [self parseSpace] >= length)
|| [self parseSpaceOrGeneric] >= length)
{
[self log: @"interface with bad name"];
goto fail;
@ -2625,7 +2613,17 @@ fail:
if (protocols == nil)
{
goto fail;
unsigned saved = pos;
if ([self skipGeneric] > saved)
{
[self parseSpace];
}
else
{
[self log: @"bad protocol list"];
goto fail;
}
}
else if ([protocols count] > 0)
{
@ -4328,6 +4326,7 @@ countAttributes(NSSet *keys, NSDictionary *a)
if (protocols == nil)
{
[self log: @"bad protocol list"];
goto fail;
}
else if ([protocols count] > 0)
@ -4388,6 +4387,7 @@ fail:
{
NSMutableArray *protocols;
NSString *p;
unsigned start = pos;
protocols = [NSMutableArray arrayWithCapacity: 2];
pos++;
@ -4410,7 +4410,7 @@ fail:
if (pos >= length || buffer[pos] != '>' || ++pos >= length
|| [self parseSpace] >= length || [protocols count] == 0)
{
[self log: @"bad protocol list"];
pos = start;
return nil;
}
return protocols;
@ -4522,7 +4522,28 @@ fail:
- (unsigned) parseSpace
{
return [self parseSpace: spacenl];
[self parseSpace: spacenl];
return pos;
}
- (unsigned) parseSpaceOrGeneric
{
[self parseSpace: spacenl];
if (pos < length && '<' == buffer[pos])
{
unsigned saved = pos;
if ([self skipGeneric] > saved)
{
[self parseSpace];
}
else
{
[self log: @"bad generic"];
}
}
return pos;
}
- (NSString*) parseVersion

View file

@ -116,6 +116,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 :=

View file

@ -464,7 +464,8 @@
</item>
<item><strong>StylesheetURL</strong>
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><strong>SystemProjects</strong>
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"
@ -811,6 +813,9 @@ main(int argc, char **argv, char **env)
@"FunctionsTemplate",
@"\t\tSTR\t(\"\")\n\tfile into which docs for macros "
@"should be consolidated",
@"IndexFile",
@"\t\tSTR\t(\"\")\n\tHTML file name (extension omitted) "
@"copied to index.html",
@"MacrosTemplate",
@"\t\tSTR\t(\"\")\n\tfile into which docs for typedefs "
@"should be consolidated",
@ -848,6 +853,10 @@ main(int argc, char **argv, char **env)
{
NSArray *args = [argsRecognized allKeys];
if (![@"help" isEqual: opt])
{
GSPrintf(stderr, @"Unknown option: '%@'\n", opt);
}
GSPrintf(stderr, @"Usage:\n");
GSPrintf(stderr, [NSString stringWithFormat:
@" %@ [options] [files]\n", [argsGiven objectAtIndex: 0]]);
@ -1977,14 +1986,20 @@ main(int argc, char **argv, char **env)
// file for top-left frame (header only; rest appended below)
idxIndexFile = [@"MainIndex" stringByAppendingPathExtension: @"html"];
[idxIndex setString: @"<HTML>\n <BODY>\n"
@" <B>Index</B><BR/>\n"];
[idxIndex setString: @"<!DOCTYPE HTML>\n"
@"<HTML>\n"
@" <HEAD>\n"
@" <META charset=\"utf-8\">\n"
@" </HEAD>\n"
@" <BODY>\n"
@" <B>Index</B><BR>\n"];
// this becomes index.html
framesetFile = [@"index" stringByAppendingPathExtension: @"html"];
[frameset setString: @"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"
@"<HTML>\n"
[frameset setString: @"<!DOCTYPE HTML>\n"
@"<HTML lang=\"en\">\n"
@" <HEAD>\n"
@" <META charset=\"utf-8\">\n"
@" <TITLE>\n"
@" Autogsdoc-generated Documentation for [prjName]\n"
@" </TITLE>\n"
@ -2094,6 +2109,9 @@ main(int argc, char **argv, char **env)
count = [gFiles count];
if (generateHtml == YES && count > 0)
{
NSString *htmlIndexFile;
htmlIndexFile = [defs stringForKey: @"IndexFile"];
pool = [NSAutoreleasePool new];
for (i = 0; i < count; i++)
@ -2200,6 +2218,17 @@ main(int argc, char **argv, char **env)
{
NSLog(@"Sorry unable to write %@", htmlfile);
}
if ([file isEqual: htmlIndexFile])
{
NSString *s;
s = [documentationDirectory
stringByAppendingPathComponent: @"index.html"];
if ([d writeToFile: s atomically: YES] == NO)
{
NSLog(@"Sorry unable to write %@ to %@", htmlfile, s);
}
}
}
}
else if ([arg hasSuffix: @".gsdoc"] == YES)

90
Tools/default-styles.css Normal file
View file

@ -0,0 +1,90 @@
.content-bar {
float: left;
position: fixed;
top: 0px;
left: 0px;
width: 20%;
height: 100%;
border-right: 1px solid grey;
}
.content-bar-top {
position: absolute;
top: 0px;
left: 0px;
height: 30%;
width: 100%;
overflow: auto;
border-bottom: 1px solid grey;
}
.content-bar-top-body {
position: absolute;
top: 0px;
left: 0px;
padding-left: 10px;
padding-top: 10px;
}
.content-bar-bottom {
position: absolute;
bottom: 0px;
left: 0px;
height:70%;
width: 100%;
overflow: auto;
}
.content-bar-bottom-body {
position: absolute;
top: 0px;
left: 0px;
padding-left: 10px;
padding-top: 10px;
}
.content-pane {
position: fixed;
top: 0px;
right: 0px;
width: 80%;
height: 100%;
overflow-y: auto;
}
.content-pane-body {
position: absolute;
top: 0px;
left: 0px;
padding-left: 10px;
}
hr.section-separator {
width:50%;
margin-left:0;
text-align:left;
}
hr.method-separator {
width:25%;
margin-left:0;
text-align:left;
}
h3.content-bar-index-section-header {
font-family: sans-serif;
}
h3.index-section-header {
font-family: sans-serif;
}
p {
font-family: Serif;
}
.desc {
font-family: Serif;
}