Skip to content

Commit

Permalink
Make FirstNames optional in Persons records in package metadata (#…
Browse files Browse the repository at this point in the history
…5822)

Also:
- special treatment for `The GAP Team` in `Cite`
- let `BibEntry` add `<C>` tags for `Subtitle`
- adjust test output to the added `<C>` tags
  • Loading branch information
ThomasBreuer authored Oct 28, 2024
1 parent 2664be8 commit 17bc592
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
8 changes: 4 additions & 4 deletions doc/ref/gappkg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,17 @@ The following components of the record are <E>optional</E>.
<Item>
a string,
</Item>
<Mark><C>FirstNames</C></Mark>
<Item>
a string,
</Item>
<Mark>at least one of <C>IsAuthor</C> or <C>IsMaintainer</C></Mark>
<Item>
<K>true</K> or <K>false</K>,
</Item>
</List>
and optional components
<List>
<Mark><C>FirstNames</C></Mark>
<Item>
a string (was mandatory before &GAP; 4.14),
</Item>
<Mark><C>PostalAddress</C></Mark>
<Item>
a string,
Expand Down
21 changes: 15 additions & 6 deletions lib/package.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1234,8 +1234,10 @@ InstallGlobalFunction( DefaultPackageBannerString,
Append( str, role );
for i in [ 1 .. Length( persons ) ] do
person:= persons[i];
Append( str, person.FirstNames );
Append( str, " " );
if IsBound( person.FirstNames ) then
Append( str, person.FirstNames );
Append( str, " " );
fi;
Append( str, person.LastName );
if IsBound( person.WWWHome ) then
Append( str, Concatenation( " (", person.WWWHome, ")" ) );
Expand Down Expand Up @@ -2402,7 +2404,7 @@ InstallGlobalFunction( ValidatePackageInfo, function( info )
and IsBound( record.Persons ) then
for subrec in record.Persons do
TestMandat( subrec, "LastName", IsString, "a string" );
TestMandat( subrec, "FirstNames", IsString, "a string" );
TestOption( subrec, "FirstNames", IsString, "a string" );
if not ( IsBound( subrec.IsAuthor )
or IsBound( subrec.IsMaintainer ) ) then
if ValueOption( "quiet" ) <> true then
Expand Down Expand Up @@ -2899,8 +2901,11 @@ InstallGlobalFunction( BibEntry, function( arg )
author:= List( Filtered( pkginfo.Persons,
person -> person.IsAuthor or person.IsMaintainer ),
person -> Concatenation(
" <name><first>", person.FirstNames,
"</first><last>", person.LastName, "</last></name>\n" ) );
" <name>",
CallFuncList( function(x) if IsBound( x.FirstNames ) then
return Concatenation( "<first>", person.FirstNames, "</first>" );
else return ""; fi; end, [ person ] ),
"<last>", person.LastName, "</last></name>\n" ) );
if not IsEmpty( author ) then
Append( entry, Concatenation(
" <author>\n",
Expand All @@ -2911,7 +2916,7 @@ InstallGlobalFunction( BibEntry, function( arg )
" <title><C>", pkginfo.PackageName, "</C>" ) );
if IsBound( pkginfo.Subtitle ) then
Append( entry, Concatenation(
", ", ps( pkginfo.Subtitle ) ) );
", <C>", ps( pkginfo.Subtitle ), "</C>" ) );
fi;
if IsBound( pkginfo.Version ) then
Append( entry, Concatenation(
Expand Down Expand Up @@ -2982,6 +2987,10 @@ InstallGlobalFunction( Cite, function(arg)
Print("WARNING: No working version of package ", name, " is available!\n");
return;
fi;
# special handling for "The GAP Team"
bib:= ReplacedString( bib,
"<name><first>The</first><last>GAP Team</last></name>",
"<name><last>The GAP Team</last></name>" );
parse:= ParseBibXMLextString( bib );
# use encoding of terminal for printing
en := function(str)
Expand Down
6 changes: 3 additions & 3 deletions tst/testinstall/package.tst
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ BibXML:
<name><first>Retired</first><last>Author</last></name>
<name><first>Only</first><last>Maintainer</last></name>
</author>
<title><C>mockpkg</C>, A mock package for use by the GAP test suite,
<title><C>mockpkg</C>, <C>A mock package for use by the GAP test suite</C>,
<C>V</C>ersion 0.1</title>
<howpublished><URL>https://mockpkg.gap-system.org/</URL></howpublished>
<month>Mar</month>
Expand All @@ -578,8 +578,8 @@ BibTeX:

@misc{ mockpkg,
author = {Author, A. and Author, R. and Maintainer, O.},
title = {{mockpkg}, A mock package for use by the GAP test
suite, {V}ersion 0.1},
title = {{mockpkg}, {A mock package for use by the GAP test
suite}, {V}ersion 0.1},
month = {Mar},
year = {2018},
note = {GAP package},
Expand Down

0 comments on commit 17bc592

Please sign in to comment.