Skip to content

Commit 37d2532

Browse files
committed
Merge branch 'topic/templates' into 'master'
Reflect changes in VSS's XML Template engine See merge request eng/ide/gnatdoc!34
2 parents 718e903 + e37b569 commit 37d2532

13 files changed

+563
-105
lines changed

share/gnatdoc/html/template/doc.xhtml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html class='main' xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal">
2+
<html class='main' xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.adacore.com/namespaces/tal">
33
<head>
44
<link rel='stylesheet' href='gnatdoc.css'/>
55
</head>
@@ -143,19 +143,19 @@
143143
</div>
144144

145145
<h2>Description</h2>
146-
<div tal:omit-tag='' tal:content='structure gnatdoc/entity/documentation/description'>Description of the entity</div>
146+
<div tal:omit-tag='' tal:content='gnatdoc/entity/documentation/description'>Description of the entity</div>
147147

148148
<div tal:omit-tag='' tal:repeat='item gnatdoc/entity/all'>
149149
<h4 tal:content='item/name' tal:attributes='id item/id'>Entity Name</h4>
150150
<pre class='ada-code-snippet'><code xml:space='preserve' tal:content='item/code'>Source code of the entity declaration</code></pre>
151-
<div tal:omit-tag='' tal:content='structure item/documentation/description'>Description of the entity</div>
151+
<div tal:omit-tag='' tal:content='item/documentation/description'>Description of the entity</div>
152152

153153
<div tal:omit-tag='' tal:condition='item/documentation/enumeration_literals'>
154154
<h5>Enumeration Literal</h5>
155155
<dl>
156156
<div tal:omit-tag='' tal:repeat='literal item/documentation/enumeration_literals'>
157157
<dt tal:content='literal/name'>Name of the literal</dt>
158-
<dd tal:content='structure literal/description'>Description of the literal</dd>
158+
<dd tal:content='literal/description'>Description of the literal</dd>
159159
</div>
160160
</dl>
161161
</div>
@@ -165,7 +165,7 @@
165165
<dl>
166166
<div tal:omit-tag='' tal:repeat='formal item/documentation/fields'>
167167
<dt tal:content='formal/name'>Name of the field</dt>
168-
<dd tal:content='structure formal/description'>Description of the field</dd>
168+
<dd tal:content='formal/description'>Description of the field</dd>
169169
</div>
170170
</dl>
171171
</div>
@@ -175,7 +175,7 @@
175175
<dl>
176176
<div tal:omit-tag='' tal:repeat='formal item/documentation/formals'>
177177
<dt tal:content='formal/name'>name of the parameter</dt>
178-
<dd tal:content='structure formal/description'>description of the parameter</dd>
178+
<dd tal:content='formal/description'>description of the parameter</dd>
179179
</div>
180180
</dl>
181181
</div>
@@ -185,7 +185,7 @@
185185
<dl>
186186
<div tal:omit-tag='' tal:repeat='parameter item/documentation/parameters'>
187187
<dt tal:content='parameter/name'>Name of the parameter</dt>
188-
<dd tal:content='structure parameter/description'>Description of the parameter</dd>
188+
<dd tal:content='parameter/description'>Description of the parameter</dd>
189189
</div>
190190
</dl>
191191
</div>
@@ -194,7 +194,7 @@
194194
<h5>Return Value</h5>
195195
<dl>
196196
<div tal:omit-tag='' tal:repeat='return item/documentation/returns'>
197-
<dd tal:content='structure return/description'>Description of the return value</dd>
197+
<dd tal:content='return/description'>Description of the return value</dd>
198198
</div>
199199
</dl>
200200
</div>
@@ -204,7 +204,7 @@
204204
<dl>
205205
<div tal:omit-tag='' tal:repeat='exception item/documentation/exceptions'>
206206
<dt tal:content='exception/name'>name of the exception</dt>
207-
<dd tal:content='structure exception/description'>description of the exception</dd>
207+
<dd tal:content='exception/description'>description of the exception</dd>
208208
</div>
209209
</dl>
210210
</div>

share/gnatdoc/html/template/index.xhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html class='main' xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.zope.org/namespaces/tal">
2+
<html class='main' xmlns="http://www.w3.org/1999/xhtml" xmlns:tal="http://xml.adacore.com/namespaces/tal">
33
<head>
44
<link rel='stylesheet' href='gnatdoc.css'/>
55
</head>

