Skip to content

Commit 58edc23

Browse files
authored
Predefine entities VERSION, RELEASEYEAR, RELEASEDATE (#295)
1 parent 31aff21 commit 58edc23

File tree

5 files changed

+55
-1
lines changed

5 files changed

+55
-1
lines changed

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
This file describes changes in the AutoDoc package.
22

3+
2025.12.19
4+
- Don't replace empty lines in `@BeginCode` blocks by `<P/>`
5+
- Fix XML header in generated files (it had a syntax error, which somehow also
6+
slips by GAPDoc; so it caused no problems in practice, but the resulting XML
7+
was strictly speaking invalid)
8+
- Predefine entities `VERSION`, `RELEASEYEAR`, `RELEASEDATE`
9+
310
2025.10.16
411
- Make handling `Date` in `PackageInfo.g` more strict (previously some
512
malformed variants were accepted to deal with very old packages, but by

PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "AutoDoc",
1212
Subtitle := "Generate documentation from GAP source code",
13-
Version := "2025.10.16",
13+
Version := "2025.12.19",
1414

1515
Date := ~.Version{[ 1 .. 10 ]},
1616
Date := Concatenation( ~.Date{[ 9, 10 ]}, "/", ~.Date{[ 6, 7 ]}, "/", ~.Date{[ 1 .. 4 ]} ),

gap/Magic.gd

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@
158158
#! This allows you to write <Q>&amp;SomePackage;</Q> and <Q>&amp;RELEASEYEAR;</Q>
159159
#! in your documentation, which will be replaced by respective values specified
160160
#! in the entities definition.
161+
#! <P/>
162+
#! Note that &AutoDoc; predefines several entities:
163+
#! <List>
164+
#! <Mark><A>VERSION</A></Mark>
165+
#! <Item>Set to the <C>Version</C> field your package info record.</Item>
166+
#! <Mark><A>RELEASEYEAR</A></Mark>
167+
#! <Item>Set to a string containing the release year, as derived
168+
#! from the <C>Date</C> field your package info record.</Item>
169+
#! <Mark><A>RELEASEDATE</A></Mark>
170+
#! <Item>Derived from the <C>Date</C> field your package info record.</Item>
171+
#! <Mark><A>SomePackage</A></Mark>
172+
#! <Item>
173+
#! The precise name of this entity is derived from the
174+
#! <C>PackageName</C> field your package info record. Note
175+
#! that it is case sensitive. The content is defined as
176+
#! suggested by the example above.
177+
#! </Item>
178+
#! </List>
161179
#! </Item>
162180
#!
163181
#! <Mark><A>TitlePage</A></Mark>

gap/Magic.gi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,17 @@ function( arg )
494494
CreateTitlePage( doc_dir, title_page );
495495
fi;
496496

497+
# set some default entities
498+
AUTODOC_SetIfMissing( scaffold, "entities", rec() );
499+
if IsBound( pkginfo.Version ) then
500+
AUTODOC_SetIfMissing( scaffold.entities, "VERSION", pkginfo.Version );
501+
fi;
502+
if IsBound( pkginfo.Date ) then
503+
tmp := AUTODOC_ParseDate( pkginfo.Date );
504+
AUTODOC_SetIfMissing( scaffold.entities, "RELEASEYEAR", tmp.year );
505+
AUTODOC_SetIfMissing( scaffold.entities, "RELEASEDATE", AUTODOC_FormatDate( tmp ) );
506+
fi;
507+
497508
CreateEntitiesPage( gapdoc.bookname, doc_dir, scaffold );
498509

499510
if IsBound( scaffold.MainPage ) and scaffold.MainPage <> false then

tst/manual.expected/_Chapter_AutoDoc.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,24 @@
152152
This allows you to write <Q>&amp;SomePackage;</Q> and <Q>&amp;RELEASEYEAR;</Q>
153153
in your documentation, which will be replaced by respective values specified
154154
in the entities definition.
155+
<P/>
156+
Note that &AutoDoc; predefines several entities:
157+
<List>
158+
<Mark><A>VERSION</A></Mark>
159+
<Item>Set to the <C>Version</C> field your package info record.</Item>
160+
<Mark><A>RELEASEYEAR</A></Mark>
161+
<Item>Set to a string containing the release year, as derived
162+
from the <C>Date</C> field your package info record.</Item>
163+
<Mark><A>RELEASEDATE</A></Mark>
164+
<Item>Derived from the <C>Date</C> field your package info record.</Item>
165+
<Mark><A>SomePackage</A></Mark>
166+
<Item>
167+
The precise name of this entity is derived from the
168+
<C>PackageName</C> field your package info record. Note
169+
that it is case sensitive. The content is defined as
170+
suggested by the example above.
171+
</Item>
172+
</List>
155173
</Item>
156174
<Mark><A>TitlePage</A></Mark>
157175
<Item>

0 commit comments

Comments
 (0)