-
Notifications
You must be signed in to change notification settings - Fork 15
Handle documentation of DeclareCategoryCollection declarations. #171
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 := "<C>true</C> or <C>false</C>"; | ||
| 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 := "<C>true</C> or <C>false</C>"; | ||
| 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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please explain what this To me it seems like you check if the item ends with Specially, in the docs below it seems like
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As explained in the PR description and the commit message, this imitates the behavior of That said, I think there should be a comment here which explains that; I can add one later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see . . . Okay, sorry for the confusion.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No confusion, nothing to be sorry about: you raised a valid point. I've now added a comment, which hopefully makes this code easier to understand for future generations (e.g. us, two years down the road ;-).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will also submit a PR to GAP to actually document In the meantime, feel free to approve this PR ;-) |
||
|
|
||
| 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe, nice.