source/backend/gnatdoc-comments-proxies.adb

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
with VSS.XML.Event_Vectors;
1919
with VSS.XML.Templates.Proxies.Strings;
20+
with VSS.XML.Templates.Values;
2021

2122
with GNATdoc.Backend.HTML_Markup;
2223

@@ -65,19 +66,14 @@ package body GNATdoc.Comments.Proxies is
6566
Name : VSS.Strings.Virtual_String)
6667
return VSS.XML.Templates.Proxies.Abstract_Proxy'Class;
6768

68-
type Text_Markup_Proxy is
69-
limited new VSS.XML.Templates.Proxies.Abstract_Text_Content_Proxy
70-
and VSS.XML.Templates.Proxies.Abstract_Structure_Content_Proxy with
69+
type Markup_Proxy is
70+
limited new VSS.XML.Templates.Proxies.Abstract_Value_Proxy with
7171
record
72-
Text : VSS.String_Vectors.Virtual_String_Vector;
7372
Markup : VSS.XML.Event_Vectors.Vector;
7473
end record;
7574

76-
overriding function Content
77-
(Self : Text_Markup_Proxy) return VSS.Strings.Virtual_String;
78-
79-
overriding function Content
80-
(Self : in out Text_Markup_Proxy) return VSS.XML.Event_Vectors.Vector;
75+
overriding function Value
76+
(Self : Markup_Proxy) return VSS.XML.Templates.Values.Value;
8177

8278
---------------
8379
-- Component --
@@ -126,9 +122,8 @@ package body GNATdoc.Comments.Proxies is
126122
end loop;
127123

128124
return
129-
Text_Markup_Proxy'
130-
(Text => Text,
131-
Markup => GNATdoc.Backend.HTML_Markup.Build_Markup (Text));
125+
Markup_Proxy'
126+
(Markup => GNATdoc.Backend.HTML_Markup.Build_Markup (Text));
132127
end;
133128

134129
elsif Name = "enumeration_literals" then
@@ -176,9 +171,8 @@ package body GNATdoc.Comments.Proxies is
176171

