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
@@ -1,5 +1,9 @@
This file describes changes in the AutoDoc package.

## 2026.03.18
- Fix running the test suite via `TestPackage("AutoDoc")` when the
current working directory is not the package root

## 2026.03.17

+ **Breaking changes**
Expand Down
18 changes: 14 additions & 4 deletions gap/Parser.gi
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
comment_start_pos, context_stack, current_command,
current_line, current_line_fence, current_line_info,
current_line_is_fence_delimiter, current_line_positition_for_filter,
current_line_unedited, filename, filestream, groupnumber,
line_number, markdown_fence, plain_text_mode, rest_of_file_skipped,
current_line_unedited, display_filename, filename,
filestream, groupnumber, line_number,
markdown_fence, plain_text_mode, rest_of_file_skipped,
scope_group, single_line_title_item_list, title_item,
title_item_list, xml_comment_mode;
groupnumber := 0;
Expand All @@ -325,11 +326,14 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
end;
ErrorWithPos := function(arg)
local list;
list := Concatenation(arg, [ ",\n", "at ", filename, ":", line_number]);
list := Concatenation(
arg,
[ ",\n", "at ", display_filename, ":", line_number ]
);
CallFuncList(Error, list);
end;
CurrentSourcePosition := function()
return rec( filename := filename, line := line_number );
return rec( filename := display_filename, line := line_number );
end;
RecordStringSourcePosition := function( item )
local source_field;
Expand Down Expand Up @@ -1220,6 +1224,12 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
rest_of_file_skipped := false;
##Now read the files.
for filename in filename_list do
if IsString( filename ) then
display_filename := filename;
else
display_filename := filename.display;
filename := filename.path;
fi;
Reset();
##Need to set autodoc_read_line to false again since we now look at a new file.
autodoc_read_line := false;
Expand Down
15 changes: 13 additions & 2 deletions tst/errorwithpos.tst
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
#
# test parser error reporting with ErrorWithPos
gap> autodoc_pkgroot := Filename( DirectoriesPackageLibrary( "AutoDoc", "" ), "" );;
gap> if not StartsWith( autodoc_pkgroot, "/" ) then
> autodoc_pkgroot := Filename(
> Directory( AUTODOC_CurrentDirectory() ),
> autodoc_pkgroot
> );
> fi;
gap> ParseFixture := function( arg )
> local tree, default_chapter_data;
> local tree, default_chapter_data, file;
> tree := DocumentationTree();
> if Length( arg ) > 1 then
> default_chapter_data := arg[ 2 ];
> else
> default_chapter_data := CreateDefaultChapterData( "Pkg" );
> fi;
> AutoDoc_Parser_ReadFiles( [ arg[ 1 ] ], tree, default_chapter_data );
> file := rec(
> path := Filename( Directory( autodoc_pkgroot ), arg[ 1 ] ),
> display := arg[ 1 ]
> );
> AutoDoc_Parser_ReadFiles( [ file ], tree, default_chapter_data );
> return tree;
> end;;
gap> RenderFixtureDescription := function( file, item_name )
Expand Down
37 changes: 36 additions & 1 deletion tst/misc.tst
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,43 @@ true
#
# AutoDoc_Parser_ReadFiles: multiline InstallMethod parsing
#
gap> autodoc_pkgroot := Filename( DirectoriesPackageLibrary( "AutoDoc", "" ), "" );;
gap> if not StartsWith( autodoc_pkgroot, "/" ) then
> autodoc_pkgroot := Filename(
> Directory( AUTODOC_CurrentDirectory() ),
> autodoc_pkgroot
> );
> fi;
gap> parser_fixture := rec(
> path := Filename(
> Directory( autodoc_pkgroot ),
> "tst/autodoc-parser-installmethod.g"
> ),
> display := "tst/autodoc-parser-installmethod.g"
> );;
gap> tree := DocumentationTree();;
gap> AutoDoc_Parser_ReadFiles( [ "tst/autodoc-parser-installmethod.g" ], tree, rec() );
gap> AutoDoc_Parser_ReadFiles( [ parser_fixture ], tree, rec() );
gap> section := SectionInTree( tree, "Parser", "InstallMethod" );;
gap> item := section!.content[ 1 ];;
gap> item!.item_type;
"Func"
gap> item!.name;
"MyOp"
gap> item!.tester_names;
"for IsInt,IsString"
gap> item!.arguments;
"x,y"
gap> olddir := Filename(DirectoryCurrent(), "");;
gap> ChangeDirectoryCurrent(Filename(DirectoryTemporary(), ""));
true
gap> tree := DocumentationTree();;
gap> AutoDoc_Parser_ReadFiles(
> [ parser_fixture ],
> tree,
> rec()
> );
gap> ChangeDirectoryCurrent(olddir);
true
gap> section := SectionInTree( tree, "Parser", "InstallMethod" );;
gap> item := section!.content[ 1 ];;
gap> item!.item_type;
Expand Down