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
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
This file describes changes in the AutoDoc package.

## 2026.06.30
- Fix a regression in `.autodoc` parsing where Markdown-style headings
and AutoDoc commands were interpreted inside XML CDATA blocks instead
of being kept as literal text

## 2026.05.11
- Fix an issue when running a `makedoc.g` from outside its package's
directory: if one e.g. did `gap ../somePackage/makedoc.g` and this tried
Expand Down
23 changes: 20 additions & 3 deletions gap/Parser.gi
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
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;
title_item_list, xml_comment_mode, cdata_mode;
groupnumber := 0;
autodoc_read_line := false;
context_stack := [ ];
Expand Down Expand Up @@ -366,13 +366,24 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
fi;
end;
NormalizeInputLine := function( raw_line )
local text, comment_pos;
local text, comment_pos, line_starts_cdata, line_ends_cdata,
is_cdata_line;
if plain_text_mode then
text := raw_line;
line_starts_cdata := AUTODOC_LineStartsCDATA( raw_line );
line_ends_cdata := AUTODOC_LineEndsCDATA( raw_line );
is_cdata_line := cdata_mode or line_starts_cdata;
if line_starts_cdata then
cdata_mode := true;
fi;
if line_ends_cdata then
cdata_mode := false;
fi;
return rec(
raw_text := raw_line,
text := text,
is_autodoc := true,
scan_for_autodoc_commands := not is_cdata_line,
allows_declaration_scan := false
);
fi;
Expand All @@ -383,6 +394,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
raw_text := raw_line,
text := raw_line,
is_autodoc := false,
scan_for_autodoc_commands := false,
allows_declaration_scan := false
);
fi;
Expand All @@ -392,6 +404,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
raw_text := raw_line,
text := text,
is_autodoc := true,
scan_for_autodoc_commands := true,
allows_declaration_scan := true
);
end;
Expand Down Expand Up @@ -706,6 +719,7 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
plain_text_mode := false;
markdown_fence := fail;
xml_comment_mode := false;
cdata_mode := false;
end;
ScanForDeclarationPart := function()
local declare_position;
Expand Down Expand Up @@ -1278,9 +1292,12 @@ InstallGlobalFunction( AutoDoc_Parser_ReadFiles,
fi;
fi;

if current_line_info.is_autodoc then
if current_line_info.scan_for_autodoc_commands then
current_line_fence := MarkdownFenceFromLine( current_line_info.text );
current_command := Scan_for_AutoDoc_Part( current_line_info.text );
elif current_line_info.is_autodoc then
current_line_fence := fail;
current_command := [ "STRING", current_line_info.text ];
else
current_line_fence := fail;
current_command := [ false, current_line ];
Expand Down
7 changes: 7 additions & 0 deletions tst/worksheets/autoplain.expected/_Chapter_Test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ And XML comments should pass through verbatim:
# <ManSection>
# <#/GAPDoc>
-->
And XML CDATA blocks should also keep would-be commands literal:
<Listing><![CDATA[
# PlainCDATAHeading
## PlainCDATASection
@Section PlainCDATACommand
#! PlainCDATAComment
]]></Listing>
And we wrap up with some dummy text
</Subsection>

Expand Down
7 changes: 7 additions & 0 deletions tst/worksheets/autoplain.sheet/plain.autodoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@ And XML comments should pass through verbatim:
# <ManSection>
# <#/GAPDoc>
-->
And XML CDATA blocks should also keep would-be commands literal:
<Listing><![CDATA[
# PlainCDATAHeading
## PlainCDATASection
@Section PlainCDATACommand
#! PlainCDATAComment
]]></Listing>
And we wrap up with some dummy text