177172
elsif Name = "description" then
178173
return
179-
Text_Markup_Proxy'
180-
(Text => Self.Section.Text,
181-
Markup =>
174+
Markup_Proxy'
175+
(Markup =>
182176
GNATdoc.Backend.HTML_Markup.Build_Markup (Self.Section.Text));
183177

184178
else
@@ -188,26 +182,6 @@ package body GNATdoc.Comments.Proxies is
188182
end if;
189183
end Component;
190184

191-
-------------
192-
-- Content --
193-
-------------
194-
195-
overriding function Content
196-
(Self : Text_Markup_Proxy) return VSS.Strings.Virtual_String is
197-
begin
198-
return Self.Text.Join_Lines (VSS.Strings.LF);
199-
end Content;
200-
201-
-------------
202-
-- Content --
203-
-------------
204-
205-
overriding function Content
206-
(Self : in out Text_Markup_Proxy) return VSS.XML.Event_Vectors.Vector is
207-
begin
208-
return Self.Markup;
209-
end Content;
210-
211185
-------------
212186
-- Element --
213187
-------------
@@ -261,4 +235,14 @@ package body GNATdoc.Comments.Proxies is
261235
return Section_Vectors.Has_Element (Self.Position);
262236
end Next;
263237

238+
-----------
239+
-- Value --
240+
-----------
241+
242+
overriding function Value
243+
(Self : Markup_Proxy) return VSS.XML.Templates.Values.Value is
244+
begin
245+
return (VSS.XML.Templates.Values.Content, Self.Markup);
246+
end Value;
247+
264248
end GNATdoc.Comments.Proxies;

source/frontend/gnatdoc-frontend.adb

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ package body GNATdoc.Frontend is
138138
(Node : Entry_Decl'Class;
139139
Enclosing : not null GNATdoc.Entities.Entity_Information_Access);
140140

141+
procedure Process_Entry_Body
142+
(Node : Entry_Body'Class;
143+
Enclosing : not null GNATdoc.Entities.Entity_Information_Access);
144+
141145
procedure Process_Children
142146
(Parent : Ada_Node'Class;
143147
Enclosing : not null GNATdoc.Entities.Entity_Information_Access);
@@ -443,6 +447,11 @@ package body GNATdoc.Frontend is
443447

444448
return Over;
445449

450+
when Ada_Entry_Body =>
451+
Process_Entry_Body (Node.As_Entry_Body, Enclosing);
452+
453+
return Over;
454+
446455
when Ada_Protected_Body =>
447456
Process_Protected_Body (Node.As_Protected_Body, Enclosing);
448457

@@ -638,6 +647,27 @@ package body GNATdoc.Frontend is
638647
end if;
639648
end Process_Derived_Type_Def;
640649

650+
------------------------
651+
-- Process_Entry_Body --
652+
------------------------
653+
654+
procedure Process_Entry_Body
655+
(Node : Entry_Body'Class;
656+
Enclosing : not null GNATdoc.Entities.Entity_Information_Access)
657+
is
658+
Name : constant Defining_Name := Node.F_Entry_Name;
659+
Entity : constant not null GNATdoc.Entities.Entity_Information_Access :=
660+
new GNATdoc.Entities.Entity_Information'
661+
(Name => To_Virtual_String (Name.Text),
662+
Qualified_Name => To_Virtual_String (Name.P_Fully_Qualified_Name),
663+
Signature => Signature (Name),
664+
Documentation => Extract (Node, GNATdoc.Options.Extractor_Options),
665+
others => <>);
666+
667+
begin
668+
Enclosing.Entries.Insert (Entity);
669+
end Process_Entry_Body;
670+
641671
------------------------
642672
-- Process_Entry_Decl --
643673
------------------------
@@ -1147,7 +1177,7 @@ package body GNATdoc.Frontend is
11471177
do
11481178
case Name.P_Basic_Decl.Kind is
11491179
when Ada_Package_Body | Ada_Subp_Body | Ada_Expr_Function
1150-
| Ada_Subp_Renaming_Decl | Ada_Protected_Body
1180+
| Ada_Subp_Renaming_Decl | Ada_Protected_Body | Ada_Entry_Body
11511181
=>
11521182
Result.Append ('$');
11531183

source/gnatdoc-comments-builders-subprograms.adb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ package body GNATdoc.Comments.Builders.Subprograms is
3131
Node : Libadalang.Analysis.Basic_Decl'Class;
3232
Spec_Node : Libadalang.Analysis.Base_Subp_Spec'Class;
3333
Name_Node : Libadalang.Analysis.Defining_Name'Class;
34+
Family_Node : Libadalang.Analysis.Entry_Index_Spec'Class;
3435
Params_Node : Libadalang.Analysis.Params'Class;
3536
Returns_Node : Libadalang.Analysis.Type_Expr'Class;
3637
Last_Section : out GNATdoc.Comments.Section_Access;
@@ -57,6 +58,13 @@ package body GNATdoc.Comments.Builders.Subprograms is
5758
end if;
5859
end if;
5960

61+
-- Create section of the structured comment for family index.
62+
63+
if not Family_Node.Is_Null then
64+
Self.Process_Component_Declaration (Family_Node);
65+
Self.Process_Defining_Name (Parameter, Family_Node.F_Id);
66+
end if;
67+
6068
-- Create sections of structured comment for parameters, compute
6169
-- line range to extract comments of each parameter.
6270

source/gnatdoc-comments-builders-subprograms.ads

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ package GNATdoc.Comments.Builders.Subprograms is
3232
Node : Libadalang.Analysis.Basic_Decl'Class;
3333
Spec_Node : Libadalang.Analysis.Base_Subp_Spec'Class;
3434
Name_Node : Libadalang.Analysis.Defining_Name'Class;
35+
Family_Node : Libadalang.Analysis.Entry_Index_Spec'Class;
3536
Params_Node : Libadalang.Analysis.Params'Class;
3637
Returns_Node : Libadalang.Analysis.Type_Expr'Class;
3738
Last_Section : out GNATdoc.Comments.Section_Access;
3839
Minimum_Indent : out Langkit_Support.Slocs.Column_Number)
3940
with Pre =>
40-
Spec_Node.Kind in Libadalang.Common.Ada_Entry_Spec
41-
| Libadalang.Common.Ada_Subp_Spec;
41+
Spec_Node.Is_Null -- entry body doesn't have specification node
42+
or else Spec_Node.Kind in Libadalang.Common.Ada_Entry_Spec
43+
| Libadalang.Common.Ada_Subp_Spec;
4244

4345
private
4446

0 commit comments

Comments
 (0)