mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Add markup for constants.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11135 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
220e6f495e
commit
cb0707d9ef
2 changed files with 79 additions and 9 deletions
|
@ -179,8 +179,8 @@ static BOOL snuggleStart(NSString *t)
|
||||||
|
|
||||||
[str appendString: @"<?xml version=\"1.0\"?>\n"];
|
[str appendString: @"<?xml version=\"1.0\"?>\n"];
|
||||||
[str appendString: @"<!DOCTYPE gsdoc PUBLIC "];
|
[str appendString: @"<!DOCTYPE gsdoc PUBLIC "];
|
||||||
[str appendString: @"\"-//GNUstep//DTD gsdoc 0.6.5//EN\" "];
|
[str appendString: @"\"-//GNUstep//DTD gsdoc 0.6.6//EN\" "];
|
||||||
[str appendString: @"\"http://www.gnustep.org/gsdoc-0_6_5.xml\">\n"];
|
[str appendString: @"\"http://www.gnustep.org/gsdoc-0_6_6.xml\">\n"];
|
||||||
[str appendFormat: @"<gsdoc"];
|
[str appendFormat: @"<gsdoc"];
|
||||||
|
|
||||||
tmp = [info objectForKey: @"Base"];
|
tmp = [info objectForKey: @"Base"];
|
||||||
|
@ -878,20 +878,75 @@ static BOOL snuggleStart(NSString *t)
|
||||||
|
|
||||||
for (l = 0; l < [a count]; l++)
|
for (l = 0; l < [a count]; l++)
|
||||||
{
|
{
|
||||||
|
static NSArray *constants = nil;
|
||||||
|
static unsigned cCount = 0;
|
||||||
|
unsigned pos;
|
||||||
NSString *tmp = [a objectAtIndex: l];
|
NSString *tmp = [a objectAtIndex: l];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure that well known constants are rendered as 'code'
|
* Ensure that well known constants are rendered as 'code'
|
||||||
*/
|
*/
|
||||||
if ([tmp isEqual: @"YES"]
|
if (constants == nil)
|
||||||
|| [tmp isEqual: @"NO"]
|
|
||||||
|| [tmp isEqual: @"nil"])
|
|
||||||
{
|
{
|
||||||
if (l == 0 || [[a objectAtIndex: l - 1] isEqual: @"<code>"] == NO)
|
constants = [[NSArray alloc] initWithObjects:
|
||||||
|
@"YES", @"NO", @"nil", nil];
|
||||||
|
cCount = [constants count];
|
||||||
|
}
|
||||||
|
for (pos = 0; pos < cCount; pos++)
|
||||||
|
{
|
||||||
|
NSString *c = [constants objectAtIndex: pos];
|
||||||
|
NSRange r = [tmp rangeOfString: c];
|
||||||
|
|
||||||
|
if (r.length > 0)
|
||||||
{
|
{
|
||||||
[a insertObject: @"</code>" atIndex: l + 1];
|
NSString *start;
|
||||||
[a insertObject: @"<code>" atIndex: l];
|
NSString *end;
|
||||||
l += 2;
|
|
||||||
|
if (r.location > 0)
|
||||||
|
{
|
||||||
|
start = [tmp substringToIndex: r.location];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
start = nil;
|
||||||
|
}
|
||||||
|
if (NSMaxRange(r) < [tmp length])
|
||||||
|
{
|
||||||
|
end = [tmp substringFromIndex: NSMaxRange(r)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
end = nil;
|
||||||
|
}
|
||||||
|
if ((start == nil || snuggleStart(start) == YES)
|
||||||
|
&& (end == nil || snuggleEnd(end) == YES))
|
||||||
|
{
|
||||||
|
NSString *sub;
|
||||||
|
|
||||||
|
if (start != nil || end != nil)
|
||||||
|
{
|
||||||
|
sub = [tmp substringWithRange: r];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sub = nil;
|
||||||
|
}
|
||||||
|
if (start != nil)
|
||||||
|
{
|
||||||
|
[a insertObject: start atIndex: l++];
|
||||||
|
}
|
||||||
|
[a insertObject: @"<code>" atIndex: l++];
|
||||||
|
if (sub != nil)
|
||||||
|
{
|
||||||
|
[a replaceObjectAtIndex: l withObject: sub];
|
||||||
|
}
|
||||||
|
l++;
|
||||||
|
[a insertObject: @"</code>" atIndex: l];
|
||||||
|
if (end != nil)
|
||||||
|
{
|
||||||
|
[a insertObject: end atIndex: ++l];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,21 @@
|
||||||
conforming (or not conforming) to the specified standards.
|
conforming (or not conforming) to the specified standards.
|
||||||
</item>
|
</item>
|
||||||
</list>
|
</list>
|
||||||
|
<p>
|
||||||
|
Generally, the text in comments is reformatted to standardise and
|
||||||
|
indent it nicely ... the reformatting is <em>not</em> performed on
|
||||||
|
any text inside an <example> element.<br />
|
||||||
|
When the text is reformatted, it is broken into whitespace separated
|
||||||
|
'words' which are then subjected to some extra processing ...
|
||||||
|
</p>
|
||||||
|
<list>
|
||||||
|
<item>Certain well known constants such as YES, NO, and nil are
|
||||||
|
enclosed in <code> ... </code> markup.
|
||||||
|
</item>
|
||||||
|
<item>Method names (beginning with a plus or minus) are enclosed
|
||||||
|
in <ref...> ... </ref> markup.
|
||||||
|
</item>
|
||||||
|
</list>
|
||||||
<p>
|
<p>
|
||||||
The tools accepts certain user defaults (which can of course be
|
The tools accepts certain user defaults (which can of course be
|
||||||
supplied as command-line arguments as usual) -
|
supplied as command-line arguments as usual) -
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue