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

BibEntry assumes package dates are in "dd/mm/yyyy" format #5853

Open
stertooy opened this issue Nov 29, 2024 · 0 comments
Open

BibEntry assumes package dates are in "dd/mm/yyyy" format #5853

stertooy opened this issue Nov 29, 2024 · 0 comments

Comments

@stertooy
Copy link
Contributor

In the following piece of code, the BibEntry function assumes the Date field of a package info record is in the "dd/mm/yyyy"-format (or dd@mm@yyyy with any choice of separator @ really).

gap/lib/package.gi

Lines 2936 to 2948 in 0d29d4b

if IsBound( pkginfo.Date ) and IsDenseList( pkginfo.Date )
and Length( pkginfo.Date ) = 10 then
if Int( pkginfo.Date{ [ 4, 5 ] } ) in [ 1 .. 12 ] then
Append( entry, Concatenation(
" <month>", NameMonth[ Int( pkginfo.Date{ [ 4, 5 ] } ) ],
"</month>\n",
" <year>", pkginfo.Date{ [ 7 .. 10 ] }, "</year>\n" ) );
else
Append( entry, Concatenation(
" <month>", pkginfo.Date{ [ 4, 5 ] }, "</month>\n",
" <year>", pkginfo.Date{ [ 7 .. 10 ] }, "</year>\n" ) );
fi;
fi;

However, I think the current recommendation is for dates to be in the "yyyy-mm-dd" format. This causes trouble for GitHubPagesForGAP, which relies on BibEntry to get its information for citing a package - see e.g. the GitHub page for the Example package, which has:

[NGK20]
Nickel, W., Gamble, G. and Konovalov, O.,
Example,
Example/Template of a GAP Package,
Version 4.4.0 (1-20) (GAP package),
https://gap-packages.github.io/example.

Here, the citekey should be NGK24 and the year should be 2024, of course. The mistakes stem from BibEntry assuming that the last 4 characters of the string 2024-11-20 represent the year. By contrast, in the same function, the date of GAP itself is assumed to be in the "yyyy-mm-dd"-format:

gap/lib/package.gi

Lines 2880 to 2891 in 0d29d4b

val:= SplitString( GAPInfo.Date, "-" );
if Length( val ) = 3 then
if Int( val[2] ) in [ 1 .. 12 ] then
val:= Concatenation( " <month>", NameMonth[ Int( val[2] ) ],
"</month>\n <year>", val[1], "</year>\n" );
else
val:= Concatenation( " <month>", val[2],
"</month>\n <year>", val[1], "</year>\n" );
fi;
else
val:= "";
fi;

What may complicate things, is that when GAP reads package metadata on startup, it seems to automatically convert dates to "dd/mm/year"-format before storing it in GAPInfo.PackagesInfo, whereas no such conversion happens when calling GAPInfo.PackageInfoCurrent. If I am working in Example's base directory:

[...]/example$ echo "Print(GAPInfo.PackagesInfo.example[1].Date,\"\n\");QuitGap();" | gap -A -q 
20/11/2024
[...]/example$ echo "Read(\"PackageInfo.g\");Print(GAPInfo.PackageInfoCurrent.Date,\"\n\");QuitGap();" | gap -A -q 
2024-11-20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant