@@ -144,12 +144,53 @@ package body GNATdoc.Backend.RST is
144144 File : Streams.Output_Text_Stream;
145145 Success : Boolean := True;
146146
147+ procedure Generate_Constant_Documentation
148+ (Indent : VSS.Strings.Virtual_String;
149+ Entity : GNATdoc.Entities.Entity_Information;
150+ Package_Name : VSS.Strings.Virtual_String);
151+ -- Generate documentation for the given constant.
152+
147153 procedure Generate_Subprogram_Documentation
148154 (Indent : VSS.Strings.Virtual_String;
149155 Entity : GNATdoc.Entities.Entity_Information;
150156 Package_Name : VSS.Strings.Virtual_String);
151157 -- Generate documentation for the given subprogram.
152158
159+ -- -----------------------------------
160+ -- Generate_Constant_Documentation --
161+ -- -----------------------------------
162+
163+ procedure Generate_Constant_Documentation
164+ (Indent : VSS.Strings.Virtual_String;
165+ Entity : GNATdoc.Entities.Entity_Information;
166+ Package_Name : VSS.Strings.Virtual_String)
167+ is
168+ use type VSS.Strings.Virtual_String;
169+
170+ begin
171+ File.New_Line (Success);
172+
173+ File.Put (Indent, Success);
174+ File.Put (" .. ada:object:: " , Success);
175+
176+ File.Put (Entity.RST_Profile, Success);
177+ File.New_Line (Success);
178+ File.Put (Indent, Success);
179+ File.Put (" :package: " , Success);
180+ File.Put (Package_Name, Success);
181+ File.New_Line (Success);
182+ File.New_Line (Success);
183+
184+ File.Put_Lines
185+ (GNATdoc.Comments.RST_Helpers.Get_RST_Documentation
186+ (Indent => Indent & " " ,
187+ Documentation => Entity.Documentation,
188+ Pass_Through => Self.Pass_Through,
189+ Code_Snippet => False),
190+ Success);
191+ File.New_Line (Success);
192+ end Generate_Constant_Documentation ;
193+
153194 -- -------------------------------------
154195 -- Generate_Subprogram_Documentation --
155196 -- -------------------------------------
@@ -346,8 +387,9 @@ package body GNATdoc.Backend.RST is
346387 end loop ;
347388 end Union ;
348389
349- Types : Entity_Information_Sets.Set;
350- Methods : Entity_Information_Sets.Set;
390+ Types : Entity_Information_Sets.Set;
391+ Constants : Entity_Information_Sets.Set;
392+ Methods : Entity_Information_Sets.Set;
351393
352394 begin
353395 Union (Types, Entity.Simple_Types);
@@ -389,8 +431,23 @@ package body GNATdoc.Backend.RST is
389431 if Self.OOP_Mode
390432 and then Item.Kind in Ada_Interface_Type | Ada_Tagged_Type
391433 then
434+ Constants.Clear;
392435 Methods.Clear;
393436
437+ for Object of Item.Belongs_Constants loop
438+ if not Is_Private_Entity
439+ (GNATdoc.Entities.To_Entity (Object.Signature))
440+ then
441+ Constants.Insert
442+ (GNATdoc.Entities.To_Entity (Object.Signature));
443+ end if ;
444+ end loop ;
445+
446+ for Object of Constants loop
447+ Generate_Constant_Documentation
448+ (" " , Object.all , Entity.Qualified_Name);
449+ end loop ;
450+
394451 for Method of Item.Belongs_Subprograms loop
395452 if not Is_Private_Entity
396453 (GNATdoc.Entities.To_Entity (Method.Signature))
0 commit comments