Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agsdoc html style update #440

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
eadaf46
mark document as strict HTML4 and let's spot errors d- no HTML5 due …
rmottola Aug 12, 2024
1b82375
use classic HTML non-closing tag syntax
rmottola Aug 12, 2024
8792f56
fix missing html tag start
rmottola Aug 22, 2024
550facb
use modern doctype suggested, or FF 115 uses quirks mode with classic…
rmottola Aug 22, 2024
c8e2d51
declare charset static to utf-8
rmottola Aug 22, 2024
11dfe4d
Avoid output of the whitespace between elements within <gsdoc>
rfm Aug 22, 2024
cf166fd
Merge branch 'agsdoc-html-style' of ssh://github.com/gnustep/libs-bas…
rfm Aug 22, 2024
0905c30
add missing newline and remove comment, there is no multi-lang doc su…
rmottola Aug 24, 2024
21f2cd0
add declaration do avoid warning
rmottola Aug 24, 2024
0619a30
proper doctype and header also for frame indices
rmottola Aug 27, 2024
2c8528d
Fix bug adding extra quotes
rfm Sep 2, 2024
db0d5a1
Create (and use if no -StylesheetURL is given) a default stylesheet, …
rfm Sep 3, 2024
7b70d77
Fix error consuming extra character at end of <ignore>..</ignore>
rfm Sep 3, 2024
110a32e
add styles, including debug
rmottola Sep 3, 2024
80216e6
Don't override the default stylesheet
rfm Sep 16, 2024
b34089b
nav bar inital attempt
rfm Sep 16, 2024
e126331
improved styles
rmottola Sep 16, 2024
a2c9bfa
remove debug colors, add separate body styles for each pane
rmottola Sep 23, 2024
fc23434
output body divs, fix indenting
rmottola Sep 23, 2024
4a506cb
style also section horizontal rulers
rmottola Oct 18, 2024
e14da97
give some visual separation to index areas
rmottola Oct 18, 2024
bd6c52e
Add skipping of generics in a few more places.
rfm Oct 21, 2024
f162e0f
Changes for index.html output
rfm Oct 21, 2024
fce8393
fix format error
rfm Oct 21, 2024
c0cc645
Add index section header info
rfm Oct 21, 2024
8456b72
Fix invert logic
rfm Oct 21, 2024
c122aa6
Styling for indexes
rfm Oct 21, 2024
9097de9
If we have an incorrect flag, say what it was.
rfm Oct 21, 2024
964cd4e
Tidied classes for indexes
rfm Oct 21, 2024
15270e4
fix typo
rfm Oct 21, 2024
a8337b7
Add "node figure" class for svg
rfm Nov 4, 2024
e9d1e9e
revert faulty class change
rfm Nov 4, 2024
8382e02
Add css classes for nodes in the diagrams as follows:
rfm Nov 4, 2024
74f70e8
fix style formatting, cleanup and make description style working
rmottola Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Tools/AGSHtml.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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
Expand Down
102 changes: 60 additions & 42 deletions Tools/AGSHtml.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ - (id) init
* 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
Expand Down Expand Up @@ -336,9 +336,9 @@ - (NSString*) makeURL: (NSString*)r
/**
* 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
Expand Down Expand Up @@ -431,12 +431,8 @@ - (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file
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];
Expand All @@ -447,6 +443,24 @@ - (NSString*) outputDocument: (GSXMLNode*)node name: (NSString*)file
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
Expand Down Expand Up @@ -556,7 +570,7 @@ - (void) outputIndex: (NSString*)type
}
else
{
[buf appendString: @"<br/>"];
[buf appendString: @"<br>"];
}
[buf appendString: @"\n"];
}
Expand Down Expand Up @@ -719,7 +733,7 @@ - (void) outputIndex: (NSString*)type
}
else
{
[buf appendString: @"<br/>"];
[buf appendString: @"<br>"];
}
[buf appendString: @"\n"];

Expand Down Expand Up @@ -765,7 +779,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[self outputNodeList: children to: buf];

[buf appendString: indent];
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
if (prevFile != nil)
{
[buf appendString: indent];
Expand Down Expand Up @@ -794,7 +808,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
}
else if ([name isEqual: @"br"] == YES)
{
[buf appendString: @"<br/>"];
[buf appendString: @"<br>"];
}
else if ([name isEqual: @"category"] == YES)
{
Expand Down Expand Up @@ -891,7 +905,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br/>\n"];
[buf appendString: @";<br>\n"];

node = firstElement(children);

Expand Down Expand Up @@ -928,7 +942,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
unsigned l = 0;

[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr width=\"50%\" align=\"left\">\n"];
[buf appendString: indent];
[buf appendString: @"<h3>Contents -</h3>\n"];

Expand Down Expand Up @@ -1005,7 +1019,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
l--;
}
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr width=\"50%\" align=\"left\">\n"];
}
}
else if ([name isEqual: @"declared"] == YES)
Expand Down Expand Up @@ -1204,7 +1218,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @");<br />\n"];
[buf appendString: @");<br>\n"];

node = firstElement(children);

Expand Down Expand Up @@ -1253,7 +1267,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
([stylesheetURL rangeOfString: @"gsdoc_contents"].length > 0))
? YES : NO;

[self outputNodeList: children to: buf];
[self outputElemList: children to: buf];
}
}
else if ([name isEqual: @"head"] == YES)
Expand All @@ -1263,6 +1277,11 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[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>"];
Expand Down Expand Up @@ -1317,7 +1336,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
if (prevFile != nil || upFile != nil || nextFile != nil)
{
[buf appendString: indent];
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
}

[buf appendString: indent];
Expand Down Expand Up @@ -1538,7 +1557,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
{
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
Expand Down Expand Up @@ -1656,7 +1675,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
{
[buf appendString: @")"];
}
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];

node = firstElement(children);

Expand All @@ -1679,7 +1698,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
}

[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
else if ([name isEqual: @"method"] == YES)
{
Expand Down Expand Up @@ -1803,7 +1822,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br />\n"];
[buf appendString: @";<br>\n"];

node = firstElement(children);

Expand All @@ -1821,31 +1840,31 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
&& [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"])
{
[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"];
}
Expand Down Expand Up @@ -2019,7 +2038,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br />\n"];
[buf appendString: @";<br>\n"];

node = firstElement(children);

Expand All @@ -2042,7 +2061,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
}

[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
else if ([name isEqual: @"uref"] == YES)
{
Expand Down Expand Up @@ -2097,7 +2116,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
[buf appendString: @"</h3>\n"];
[buf appendString: indent];
[buf appendString: str];
[buf appendString: @";<br/>\n"];
[buf appendString: @";<br>\n"];

node = firstElement(children);

Expand All @@ -2120,7 +2139,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
}

[buf appendString: indent];
[buf appendString: @"<hr class=\"method-separator\"/>\n"];
[buf appendString: @"<hr class=\"method-separator\">\n"];
}
else
{
Expand All @@ -2138,8 +2157,7 @@ - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
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.
*/
Expand Down Expand Up @@ -2666,16 +2684,16 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf
{
ibuf = ivarBuf;
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr width=\"50%\" align=\"left\">\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 width=\"50%\" align=\"left\">\n"];
[ibuf appendString: indent];
[ibuf appendFormat: @"<h2>Instance Variables for %@ Class</h2>\n",
classname];
Expand All @@ -2685,7 +2703,7 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf
node = [node nextElement];
}
[ibuf appendString: indent];
[ibuf appendString: @"<br/><hr width=\"50%\" align=\"left\" /><br/>\n"];
[ibuf appendString: @"<br><hr width=\"50%\" align=\"left\"><br>\n"];
}

a = [localRefs methodsInUnit: unit];
Expand All @@ -2698,7 +2716,7 @@ - (void) outputUnit: (GSXMLNode*)node to: (NSMutableString*)buf
target: nil
to: buf];
[buf appendString: indent];
[buf appendString: @"<hr width=\"50%\" align=\"left\" />\n"];
[buf appendString: @"<hr width=\"50%\" align=\"left\">\n"];
while (node != nil)
{
if ([[node name] isEqual: @"method"] == YES)
Expand Down Expand Up @@ -2823,7 +2841,7 @@ - (void) outputVersion: (NSDictionary*)prop to: (NSMutableString*)buf
}
}
[buf appendString:@"</div>\n"];
[buf appendString: @"<br />\n"];
[buf appendString: @"<br>\n"];
}
else if ([gvadd length] > 0)
{
Expand All @@ -2841,14 +2859,14 @@ - (void) outputVersion: (NSDictionary*)prop to: (NSMutableString*)buf
[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"];
}
}

Expand Down
Loading