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
1 change: 1 addition & 0 deletions gap/DocumentationTree.gd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ DeclareOperation( "SectionInTree", [ IsTreeForDocumentation, IsString, IsString
DeclareOperation( "SubsectionInTree", [ IsTreeForDocumentation, IsString, IsString, IsString ] );
DeclareOperation( "DocumentationExample", [ IsTreeForDocumentation ] );
DeclareOperation( "DocumentationChunk", [ IsTreeForDocumentation, IsString ] );
DeclareOperation( "DocumentationChunkContent", [ IsObject ] );
DeclareOperation( "DocumentationManItem", [ IsTreeForDocumentation ] );
DeclareOperation( "SetManItemToDescription", [ IsTreeForDocumentationNode ] );
DeclareOperation( "SetManItemToReturnValue", [ IsTreeForDocumentationNode ] );
Expand Down
25 changes: 25 additions & 0 deletions gap/DocumentationTree.gi
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ BindGlobal( "TheTypeOfDocumentationTreeExampleNodes",
NewType( TheFamilyOfDocumentationTreeNodes,
IsTreeForDocumentationExampleNodeRep ) );


## DeclareRepresentation
DeclareRepresentation( "IsTreeForDocumentationChunkContentNodeRep", IsTreeForDocumentationNodeRep, [ ] );
BindGlobal( "TheTypeOfDocumentationTreeChunkContentNodes", NewType( TheFamilyOfDocumentationTreeNodes, IsTreeForDocumentationChunkContentNodeRep ) );



###################################
##
## Tools
Expand Down Expand Up @@ -230,6 +237,16 @@ InstallMethod( DocumentationChunk, [ IsTreeForDocumentation, IsString ],
return node;
end );

##
InstallMethod( DocumentationChunkContent, [ IsObject ],
function( content )
local node;

node := rec( content := content );
ObjectifyWithAttributes( node, TheTypeOfDocumentationTreeChunkContentNodes );
return node;
end );

##
InstallMethod( DocumentationManItem, [ IsTreeForDocumentation ],
function( tree )
Expand Down Expand Up @@ -588,6 +605,14 @@ InstallMethod( WriteDocumentation, [ IsTreeForDocumentationChunkNodeRep, IsStrea
WriteDocumentation( Concatenation( "<#Include Label=\"", Label( node ), "\">" ), filestream, level_value );
end );

InstallMethod( WriteDocumentation, [ IsTreeForDocumentationChunkContentNodeRep, IsStream, IsInt ],
function( node, filestream, level_value )
local s;
for s in node!.content do
AppendTo( filestream, s );
od;
end );

##
InstallMethod( WriteDocumentation, [ IsTreeForDocumentationExampleNodeRep, IsStream, IsInt ],
function( node, filestream, level_value )
Expand Down
4 changes: 2 additions & 2 deletions gap/Parser.gi
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
local code, temp_curr_line, comment_pos, before_comment;
code := [ "<Listing Type=\"Code\"><![CDATA[\n" ];
while true do
temp_curr_line := Chomp( ReadLineWithLineCount( filestream ) );
temp_curr_line := ReadLineWithLineCount( filestream );
if plain_text_mode = false then
comment_pos := PositionSublist( temp_curr_line, "#!" );
if comment_pos <> fail then
Expand Down Expand Up @@ -713,7 +713,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
local label_name, tmp_system;
label_name := ReplacedString( current_command[ 2 ], " ", "_" );
tmp_system := DocumentationChunk( tree, label_name );
Append( tmp_system!.content, read_code() );
Add( tmp_system!.content, DocumentationChunkContent( read_code() ) );
end,
@Code := ~.@BeginCode,
@InsertCode := ~.@InsertChunk,
Expand Down
2 changes: 2 additions & 0 deletions tst/worksheets/general.expected/_Chunks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
<Listing Type="Code"><![CDATA[
Hello, world.
x := 1 + 1;

if x = 2 then
Print("1 + 1 = 2 holds, all is good\n");
else
Error("1+1 <> 2");
fi;
]]></Listing>


<#/GAPDoc>
1 change: 1 addition & 0 deletions tst/worksheets/general.sheet/worksheet.g
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ DeclareOperation( "ThirdOperation", [ IsGroup, IsInt ] );
#! @BeginCode MyCode
#! Hello, world.
x := 1 + 1;

if x = 2 then
Print("1 + 1 = 2 holds, all is good\n");
else
Expand Down