diff --git a/gap/Parser.gi b/gap/Parser.gi
index 4178c1ea..04f4fb28 100644
--- a/gap/Parser.gi
+++ b/gap/Parser.gi
@@ -63,7 +63,15 @@ InstallGlobalFunction( AutoDoc_Type_Of_Item,
function( current_item, type, default_chapter_data )
local item_rec, entries, has_filters, ret_val;
item_rec := current_item;
- if PositionSublist( type, "DeclareCategory" ) <> fail then
+ if PositionSublist( type, "DeclareCategoryCollections") <> fail then
+ entries := [ "Filt", "categories" ];
+ ret_val := "true or false";
+ has_filters := "No";
+ if not IsBound( item_rec!.arguments ) then
+ item_rec!.arguments := "obj";
+ fi;
+ item_rec!.coll_suffix := true;
+ elif PositionSublist( type, "DeclareCategory" ) <> fail then
entries := [ "Filt", "categories" ];
ret_val := "true or false";
has_filters := 1;
@@ -229,7 +237,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
return false;
fi;
current_line := current_line{ [ position_parentesis + 1 .. Length( current_line ) ] };
- ## Not the funny part begins:
+ ## Now the funny part begins:
## try fetching the name:
## Assuming the name is in the same line as its
while PositionSublist( current_line, "," ) = fail and PositionSublist( current_line, ");" ) = fail do
@@ -238,6 +246,27 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
current_line := StripBeginEnd( current_line, " " );
current_item!.name := current_line{ [ 1 .. Minimum( [ PositionSublist( current_line, "," ), PositionSublist( current_line, ");" ) ] ) - 1 ] };
current_item!.name := StripBeginEnd( ReplacedString( current_item!.name, "\"", "" ), " " );
+
+ # Deal with DeclareCategoryCollections: this has some special
+ # rules on how the name of a new category is derived from the
+ # string given to it. Since the code for that is not available in
+ # a separate GAP function, we have to replicate this logic here.
+ # To understand what's going on, please refer to the
+ # DeclareCategoryCollections documentation and implementation.
+ if IsBound(current_item!.coll_suffix) then
+ if EndsWith(current_item!.name, "Collection") then
+ current_item!.name :=
+ current_item!.name{[1..Length(current_item!.name)-6]};
+ fi;
+ if EndsWith(current_item!.name, "Coll") then
+ current_item!.coll_suffix := "Coll";
+ else
+ current_item!.coll_suffix := "Collection";
+ fi;
+ current_item!.name := Concatenation(current_item!.name,
+ current_item!.coll_suffix);
+ fi;
+
current_line := current_line{ [ Minimum( [ PositionSublist( current_line, "," ), PositionSublist( current_line, ");" ) ] ) + 1 .. Length( current_line ) ] };
filter_string := "for ";
## FIXME: The next two if's can be merged at some point
diff --git a/tst/worksheets/general.expected/_Chapter_SomeChapter.xml b/tst/worksheets/general.expected/_Chapter_SomeChapter.xml
index ef98e510..7e73a2d2 100644
--- a/tst/worksheets/general.expected/_Chapter_SomeChapter.xml
+++ b/tst/worksheets/general.expected/_Chapter_SomeChapter.xml
@@ -14,6 +14,54 @@ gap> Size(S5);
And we wrap up with some dummy text
+
+Some categories
+
+Intro text
+
+
+ true or false
+
+
+
+
+
+
+
+
+
+ true or false
+
+
+
+
+
+
+
+
+
+ true or false
+
+
+
+
+
+
+
+
+
+ true or false
+
+
+
+
+
+
+
+Let's wrap up with something, though.
+
+
+
SomeSection
diff --git a/tst/worksheets/general.sheet/worksheet.g b/tst/worksheets/general.sheet/worksheet.g
index 9ca142a3..6f0e3b3e 100644
--- a/tst/worksheets/general.sheet/worksheet.g
+++ b/tst/worksheets/general.sheet/worksheet.g
@@ -22,6 +22,16 @@ Print( "(Even though we never use it that way.\n" );
#! @EndExampleSession
#! And we wrap up with some dummy text
+#! @Section Some categories
+#! Intro text
+DeclareCategory("MyThings", IsObject);
+DeclareCategoryCollections("MyThings");
+DeclareCategoryCollections("MyThingsColl");
+DeclareCategoryCollections("MyThingsCollection");
+Now here is some text with a bunch of &!$%*!/ weird things in it. But that
+should be OK, nothing should end up in a weird place.
+#! Let's wrap up with something, though.
+
#! @Section SomeSection
#! Some test just inside a section. We can use test some markdown features here: