Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ This file describes changes in the AutoDoc package.
`@Command` does not start at column 1
- Normalize parsed `InstallMethod` names by stripping surrounding
quotes, matching `Declare...` handling
- Loosen requirements on `@Date` command: this used to allow free form,
but in recent versions was restricted to dates of the form YYYY-MM-DD
or DD/MM/YYYY; now we again allow any text, but text in those specific
formats is still parsed and formatted (e.g. 2026-03-08 as 8 March 2026)
- Improve parser robustness by reporting clear EOF errors for
unterminated declaration headers and filter lists
- Make tests work when the package directory is read-only by writing
Expand Down
19 changes: 13 additions & 6 deletions gap/AutoDocMainFunction.gi
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ end );
## separately.
InstallGlobalFunction( CreateTitlePage,
function( dir, argument_rec )
local indent, tag, names, filestream, entity_list, OutWithTag, Out, i;
local indent, tag, names, filestream, entity_list, OutWithTag, Out, i,
parsed_date;

filestream := AUTODOC_OutputTextFile( dir, "title.xml" );
indent := 0;
Expand Down Expand Up @@ -271,11 +272,17 @@ InstallGlobalFunction( CreateTitlePage,
fi;

if IsBound( argument_rec.Date ) then
# try to parse the date in format DD/MM/YYYY (we also accept single
# digit day or month, which is formally not allowed in PackageInfo.g,
# but happens in a few legacy packages)
argument_rec.Date := Chomp( argument_rec.Date ); # remove trailing newlines, if present
OutWithTag( "Date", AUTODOC_FormatDate(argument_rec.Date) );
if IsString( argument_rec.Date ) then
argument_rec.Date := Chomp( argument_rec.Date ); # remove trailing newlines, if present

# PackageInfo.g dates are normalized, but @Date should also allow
# free-form text when the input is not one of the supported date formats.
parsed_date := AUTODOC_ParseDate( argument_rec.Date );
if parsed_date <> fail then
argument_rec.Date := AUTODOC_FormatDate( parsed_date );
fi;
fi;
OutWithTag( "Date", argument_rec.Date );
fi;

for i in [ "Address", "Abstract", "Copyright", "Acknowledgements", "Colophon" ] do
Expand Down
2 changes: 1 addition & 1 deletion tst/worksheets/autoplain.expected/title.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
Plain file.autodoc Test
</Title>
<Date>
30 August 2018
8 March 2026
</Date>
</TitlePage>
2 changes: 1 addition & 1 deletion tst/worksheets/autoplain.sheet/plain.autodoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@Title Plain file.autodoc Test
@Date 2018-08-30
@Date 8 March 2026

# Test
Does AutoDoc have a way to allow that header block not to appear in
Expand Down