Debian Codegraph @

progs/arm_html.adb

raw
1 with -- ARM_Output,
2 -- ARM_Contents,
3 -- Ada.Text_IO,
4 Ada.Exceptions,
5 Ada.Strings.Maps.Constants,
6 Ada.Strings.Fixed,
7 Ada.Unchecked_Deallocation;
8 package body ARM_HTML is
9
10 --
11 -- Ada reference manual formatter (ARM_Form).
12 --
13 -- This package defines the HTML output object.
14 -- Output objects are responsible for implementing the details of
15 -- a particular format.
16 --
17 -- ---------------------------------------
18 -- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
19 -- 2008, 2009, 2011, 2012, 2013, 2016, 2018, 2019
20 -- AXE Consultants. All rights reserved.
21 -- P.O. Box 1512, Madison WI 53701
22 -- E-Mail: [email protected]
23 --
24 -- ARM_Form is free software: you can redistribute it and/or modify
25 -- it under the terms of the GNU General Public License version 3
26 -- as published by the Free Software Foundation.
27 --
28 -- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
29 -- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
30 -- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
31 -- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
32 -- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
33 -- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
34 -- DAMAGES.
35 --
36 -- A copy of the GNU General Public License is available in the file
37 -- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
38 -- Otherwise, see <http://www.gnu.org/licenses/>.
39 --
40 -- If the GPLv3 license is not satisfactory for your needs, a commercial
41 -- use license is available for this tool. Contact Randy at AXE Consultants
42 -- for more information.
43 --
44 -- ---------------------------------------
45 --
46 -- Edit History:
47 --
48 -- 4/19/00 - RLB - Created base package.
49 -- 4/21/00 - RLB - Added line break and hard space routines.
50 -- 4/24/00 - RLB - Added DR references and Insert/Delete text formats.
51 -- 4/25/00 - RLB - Added size to format.
52 -- 4/26/00 - RLB - Added paragraph formats.
53 -- 4/29/00 - RLB - Added more paragraph formats.
54 -- 5/10/00 - RLB - Added even more formats.
55 -- - RLB - Added End_Hang_Item.
56 -- 5/12/00 - RLB - Added No_Prefix to Start_Paragraph.
57 -- 5/13/00 - RLB - Added Special_Character.
58 -- 5/16/00 - RLB - Added additional special characters.
59 -- 5/17/00 - RLB - Added New_Page.
60 -- 5/22/00 - RLB - Added Includes_Changes to Create.
61 -- 5/23/00 - RLB - Added multi-column formats and New_Column.
62 -- - Added Tab_Info and Tab_Stops.
63 -- 5/24/00 - RLB - Added Location to Text_Format.
64 -- - RLB - Added No_Breaks and Keep_with_Next to Start_Paragraph.
65 -- 5/25/00 - RLB - Added Big_Files to Create. Added Justification.
66 -- - RLB - Added Separator_Lines and TOC routines.
67 -- - RLB - Added "Legal" to the footer, pointing at the title page.
68 -- 5/26/00 - RLB - Added table operations.
69 -- 5/28/00 - RLB - Added index references.
70 -- 6/ 2/00 - RLB - Added Soft_Line_Break.
71 -- 8/ 2/00 - RLB - Added Soft_Hyphen_Break and left and right quote
72 -- characters.
73 -- - RLB - Added additional styles.
74 -- 8/ 7/00 - RLB - Added Leading flag to Start_Paragraph, removed "Leading"
75 -- styles.
76 -- 8/11/00 - RLB - Added Hanging_in_Bulleted styles.
77 -- 8/16/00 - RLB - Added Code_Indented_Nested_Bulleted.
78 -- 8/17/00 - RLB - Replaced "Leading" by "Space_After".
79 -- - RLB - Added Nested_Enumerated.
80 -- 8/22/00 - RLB - Added Revised_Clause_Header.
81 -- 9/ 8/00 - RLB - Removed soft hyphen, as this does not work on either
82 -- browser I tried.
83 -- 9/26/00 - RLB - Added Syntax_Summary style.
84 -- 9/27/00 - RLB - Added tab emulation when in the fixed font.
85 -- 9/28/00 - RLB - Added some style sheets.
86 -- - RLB - Updated to use absolute positioning for paragraph
87 -- numbers (this looks much better than floating).
88 -- 7/18/01 - RLB - Added "Indented" style to supported styles for
89 -- multi-column.
90 -- - RLB - Implemented single "Big-File" support.
91 -- 7/18/02 - RLB - Removed Document parameter from Create, replaced by
92 -- three strings and For_ISO boolean.
93 -- - RLB - Added AI_Reference.
94 -- - RLB - Added Change_Version_Type and uses.
95 -- 1/15/03 - RLB - Removed space from DIV.paranum, as it doesn't validate
96 -- with it.
97 -- 4/10/03 - RLB - Updated to add access to search pages (not generated
98 -- here; make them by hand, it only needs to be done once).
99 -- - RLB - Updated to insure that changes are separated by a space.
100 -- 4/11/03 - RLB - Changed some formats to meet WC3 validation requirements.
101 -- 9/09/04 - RLB - Removed unused junk noted by Stephen Leake.
102 -- 9/10/04 - RLB - Added "Both" to possible changes to handle
103 -- replacement of changed text.
104 -- 9/14/04 - RLB - Moved Change_Version_Type to ARM_Contents.
105 -- - RLB - Changed to use left/right quotes whether or not Unicode
106 -- is being used. (These work on IE, but not on old
107 -- Netscape.)
108 -- 9/16/04 - RLB - Added a charset meta in the header, so that browsers
109 -- can't misinterpret these documents.
110 -- 11/03/04 - RLB - Added Nested_X2_Bulleted.
111 -- 11/15/04 - RLB - Added Indented_Nested_Bulleted.
112 -- 12/15/04 - RLB - Added wider columns.
113 -- 1/24/05 - RLB - Added Inner_Indented.
114 -- 2/ 1/05 - RLB - Added Turkish chars to allow an AARM note.
115 -- 3/15/05 - RLB - Turned on Unicode characters at Pascal's insistence.
116 -- 3/17/05 - RLB - Removed ceiling and floor characters because they don't
117 -- work on Windows.
118 -- 4/ 7/05 - RLB - Added "Related Documents" link, so users can go between
119 -- the RM and AARM (and also so that they see the ARA
120 -- sponsor ads).
121 -- 5/27/05 - RLB - Added arbitrary Unicode characters.
122 -- 1/11/06 - RLB - Eliminated dispatching Create in favor of tailored
123 -- versions.
124 -- 1/12/06 - RLB - Added a number of parameters to Create.
125 -- 1/16/06 - RLB - Reduced space around button bars.
126 -- 1/18/06 - RLB - Added additional styles.
127 -- 1/19/06 - RLB - Added code so that only styles that are used are
128 -- included in the result (this decreases the minimum
129 -- file size by a lot).
130 -- 1/21/06 - RLB - Specified leading for Swiss example styles, because
131 -- they are too close otherwise.
132 -- 1/28/06 - RLB - Changed so that button highlights are removed correctly.
133 -- - RLB - Added tab emulation settings.
134 -- 2/ 8/06 - RLB - Added additional parameters to the table command.
135 -- 2/10/06 - RLB - Added even more additional parameters to the
136 -- table command.
137 -- - RLB - Added picture command.
138 -- 2/19/06 - RLB - Added Number_Paragraphs flag and large letter count.
139 -- 3/01/06 - RLB - Fixed bug in Text_Format when changing fonts.
140 -- 3/03/06 - RLB - Moved paragraph numbers down slightly; this looks a lot
141 -- better on Firefox, and better even on IE.
142 -- - RLB - Added Optimize_for_Firefox flag, and associated style
143 -- changes.
144 -- - RLB - Added code so that spaces after an opening tag
145 -- and before a closing tag are converted to non-breaking.
146 -- 3/28/06 - RLB - Removed unnecessary space from headers.
147 -- 3/30/06 - RLB - Added a bit of space around inline pictures.
148 -- 9/21/06 - RLB - Added Body_Font.
149 -- 9/22/06 - RLB - Added Subsubclause.
150 -- 9/23/06 - RLB - Fixed bug in borderless tables.
151 -- 9/25/06 - RLB - Handled optional renaming of TOC.
152 -- - RLB - Added Last_Column_Width to Start_Table.
153 -- - RLB - Fixed broken enumerated style.
154 -- 10/13/06 - RLB - Added specifiable colors.
155 -- - RLB - Added Local_Link_Start and Local_Link_End to allow
156 -- formatting in the linked text.
157 -- 11/10/06 - RLB - Fixed nesting of text formatting *again*. (AARM 13.11
158 -- failed WC 3 validation.)
159 -- 2/ 9/07 - RLB - Changed comments on AI_Reference.
160 -- 2/14/07 - RLB - Revised to separate style and indent information
161 -- for paragraphs.
162 -- 2/15/07 - RLB - Redid enumeration and bullet indenting to make the
163 -- formats work consistently on Firefox and IE.
164 -- 2/19/07 - RLB - Added Title style.
165 -- 12/14/07 - RLB - Added code to support multi-column text without
166 -- requiring New_Column calls.
167 -- 12/18/07 - RLB - Added Plain_Annex.
168 -- 12/19/07 - RLB - Added DOS_Filename flag.
169 -- - RLB - Added limited colors to Text_Format.
170 -- 1/02/08 - RLB - Made DOS filenames into all CAPS.
171 -- 5/ 7/09 - RLB - Added code to prevent making links to dead clauses.
172 -- 10/18/11 - RLB - Changed to GPLv3 license.
173 -- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header.
174 -- 2/15/12 - RLB - Removed horizontal rules from page breaks in HTML;
175 -- they never are necessary and cause weird looks for
176 -- breaks put in solely to make the "final" version look
177 -- good in PDF form.
178 -- 5/18/12 - RLB - Added anchors to each paragraph number as suggested
179 -- on comp.lang.ada.
180 -- 8/31/12 - RLB - Added Output_Path.
181 -- 10/18/12 - RLB - Added additional hanging styles.
182 -- 11/26/12 - RLB - Added subdivision names to Clause_Header and
183 -- Revised_Clause_Header.
184 -- 12/17/12 - RLB - Added AI12 references. Defined a change color for
185 -- "version 4" (Ada 202x).
186 -- 3/26/13 - RLB - Added Script_HTML.
187 -- 2/ 8/16 - RLB - Added styles for the Ada-Auth.org header.
188 -- - Defined change colors for versions 5 and 6. (Actually
189 -- "borrowed" the color for version 2, so the new colors
190 -- are for version 2 and 6. Can't use dark blue, as links
191 -- are that color.)
192 -- 3/ 3/16 - RLB - The color change is hell on the RR manuals. Redid
193 -- it to switch the colors only if version 5 is in use.
194 -- 4/20/16 - RLB - Slightly increased the base indent as a lot of
195 -- paragraph numbers are overlapping.
196 -- - Added Force_New_Revision_Colors.
197 -- 3/ 8/18 - RLB - Increased the size of the HTML re-read line buffer.
198 -- 2/19/19 - RLB - Added some (commented out) hang tracing.
199
200 LINE_LENGTH : constant := 78;
201 -- Maximum intended line length.
202
203 SWISS_FONT_CODE : constant String := "<font face=""Arial, Helvetica"">";
204
205 SMALL_SWISS_FONT_CODE : constant String := "<font face=""Arial, Helvetica"" size=-1>";
206
207 TINY_SWISS_FONT_CODE : constant String := "<font face=""Arial, Helvetica"" size=-2>";
208
209 LEADING_PERCENT : constant := 70;
210 -- Leading is 70% of normal height.
211 TRAILING_PERCENT : constant := 150;
212 -- Leading is 150% of normal height.
213
214 INDENT_EMS_FOR_PARANUMS : constant := 18;
215 -- Indent *all* text (for HTML 4) this amount to leave (some) room for
216 -- the paragraph numbers. In 0.1 EMs.
217
218 OPTIMIZE_FOR_FIREFOX : constant Boolean := True;
219 -- If True, we'll optimize for Firefox; otherwise, we'll optimize for
220 -- IE 6. Note that IE generally shows the Firefox code better than
221 -- Firefox shows the IE code, so we generally recommend setting to
222 -- True unless IE must be perfect. (Modern versions of IE are more
223 -- like Firefox, so it's unlikely that setting this to False should
224 -- be needed.)
225
226 type Tag_Kind is (DIV, UL, DL);
227
228 type Format_Info_Type is record
229 Defined: Boolean := False;
230 Tag : Tag_Kind;
231 Size : Integer; -- In relative "units" (based on the normal size). A unit is 125%/80% of normal.
232 Font : ARM_Output.Font_Family_Type;
233 Indent : Natural; -- In "units". (A unit is = 2EM of the full sized font).
234 Right_Indent : Natural; -- In "units". (A unit is = 2EM of the full sized font).
235 Hang_Outdent : Natural; -- In "units". (A unit is = 2EM of the full sized font).
236 -- This is the amount that the hanging text hangs out. Normal
237 -- text starts at Hang_Outdent + Indent "units".
238 Before : Integer; -- Vertical space before in 0.1 EM.
239 After : Natural; -- Vertical space after in 0.1 EM.
240 end record;
241
242 -- In the following, "Default" means the Body_Font.
243 Paragraph_Info : array
244 (ARM_Output.Paragraph_Style_Type, ARM_Output.Paragraph_Indent_Type) of
245 Format_Info_Type;
246 -- Defined below in the body of the package.
247
248 -- Are the various styles used??
249 Paragraph_Used : array (ARM_Output.Paragraph_Style_Type,
250 ARM_Output.Paragraph_Indent_Type) of Boolean;
251 Revision_Used : array (ARM_Contents.Change_Version_Type) of Boolean;
252 Paranum_Used : Boolean;
253
254
255 procedure Free is new Ada.Unchecked_Deallocation (Column_Text_Item_Type, Column_Text_Ptr);
256
257 function Make_Clause_Anchor_Name (Output_Object : in HTML_Output_Type;
258 Clause_Number : in String) return String is
259 -- Internal routine.
260 -- Returns the Clause anchor name for the current output object and
261 -- Clause_Number.
262 Clause_Name : String(1..10);
263 Clause_Name_Len : Natural;
264 begin
265 if Clause_Number'Length >= 7 and then
266 Clause_Number(Clause_Number'First .. Clause_Number'First + 5) =
267 "Annex " then
268 Clause_Name(1) := Clause_Number(Clause_Number'First + 6);
269 -- We only want the letter.
270 Clause_Name_Len := 1;
271 else
272 Clause_Name_Len := Clause_Number'Length;
273 Clause_Name(1..Clause_Name_Len) := Clause_Number;
274 for I in 1 .. Clause_Name_Len loop
275 if Clause_Name(I) = '.' then
276 Clause_Name(I) := '-';
277 end if;
278 end loop;
279 end if;
280 if Output_Object.DOS_Filenames and (not Output_Object.Big_Files) then
281 -- If the section number is a single character, then
282 -- prefix it with '-':
283 if Clause_Name_Len = 1 then
284 Clause_Name(2) := Clause_Name(1);
285 Clause_Name(1) := '-';
286 Clause_Name_Len := 2;
287 elsif Clause_Name_Len = 2 then
288 null;
289 else
290 if Clause_Name(2) = '-' then
291 Clause_Name(2..Clause_Name_Len+1) :=
292 Clause_Name(1..Clause_Name_Len);
293 Clause_Name(1) := '-';
294 Clause_Name_Len := Clause_Name_Len + 1;
295 end if;
296 -- OK, the section name is exactly two characters.
297 -- Figure out the Clause name.
298 if Clause_Name_Len < 4 or else
299 Clause_Name(3) /= '-' or else
300 Clause_Name(4) not in '0'..'9' or else
301 (Clause_Name_Len >= 5 and then
302 Clause_Name(5) /= '-' and then Clause_Name(5) not in '0'..'9') or else
303 (Clause_Name_Len >= 6 and then
304 Clause_Name(5) /= '-' and then Clause_Name(6) /= '-') then
305 -- The clause number is 1 or 2 digits following a '-',
306 -- and is either the end of the string or followed by a '-'.
307 Ada.Exceptions.Raise_Exception (Program_Error'Identity,
308 "Weird clause number:" & Clause_Number);
309 elsif Clause_Name_Len = 4 or else Clause_Name(5) = '-' then
310 -- Clause is a single digit.
311 Clause_Name(3..Clause_Name_Len-1) :=
312 Clause_Name(4..Clause_Name_Len);
313 Clause_Name_Len := Clause_Name_Len - 1;
314 elsif Clause_Name(4) = '1' then
315 -- Clause is 10..19
316 Clause_Name(3) := Character'Val(
317 Character'Pos(Clause_Name(5))-Character'Pos('0')+Character'Pos('A'));
318 Clause_Name(4..Clause_Name_Len-2) :=
319 Clause_Name(6..Clause_Name_Len);
320 Clause_Name_Len := Clause_Name_Len - 2;
321 elsif Clause_Name(4) = '2' then
322 -- Clause is 20..29
323 Clause_Name(3) := Character'Val(
324 Character'Pos(Clause_Name(5))-Character'Pos('0')+Character'Pos('A')+10);
325 Clause_Name(4..Clause_Name_Len-2) :=
326 Clause_Name(6..Clause_Name_Len);
327 Clause_Name_Len := Clause_Name_Len - 2;
328 elsif Clause_Name(4) = '3' then
329 -- Clause is 30..39
330 if Clause_Name(5) > '5' then
331 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
332 "MS-DOS filename: Clause too large=" & Clause_Number);
333 end if;
334 Clause_Name(3) := Character'Val(
335 Character'Pos(Clause_Name(5))-Character'Pos('0')+Character'Pos('A')+20);
336 Clause_Name(4..Clause_Name_Len-2) :=
337 Clause_Name(6..Clause_Name_Len);
338 Clause_Name_Len := Clause_Name_Len - 2;
339 else
340 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
341 "MS-DOS filename: Clause too large=" & Clause_Number);
342 end if;
343 -- OK, the section number is exactly two characters, and the
344 -- clause number is exactly one. Figure out the subclause
345 -- name:
346 if Clause_Name_Len = 3 then
347 null; -- We're done, no subclause.
348 elsif Clause_Name_Len < 5 or else
349 Clause_Name(4) /= '-' or else
350 Clause_Name(5) not in '0'..'9' or else
351 (Clause_Name_Len >= 6 and then
352 Clause_Name(6) /= '-' and then Clause_Name(6) not in '0'..'9') or else
353 (Clause_Name_Len >= 7 and then
354 Clause_Name(6) /= '-' and then Clause_Name(7) /= '-') then
355 -- The subclause number is 1 or 2 digits following a '-',
356 -- and is either the end of the string or followed by a '-'.
357 Ada.Exceptions.Raise_Exception (Program_Error'Identity,
358 "Weird subclause number:" & Clause_Number);
359 elsif Clause_Name_Len = 5 or else Clause_Name(6) = '-' then
360 -- SubClause is a single digit.
361 Clause_Name(4..Clause_Name_Len-1) :=
362 Clause_Name(5..Clause_Name_Len);
363 Clause_Name_Len := Clause_Name_Len - 1;
364 elsif Clause_Name(5) = '1' then
365 -- SubClause is 10..19
366 Clause_Name(4) := Character'Val(
367 Character'Pos(Clause_Name(6))-Character'Pos('0')+Character'Pos('A'));
368 Clause_Name(5..Clause_Name_Len-2) :=
369 Clause_Name(7..Clause_Name_Len);
370 Clause_Name_Len := Clause_Name_Len - 2;
371 elsif Clause_Name(5) = '2' then
372 -- SubClause is 20..29
373 Clause_Name(4) := Character'Val(
374 Character'Pos(Clause_Name(6))-Character'Pos('0')+Character'Pos('A')+10);
375 Clause_Name(5..Clause_Name_Len-2) :=
376 Clause_Name(7..Clause_Name_Len);
377 Clause_Name_Len := Clause_Name_Len - 2;
378 elsif Clause_Name(5) = '3' then
379 -- SubClause is 30..39
380 if Clause_Name(6) > '5' then
381 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
382 "MS-DOS filename: Subclause too large=" & Clause_Number);
383 end if;
384 Clause_Name(4) := Character'Val(
385 Character'Pos(Clause_Name(6))-Character'Pos('0')+Character'Pos('A')+20);
386 Clause_Name(5..Clause_Name_Len-2) :=
387 Clause_Name(7..Clause_Name_Len);
388 Clause_Name_Len := Clause_Name_Len - 2;
389 else
390 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
391 "MS-DOS filename: Subclause too large=" & Clause_Number);
392 end if;
393 -- OK, the section number is exactly two characters, and the
394 -- clause number is one, and the subclause number is one or zero.
395 -- Figure out the subsubclause name:
396 if Clause_Name_Len < 5 then
397 null; -- We're done, no subsubclause.
398 elsif Clause_Name_Len < 6 or else
399 Clause_Name(5) /= '-' or else
400 Clause_Name(6) not in '0'..'9' or else
401 (Clause_Name_Len >= 7 and then
402 Clause_Name(7) not in '0'..'9') or else
403 (Clause_Name_Len >= 8) then
404 -- The subsubclause number is 1 or 2 digits following a '-',
405 -- and is the end of the string
406 Ada.Exceptions.Raise_Exception (Program_Error'Identity,
407 "Weird subclause number:" & Clause_Number);
408 elsif Clause_Name_Len = 6 then
409 -- SubSubClause is a single digit.
410 Clause_Name(5) := Clause_Name(6);
411 Clause_Name_Len := 5;
412 elsif Clause_Name(6) = '1' then
413 -- SubSubClause is 10..19
414 Clause_Name(5) := Character'Val(
415 Character'Pos(Clause_Name(7))-Character'Pos('0')+Character'Pos('A'));
416 Clause_Name_Len := 5;
417 elsif Clause_Name(5) = '2' then
418 -- SubSubClause is 20..29
419 Clause_Name(5) := Character'Val(
420 Character'Pos(Clause_Name(7))-Character'Pos('0')+Character'Pos('A')+10);
421 Clause_Name_Len := 5;
422 elsif Clause_Name(5) = '3' then
423 -- SubSubClause is 30..39
424 if Clause_Name(6) > '5' then
425 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
426 "MS-DOS filename: Subsubclause too large=" & Clause_Number);
427 end if;
428 Clause_Name(5) := Character'Val(
429 Character'Pos(Clause_Name(7))-Character'Pos('0')+Character'Pos('A')+20);
430 Clause_Name_Len := 5;
431 else
432 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
433 "MS-DOS filename: Subsubclause too large=" & Clause_Number);
434 end if;
435 end if;
436 end if;
437 return Clause_Name(1..Clause_Name_Len);
438 end Make_Clause_Anchor_Name;
439
440
441 function Make_Clause_File_Name (Output_Object : in HTML_Output_Type;
442 Clause_Number : in String) return String is
443 -- Internal routine.
444 -- Returns the Clause file name for the current output object and
445 -- Clause_Number. This does not include any path or extension.
446 begin
447 if Output_Object.Big_Files then -- One big file.
448 return Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right);
449 else -- Clause files.
450 if Output_Object.DOS_Filenames then
451 return Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
452 Make_Clause_Anchor_Name (Output_Object, Clause_Number);
453 else
454 return Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
455 "-" & Make_Clause_Anchor_Name (Output_Object, Clause_Number);
456 end if;
457 end if;
458 end Make_Clause_File_Name;
459
460
461 function Make_Clause_Link_Name (Output_Object : in HTML_Output_Type;
462 Clause_Number : in String) return String is
463 -- Internal routine.
464 -- Returns the link name for a link to the given clause.
465 begin
466 if Output_Object.Big_Files then -- One big file.
467 -- Note this is a self-reference, so the file name is not needed.
468 return "#" & Make_Clause_Anchor_Name (Output_Object, Clause_Number);
469 else -- Clause files.
470 if Output_Object.DOS_Filenames then
471 return Make_Clause_File_Name (Output_Object, Clause_Number) & ".HTM";
472 else
473 return Make_Clause_File_Name (Output_Object, Clause_Number) & ".html";
474 end if;
475 end if;
476 end Make_Clause_Link_Name;
477
478
479 procedure Put_EMs (Fyle : in Ada.Text_IO.File_Type;
480 Value : in Natural) is
481 -- Put an EMs Value (Value is in 0.1 EM).
482 begin
483 if Value <= 9 then
484 Ada.Text_IO.Put (Fyle, '0');
485 elsif Value <= 99 then
486 Ada.Text_IO.Put (Fyle, Character'Val(Character'Pos('0') + (Value / 10)));
487 else
488 Ada.Text_IO.Put (Fyle, Natural'Image (Value / 10));
489 end if;
490 Ada.Text_IO.Put (Fyle, '.');
491 Ada.Text_IO.Put (Fyle, Character'Val(Character'Pos('0') + (Value Mod 10)));
492 Ada.Text_IO.Put (Fyle, "em");
493 end Put_EMs;
494
495
496 procedure Make_Navigation_Bar (Output_Object : in out HTML_Output_Type;
497 Is_Top : in Boolean) is
498 -- Internal routine.
499 -- Generate a properly formatted navigation bar.
500 Clause : constant String :=
501 Ada.Strings.Unbounded.To_String(Output_Object.Current_Clause);
502 begin
503 if Output_Object.Use_Buttons then
504 if Is_Top and then Output_Object.HTML_Kind > HTML_3 then
505 Ada.Text_IO.Put (Output_Object.Output_File, "<div style=""margin-top: 0.6em; margin-bottom: 0.0em"">");
506 elsif (not Is_Top) and then Output_Object.HTML_Kind > HTML_3 then
507 Ada.Text_IO.Put (Output_Object.Output_File, "<div style=""margin-top: 0.0em; margin-bottom: 0.6em"">");
508 else
509 Ada.Text_IO.Put (Output_Object.Output_File, "<P>");
510 end if;
511 Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
512 if Output_Object.Big_Files then
513 Ada.Text_IO.Put (Output_Object.Output_File, "#TOC");
514 elsif Output_Object.DOS_Filenames then
515 Ada.Text_IO.Put (Output_Object.Output_File,
516 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
517 "-TOC.HTM");
518 else
519 Ada.Text_IO.Put (Output_Object.Output_File,
520 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
521 "-TOC.html");
522 end if;
523 if Output_Object.DOS_Filenames then
524 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""CONT.GIF"" ALT=""Contents"" BORDER=0></A>&nbsp;");
525 -- Border=0 prevents the link highlight from being applied.
526 else
527 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""cont.gif"" ALT=""Contents"" BORDER=0></A>&nbsp;");
528 -- Border=0 prevents the link highlight from being applied.
529 end if;
530 if Ada.Strings.Unbounded.Length(Output_Object.Index_URL) /= 0 then
531 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;<A HREF=""");
532 Ada.Text_IO.Put (Output_Object.Output_File,
533 Ada.Strings.Unbounded.To_String(Output_Object.Index_URL));
534 if Output_Object.DOS_Filenames then
535 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""INDEX.GIF"" ALT=""Index"" BORDER=0></A>&nbsp;");
536 else
537 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""index.gif"" ALT=""Index"" BORDER=0></A>&nbsp;");
538 end if;
539 else -- Link to the section named "Index".
540 begin
541 -- Note: We do the following in one big glup so that if
542 -- Not_Found_Error is raised, nothing is output.
543 if Output_Object.DOS_Filenames then
544 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;<A HREF=""" &
545 Make_Clause_Link_Name (Output_Object,
546 ARM_Contents.Lookup_Clause_Number ("Index" & (6 .. ARM_Contents.Title_Type'Last => ' '))) &
547 """><IMG SRC=""INDEX.GIF"" ALT=""Index"" BORDER=0></A>&nbsp;");
548 else
549 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;<A HREF=""" &
550 Make_Clause_Link_Name (Output_Object,
551 ARM_Contents.Lookup_Clause_Number ("Index" & (6 .. ARM_Contents.Title_Type'Last => ' '))) &
552 """><IMG SRC=""index.gif"" ALT=""Index"" BORDER=0></A>&nbsp;");
553 end if;
554 exception
555 when ARM_Contents.Not_Found_Error =>
556 null; -- No section named "Index".
557 end;
558 end if;
559 if Ada.Strings.Unbounded.Length(Output_Object.Ref_URL) /= 0 then
560 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;<A HREF=""");
561 Ada.Text_IO.Put (Output_Object.Output_File,
562 Ada.Strings.Unbounded.To_String(Output_Object.Ref_URL));
563 if Output_Object.DOS_Filenames then
564 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""LIB.GIF"" ALT=""References"" BORDER=0></A>&nbsp;");
565 else
566 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""lib.gif"" ALT=""References"" BORDER=0></A>&nbsp;");
567 end if;
568 else -- Link to the section named "References".
569 begin
570 -- Note: We do the following in one big glup so that if
571 -- Not_Found_Error is raised, nothing is output.
572 if Output_Object.DOS_Filenames then
573 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;<A HREF=""" &
574 Make_Clause_Link_Name (Output_Object,
575 ARM_Contents.Lookup_Clause_Number ("References" & (11 .. ARM_Contents.Title_Type'Last => ' '))) &
576 """><IMG SRC=""LIB.GIF"" ALT=""References"" BORDER=0></A>&nbsp;");
577 else
578 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;<A HREF=""" &
579 Make_Clause_Link_Name (Output_Object,
580 ARM_Contents.Lookup_Clause_Number ("References" & (11 .. ARM_Contents.Title_Type'Last => ' '))) &
581 """><IMG SRC=""lib.gif"" ALT=""References"" BORDER=0></A>&nbsp;");
582 end if;
583 exception
584 when ARM_Contents.Not_Found_Error =>
585 null; -- No section named "References".
586 end;
587 end if;
588 if Ada.Strings.Unbounded.Length(Output_Object.Srch_URL) /= 0 then
589 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;<A HREF=""");
590 Ada.Text_IO.Put (Output_Object.Output_File,
591 Ada.Strings.Unbounded.To_String(Output_Object.Srch_URL));
592 if Output_Object.DOS_Filenames then
593 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""FIND.GIF"" ALT=""Search"" BORDER=0></A>&nbsp;");
594 else
595 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""find.gif"" ALT=""Search"" BORDER=0></A>&nbsp;");
596 end if;
597 else -- Link to the section named "References".
598 begin
599 -- Note: We do the following in one big glup so that if
600 -- Not_Found_Error is raised, nothing is output.
601 if Output_Object.DOS_Filenames then
602 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;<A HREF=""" &
603 Make_Clause_Link_Name (Output_Object,
604 ARM_Contents.Lookup_Clause_Number ("Search" & (7 .. ARM_Contents.Title_Type'Last => ' '))) &
605 """><IMG SRC=""FIND.GIF"" ALT=""Search"" BORDER=0></A>&nbsp;");
606 else
607 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;<A HREF=""" &
608 Make_Clause_Link_Name (Output_Object,
609 ARM_Contents.Lookup_Clause_Number ("Search" & (7 .. ARM_Contents.Title_Type'Last => ' '))) &
610 """><IMG SRC=""find.gif"" ALT=""Search"" BORDER=0></A>&nbsp;");
611 end if;
612 exception
613 when ARM_Contents.Not_Found_Error =>
614 null; -- No section named "Index".
615 end;
616 end if;
617 if Clause /= "" then
618 begin
619 -- Note: We do the following in one big glup so that if
620 -- Not_Found_Error is raised, nothing is output.
621 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;<A HREF=""" &
622 Make_Clause_Link_Name (Output_Object,
623 ARM_Contents.Previous_Clause(Clause)));
624 if Output_Object.DOS_Filenames then
625 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""PREV.GIF"" ALT=""Previous"" BORDER=0></A>&nbsp;");
626 else
627 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""prev.gif"" ALT=""Previous"" BORDER=0></A>&nbsp;");
628 end if;
629 exception
630 when ARM_Contents.Not_Found_Error =>
631 null; -- Probably the first section.
632 end;
633 begin
634 -- Note: We do the following in one big glup so that if
635 -- Not_Found_Error is raised, nothing is output.
636 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;<A HREF=""" &
637 Make_Clause_Link_Name (Output_Object,
638 ARM_Contents.Next_Clause(Clause)));
639 if Output_Object.DOS_Filenames then
640 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""NEXT.GIF"" ALT=""Next"" BORDER=0></A>&nbsp;");
641 else
642 Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""next.gif"" ALT=""Next"" BORDER=0></A>&nbsp;");
643 end if;
644 exception
645 when ARM_Contents.Not_Found_Error =>
646 null; -- Probably the last section.
647 end;
648 end if;
649 if Output_Object.HTML_Kind > HTML_3 then
650 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</div>");
651 else
652 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</P>");
653 end if;
654 else -- Use text navigation
655 Ada.Text_IO.Put (Output_Object.Output_File, "<P><A HREF=""");
656 if Output_Object.Big_Files then
657 Ada.Text_IO.Put (Output_Object.Output_File, "#TOC");
658 elsif Output_Object.DOS_Filenames then
659 Ada.Text_IO.Put (Output_Object.Output_File,
660 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
661 "-TOC.HTM");
662 else
663 Ada.Text_IO.Put (Output_Object.Output_File,
664 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
665 "-TOC.html");
666 end if;
667 Ada.Text_IO.Put (Output_Object.Output_File, """>Contents</A>");
668 if Ada.Strings.Unbounded.Length(Output_Object.Index_URL) /= 0 then
669 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;");
670 Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
671 Ada.Text_IO.Put (Output_Object.Output_File,
672 Ada.Strings.Unbounded.To_String(Output_Object.Index_URL));
673 Ada.Text_IO.Put (Output_Object.Output_File, """>Index</A>");
674 else -- Link to the section named "Index".
675 begin
676 -- Note: We do the following in one big glup so that if
677 -- Not_Found_Error is raised, nothing is output.
678 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;<A HREF=""" &
679 Make_Clause_Link_Name (Output_Object,
680 ARM_Contents.Lookup_Clause_Number ("Index" & (6 .. ARM_Contents.Title_Type'Last => ' '))) &
681 """>Index</A>");
682 exception
683 when ARM_Contents.Not_Found_Error =>
684 null; -- No section named "Index".
685 end;
686 end if;
687 if Ada.Strings.Unbounded.Length(Output_Object.Srch_URL) /= 0 then
688 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;");
689 Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
690 Ada.Text_IO.Put (Output_Object.Output_File,
691 Ada.Strings.Unbounded.To_String(Output_Object.Srch_URL));
692 Ada.Text_IO.Put (Output_Object.Output_File, """>Search</A>");
693 else -- Link to the section named "Search".
694 begin
695 -- Note: We do the following in one big glup so that if
696 -- Not_Found_Error is raised, nothing is output.
697 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;<A HREF=""" &
698 Make_Clause_Link_Name (Output_Object,
699 ARM_Contents.Lookup_Clause_Number ("Search" & (7 .. ARM_Contents.Title_Type'Last => ' '))) &
700 """>Search</A>");
701 exception
702 when ARM_Contents.Not_Found_Error =>
703 null; -- No section named "Search".
704 end;
705 end if;
706 if Ada.Strings.Unbounded.Length(Output_Object.Ref_URL) /= 0 then
707 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;");
708 Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
709 Ada.Text_IO.Put (Output_Object.Output_File,
710 Ada.Strings.Unbounded.To_String(Output_Object.Ref_URL));
711 Ada.Text_IO.Put (Output_Object.Output_File, """>Reference Documents</A>");
712 else -- Link to the section named "References".
713 begin
714 -- Note: We do the following in one big glup so that if
715 -- Not_Found_Error is raised, nothing is output.
716 Ada.Text_IO.Put_Line (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;<A HREF=""" &
717 Make_Clause_Link_Name (Output_Object,
718 ARM_Contents.Lookup_Clause_Number ("References" & (11 .. ARM_Contents.Title_Type'Last => ' '))) &
719 """>Reference Documents</A>");
720 exception
721 when ARM_Contents.Not_Found_Error =>
722 null; -- No section named "References".
723 end;
724 end if;
725 if Clause /= "" then
726 begin
727 -- Note: We do the following in one big glup so that if
728 -- Not_Found_Error is raised, nothing is output.
729 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;<A HREF=""" &
730 Make_Clause_Link_Name (Output_Object,
731 ARM_Contents.Previous_Clause(Clause)));
732 Ada.Text_IO.Put (Output_Object.Output_File, """>Previous</A>");
733 exception
734 when ARM_Contents.Not_Found_Error =>
735 null; -- Probably the first section.
736 end;
737 begin
738 -- Note: We do the following in one big glup so that if
739 -- Not_Found_Error is raised, nothing is output.
740 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;&nbsp;&nbsp;<A HREF=""" &
741 Make_Clause_Link_Name (Output_Object,
742 ARM_Contents.Next_Clause(Clause)));
743 Ada.Text_IO.Put (Output_Object.Output_File, """>Next</A>");
744 exception
745 when ARM_Contents.Not_Found_Error =>
746 null; -- Probably the last section.
747 end;
748 end if;
749
750 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</P>");
751 end if;
752 end Make_Navigation_Bar;
753
754
755 type Special_Style_Kinds is (None,
756 Hanging_Term,
757 Hanging_Body,
758 Bulleted_Item,
759 Bulleted_No_Prefix);
760
761 procedure Make_Style (Output_Object : in out HTML_Output_Type;
762 Name : in String;
763 Style : in ARM_Output.Paragraph_Style_Type;
764 Indent : in ARM_Output.Paragraph_Indent_Type;
765 Kind : Special_Style_Kinds := None;
766 Enumerated_Adjustment : in Boolean := False) is
767 -- Internal routine.
768 -- Generate the style needed.
769
770 function Units_to_EMs (Value : in Natural) return Natural is
771 -- Convert Value from indentation units to EMs. (0.1 EMs, really).
772 Normal : Boolean;
773 begin
774 if Output_Object.HTML_Kind = HTML_4_Only then
775 case Paragraph_Info(Style, Indent).Font is
776 when ARM_Output.Default =>
777 Normal := ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Roman);
778 when ARM_Output.Roman =>
779 Normal := True;
780 when ARM_Output.Fixed | ARM_Output.Swiss => -- Start at 90% (otherwise they are huge!)
781 Normal := False;
782 end case;
783 if Normal then
784 case Paragraph_Info(Style, Indent).Size is
785 when 0 => return Value * 20;
786 when 1 => return Value * 16; -- 20/1.25.
787 when 2 => return Value * 13; -- 20/1.56.
788 when 3 => return Value * 10; -- 20/1.93.
789 when -1 => return Value * 25; -- 20/0.80.
790 when -2 => return Value * 31; -- 20/0.64.
791 when -3 => return Value * 40; -- 20/0.50.
792 when others => return Value; -- Out of range.
793 end case;
794 else -- Start at 90% (otherwise they are huge!)
795 case Paragraph_Info(Style, Indent).Size is
796 when 0 => return Value * 22; -- 20/0.90
797 when 1 => return Value * 18; -- 20/1.13.
798 when 2 => return Value * 14; -- 20/1.40.
799 when 3 => return Value * 11; -- 20/1.75.
800 when -1 => return Value * 28; -- 20/0.72.
801 when -2 => return Value * 34; -- 20/0.58.
802 when -3 => return Value * 44; -- 20/0.45.
803 when others => return Value; -- Out of range.
804 end case;
805 end if;
806 elsif ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
807 -- Special case, see below.
808 case Paragraph_Info(Style, Indent).Size is
809 when 0 => return Value * 20;
810 when 1 => return Value * 16; -- 20/1.25.
811 when 2 => return Value * 13; -- 20/1.56.
812 when 3 => return Value * 10; -- 20/1.93.
813 when -1 => return Value * 25; -- 20/0.80.
814 when -2 => return Value * 31; -- 20/0.64.
815 when -3 => return Value * 40; -- 20/0.50.
816 when others => return Value; -- Out of range.
817 end case;
818 else
819 return Value * 20; -- No font sizes here.
820 end if;
821 end Units_to_EMs;
822
823 begin
824 if not Paragraph_Used (Style, Indent) then
825 return; -- Not used, so don't generate.
826 end if;
827 if Kind = Hanging_Term and then Output_Object.HTML_Kind = HTML_4_Only then
828 -- Special case for better hanging.
829 Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
830 Ada.Text_IO.Put (Output_Object.Output_File, Name & "-Term {");
831 if OPTIMIZE_FOR_FIREFOX then
832 -- Tested on Firefox 1.5.
833 Ada.Text_IO.Put (Output_Object.Output_File, "float: left; ");
834 -- This does not work on IE: it adds extra spaces, and leaves
835 -- it effective after a <BR>. We could probably work around
836 -- those, but then Firefox would look like crap again.
837 else
838 Ada.Text_IO.Put (Output_Object.Output_File, "position: absolute; top: auto; left: 0.6em; ");
839 -- This does not work on Firefox: the text is too high by
840 -- about half a line and thus doesn't line up properly.
841 end if;
842 elsif Kind = Hanging_Body and then Output_Object.HTML_Kind = HTML_4_Only then
843 Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
844 Ada.Text_IO.Put (Output_Object.Output_File, Name & "-Body {");
845 elsif (Kind = Bulleted_Item or else Kind = Bulleted_No_Prefix) and then
846 Output_Object.HTML_Kind = HTML_4_Only then
847 Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
848 Ada.Text_IO.Put (Output_Object.Output_File, Name & " {");
849 else
850 case Paragraph_Info(Style, Indent).Tag is
851 when DIV =>
852 Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
853 when UL =>
854 Ada.Text_IO.Put (Output_Object.Output_File, " UL.");
855 when DL =>
856 Ada.Text_IO.Put (Output_Object.Output_File, " DL.");
857 end case;
858 Ada.Text_IO.Put (Output_Object.Output_File, Name & " {");
859 end if;
860 case Paragraph_Info(Style, Indent).Font is
861 when ARM_Output.Default =>
862 if ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Roman) then
863 Ada.Text_IO.Put (Output_Object.Output_File, "font-family: ""Times New Roman"", Times, serif");
864 else
865 Ada.Text_IO.Put (Output_Object.Output_File, "font-family: Arial, Helvetica, sans-serif");
866 end if;
867 when ARM_Output.Roman => Ada.Text_IO.Put (Output_Object.Output_File, "font-family: ""Times New Roman"", Times, serif");
868 when ARM_Output.Swiss => Ada.Text_IO.Put (Output_Object.Output_File, "font-family: Arial, Helvetica, sans-serif");
869 when ARM_Output.Fixed => Ada.Text_IO.Put (Output_Object.Output_File, "font-family: ""Courier New"", monospace");
870 end case;
871 if Output_Object.HTML_Kind = HTML_4_Only then
872 -- The font size is set by the outer item.
873 declare
874 Normal : Boolean;
875 begin
876 case Paragraph_Info(Style, Indent).Font is
877 when ARM_Output.Default =>
878 Normal := ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Roman);
879 when ARM_Output.Roman =>
880 Normal := True;
881 when ARM_Output.Fixed | ARM_Output.Swiss => -- Start at 90% (otherwise they are huge!)
882 Normal := False;
883 end case;
884 if Normal then
885 case Paragraph_Info(Style, Indent).Size is
886 when 0 => null; -- Default.
887 when 1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 125%");
888 when 2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 156%");
889 when 3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 195%");
890 when -1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 80%");
891 when -2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 64%");
892 when -3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 50%");
893 when others => null; -- Out of range.
894 end case;
895 else -- Start at 90% (otherwise they are huge!)
896 -- Note: This size adjustment is for sections of text, not for in-line text.
897 case Paragraph_Info(Style, Indent).Size is
898 when 0 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 90%");
899 when 1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 113%");
900 when 2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 140%");
901 when 3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 175%");
902 when -1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 72%");
903 when -2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 58%");
904 when -3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 45%");
905 when others => null; -- Out of range.
906 end case;
907 end if;
908 end;
909 -- Set the leading, because otherwise the lines are too close on IE.
910 Ada.Text_IO.Put (Output_Object.Output_File, "; line-height: 122%");
911 elsif ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
912 -- Special case because the font otherwise gets too small and
913 -- loses bold-facing.
914 case Paragraph_Info(Style, Indent).Size is
915 when 0 => null; -- Default.
916 when 1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 125%");
917 when 2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 156%");
918 when 3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 195%");
919 when -1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 80%");
920 when -2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 64%");
921 when -3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 50%");
922 when others => null; -- Out of range.
923 end case;
924 -- else the size will be set explicitly for HTML_4_Compatible.
925 end if;
926 if Kind = Hanging_Body then
927 if Output_Object.Number_Paragraphs then
928 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
929 Put_Ems (Output_Object.Output_File,
930 Units_to_EMs(Paragraph_Info(Style, Indent).Indent +
931 Paragraph_Info(Style, Indent).Hang_Outdent) +
932 INDENT_EMS_FOR_PARANUMS);
933 else
934 if Paragraph_Info(Style, Indent).Indent + Paragraph_Info(Style, Indent).Hang_Outdent /= 0 then
935 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
936 Put_Ems (Output_Object.Output_File,
937 Units_to_EMs(Paragraph_Info(Style, Indent).Indent +
938 Paragraph_Info(Style, Indent).Hang_Outdent));
939 end if;
940 end if;
941 elsif Enumerated_Adjustment then
942 -- Adjust the left margin to indent the prefix slightly (1/4 of a unit):
943 declare
944 Org_Margin : Natural :=
945 Units_to_EMs(Paragraph_Info(Style, Indent).Indent);
946 Prefix_Indent : Natural :=
947 Units_to_EMs(1) / 4;
948 begin
949 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
950 if Output_Object.Number_Paragraphs then
951 Put_Ems (Output_Object.Output_File, Org_Margin + Prefix_Indent +
952 INDENT_EMS_FOR_PARANUMS);
953 else
954 Put_Ems (Output_Object.Output_File, Org_Margin + Prefix_Indent);
955 end if;
956 end;
957 else
958 if Output_Object.Number_Paragraphs then
959 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
960 Put_Ems (Output_Object.Output_File, Units_to_EMs(Paragraph_Info(Style, Indent).Indent) +
961 INDENT_EMS_FOR_PARANUMS);
962 else
963 if Paragraph_Info(Style, Indent).Indent /= 0 then
964 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
965 Put_Ems (Output_Object.Output_File, Units_to_EMs(Paragraph_Info(Style, Indent).Indent));
966 end if;
967 end if;
968 end if;
969 if Kind = Hanging_Term and then Output_Object.HTML_Kind = HTML_4_Only then
970 -- We let the body provide the necessary right margin. If we don't
971 -- do this, the following item can end up with an inappropriate indent.
972 null;
973 --Ada.Text_IO.Put (Output_Object.Output_File, "; margin-bottom: 0em");
974 elsif Paragraph_Info(Style, Indent).Right_Indent /= 0 then
975 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-right: ");
976 Put_Ems (Output_Object.Output_File, Units_to_EMs(Paragraph_Info(Style, Indent).Right_Indent));
977 end if;
978 if Paragraph_Info(Style, Indent).Before /= 0 then
979 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-top: ");
980 Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Before);
981 elsif Paragraph_Info(Style, Indent).Tag /= DIV then
982 -- The default is non-zero.
983 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-top: 0em");
984 end if;
985 if Kind = Hanging_Term and then Output_Object.HTML_Kind = HTML_4_Only then
986 -- We let the body provide the necessary space below. If we don't
987 -- do this, the next line can end up with an inappropriate indent.
988 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-bottom: 0em");
989 elsif Paragraph_Info(Style, Indent).After /= 0 then
990 Ada.Text_IO.Put (Output_Object.Output_File, "; margin-bottom: ");
991 Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).After);
992 end if;
993 if Kind = Bulleted_Item and then Output_Object.HTML_Kind = HTML_4_Only then
994 -- Set the list item and "disc" format:
995 Ada.Text_IO.Put (Output_Object.Output_File, "; display: list-item; list-style-type: disc");
996 end if;
997 -- Done, close it.
998 Ada.Text_IO.Put_Line (Output_Object.Output_File, "}");
999 end Make_Style;
1000
1001
1002 procedure Make_Hung_Text_Style
1003 (Output_Object : in out HTML_Output_Type;
1004 Name : in String;
1005 Style : in ARM_Output.Paragraph_Style_Type;
1006 Indent : in ARM_Output.Paragraph_Indent_Type) is
1007 -- Internal routine.
1008 -- Generate the style needed.
1009 begin
1010 if Output_Object.HTML_Kind = HTML_4_Only then
1011 if ARM_Output."=" (Style, ARM_Output.Enumerated) or else
1012 ARM_Output."=" (Style, ARM_Output.Small_Enumerated) then
1013 Make_Style (Output_Object, Name, Style, Indent,
1014 Kind => Hanging_Term,
1015 Enumerated_Adjustment => True);
1016 else
1017 Make_Style (Output_Object, Name, Style, Indent,
1018 Kind => Hanging_Term);
1019 end if;
1020 else -- HTML_4_Compatible
1021 Ada.Text_IO.Put (Output_Object.Output_File, " DD." & Name & " {");
1022 Ada.Text_IO.Put (Output_Object.Output_File, "margin-left: ");
1023 case Paragraph_Info(Style, Indent).Size is
1024 when 0 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 20);
1025 when 1 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 16); -- 20/1.25.
1026 when 2 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 13); -- 20/1.56.
1027 when -1 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 25); -- 20/0.80.
1028 when -2 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 31); -- 20/0.64.
1029 when -3 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 40); -- 20/0.50.
1030 when others => null; -- Out of range.
1031 end case;
1032 -- Done, close it.
1033 Ada.Text_IO.Put_Line (Output_Object.Output_File, "}");
1034 end if;
1035 end Make_Hung_Text_Style;
1036
1037
1038 function Paragraph_Name
1039 (Style : in ARM_Output.Paragraph_Style_Type;
1040 Indent : in ARM_Output.Paragraph_Indent_Type) return String is
1041 -- Internal routine.
1042 -- Create the name for the Style and Indent.
1043 -- These had better be unique, and all possibilities (including impossible
1044 -- ones) had better have names.
1045 use type ARM_Output.Paragraph_Indent_Type;
1046 begin
1047 case Style is
1048 when ARM_Output.Normal =>
1049 if Indent = 0 then
1050 return "Normal";
1051 else
1052 -- This was: Indent 1: "SyntaxIndented"; Indent 2:
1053 -- "CodeIndented"; Indent 3: "Indented"; Indent 4: "InnerIndented".
1054 return "Indented" & Character'Val(Character'Pos('0') + Indent);
1055 end if;
1056 when ARM_Output.Wide_Above =>
1057 if Indent = 0 then
1058 return "WideAbove";
1059 else
1060 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "WideAbove";
1061 end if;
1062 when ARM_Output.Small =>
1063 if Indent = 0 then
1064 return "Small";
1065 elsif Indent = 1 then
1066 return "Notes";
1067 elsif Indent = 2 then
1068 return "Annotations";
1069 else
1070 -- This was: Indent 3: "SmallSyntaxIndented"; Indent 4:
1071 -- "SmallCodeIndented"; Indent 5: "SmallIndented"; Indent 6: "SmallInnerIndented".
1072 return "SmallIndented" & Character'Val(Character'Pos('0') + Indent);
1073 end if;
1074 when ARM_Output.Small_Wide_Above =>
1075 if Indent = 0 then
1076 return "SmallWideAbove";
1077 elsif Indent = 2 then
1078 return "AnnotationsWideAbove";
1079 else
1080 return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "WideAbove";
1081 end if;
1082 when ARM_Output.Header =>
1083 if Indent = 0 then
1084 return "Header";
1085 else
1086 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Header";
1087 end if;
1088 when ARM_Output.Small_Header =>
1089 if Indent = 0 then
1090 return "SmallHeader";
1091 elsif Indent = 1 then
1092 return "NotesHeader";
1093 else
1094 return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "Header";
1095 end if;
1096 when ARM_Output.Index =>
1097 if Indent = 0 then
1098 return "Index";
1099 else -- Should be not used.
1100 return "IndexIndented" & Character'Val(Character'Pos('0') + Indent);
1101 end if;
1102 when ARM_Output.Syntax_Summary =>
1103 if Indent = 1 then
1104 return "SyntaxSummary";
1105 else -- Should be not used.
1106 return "SynSumInd" & Character'Val(Character'Pos('0') + Indent);
1107 end if;
1108 when ARM_Output.Title =>
1109 if Indent = 0 then
1110 return "Title";
1111 else -- Should be not used.
1112 return "TitleIndented" & Character'Val(Character'Pos('0') + Indent);
1113 end if;
1114 when ARM_Output.Examples =>
1115 if Indent = 1 then
1116 return "Examples";
1117 else
1118 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Examples";
1119 end if;
1120 when ARM_Output.Small_Examples =>
1121 if Indent = 3 then
1122 return "SmallExamples";
1123 else
1124 return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "Examples";
1125 end if;
1126 when ARM_Output.Swiss_Examples =>
1127 if Indent = 1 then
1128 return "SwissExamples";
1129 else
1130 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SwissExamples";
1131 end if;
1132 when ARM_Output.Small_Swiss_Examples =>
1133 if Indent = 3 then
1134 return "SmallSwissExamples";
1135 else
1136 return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "SwissExamples";
1137 end if;
1138 when ARM_Output.Bulleted =>
1139 if Indent = 1 then
1140 return "Bulleted";
1141 else
1142 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Bulleted";
1143 end if;
1144 when ARM_Output.Small_Bulleted =>
1145 if Indent = 3 then
1146 return "SmallBulleted";
1147 else
1148 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallBulleted";
1149 end if;
1150 when ARM_Output.Nested_Bulleted =>
1151 if Indent = 1 then
1152 return "NestedBulleted";
1153 else
1154 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "NestedBulleted";
1155 end if;
1156 when ARM_Output.Small_Nested_Bulleted =>
1157 if Indent = 3 then
1158 return "SmallNestedBulleted";
1159 else
1160 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallNestedBulleted";
1161 end if;
1162 when ARM_Output.Enumerated =>
1163 if Indent = 1 then
1164 return "Enumerated";
1165 else
1166 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Enumerated";
1167 end if;
1168 when ARM_Output.Small_Enumerated =>
1169 if Indent = 3 then
1170 return "SmallEnumerated";
1171 else
1172 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallEnumerated";
1173 end if;
1174 when ARM_Output.Giant_Hanging =>
1175 if Indent = 4 then
1176 return "GiantHanging";
1177 else
1178 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "GiantHanging";
1179 end if;
1180 when ARM_Output.Small_Giant_Hanging =>
1181 if Indent = 6 then
1182 return "SmallGiantHanging";
1183 else
1184 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallGiantHanging";
1185 end if;
1186 when ARM_Output.Wide_Hanging =>
1187 if Indent = 3 then
1188 return "WideHanging";
1189 else
1190 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "WideHanging";
1191 end if;
1192 when ARM_Output.Small_Wide_Hanging =>
1193 if Indent = 5 then
1194 return "SmallWideHanging";
1195 else
1196 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallWideHanging";
1197 end if;
1198 when ARM_Output.Medium_Hanging =>
1199 if Indent = 2 then
1200 return "MediumHanging";
1201 else
1202 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "MediumHanging";
1203 end if;
1204 when ARM_Output.Small_Medium_Hanging =>
1205 if Indent = 4 then
1206 return "SmallMediumHanging";
1207 else
1208 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallMediumHanging";
1209 end if;
1210 when ARM_Output.Narrow_Hanging =>
1211 if Indent = 1 then
1212 return "NarrowHanging";
1213 else
1214 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "NarrowHanging";
1215 end if;
1216 when ARM_Output.Small_Narrow_Hanging =>
1217 if Indent = 3 then
1218 return "SmallNarrowHanging";
1219 else
1220 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallNarrowHanging";
1221 end if;
1222 when ARM_Output.Hanging_in_Bulleted =>
1223 if Indent = 3 then
1224 return "Hanging_in_Bulleted";
1225 else
1226 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Hanging_in_Bulleted";
1227 end if;
1228 when ARM_Output.Small_Hanging_in_Bulleted =>
1229 if Indent = 5 then
1230 return "SmallHanging_in_Bulleted";
1231 else
1232 return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallHanging_in_Bulleted";
1233 end if;
1234 end case;
1235 end Paragraph_Name;
1236
1237
1238 procedure Make_Paragraph_Styles
1239 (Output_Object : in out HTML_Output_Type) is
1240 -- Internal routine.
1241 -- Generate all of the paragraph and related styles.
1242 begin
1243 -- Basic element styles:
1244 if Paranum_Used then
1245 if Output_Object.HTML_Kind = HTML_4_Compatible then
1246 if OPTIMIZE_FOR_FIREFOX then
1247 Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {float: left; font-family: Arial, Helvetica, sans-serif; width: 2.8em; " &
1248 "margin-left: -0.4em; margin-right: -3.0em; margin-top: 0.2em}");
1249 -- Uses floating items. These usually don't work on IE (it
1250 -- adds extra spaces for no reason). However, with the
1251 -- indents, this seems to work properly on IE, too.
1252 else
1253 -- Absolute positioning (CSS2) works better on IE, but
1254 -- Firefox tends to draw these too high.
1255 Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5em; top: auto; margin-top: 0.2em}");
1256 end if;
1257 -- If these are completely ignored, the paragraph number will
1258 -- end up on a line by itself. That's fine.
1259 else
1260 if OPTIMIZE_FOR_FIREFOX then
1261 Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {float: left; font-family: Arial, Helvetica, sans-serif; font-size: 64%; width: 2.8em; " &
1262 "margin-left: -0.4em; margin-right: -3.0em; margin-top: 0.2em}");
1263 -- Uses floating elements; see above.
1264 else
1265 Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; font-size: 64%; " &
1266 "left: 0.5em; top: auto; margin-top: 0.2em}");
1267 -- Uses absolute positioning; see above.
1268 end if;
1269 end if;
1270 end if;
1271
1272 Ada.Text_IO.Put_Line (Output_Object.Output_File, " TT {font-family: ""Courier New"", monospace}");
1273 Ada.Text_IO.Put_Line (Output_Object.Output_File, " DT {display: compact}"); -- CSS2. This doesn't seem to work on IE 4.01, but it is harmless.
1274
1275 -- Revision styles:
1276 if Revision_Used ('0') then
1277 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert0 {text-decoration: underline; color: black}");
1278 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete0 {text-decoration: line-through; color: black }");
1279 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both0 {text-decoration: underline, line-through; color: black }");
1280 -- Both doesn't seem to work, so forget it.
1281 -- else not used, don't generate it.
1282 end if;
1283 if Revision_Used ('1') then
1284 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert1 {text-decoration: underline; color: rgb(0,51,51) }"); -- (Very) dark turquoise.
1285 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete1 {text-decoration: line-through; color: rgb(0,51,51) }");
1286 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both1 {text-decoration: underline, line-through; color: rgb(0,51,51) }");
1287 -- Both doesn't seem to work, so forget it.
1288 -- else not used, don't generate it.
1289 end if;
1290 if Revision_Used ('2') then
1291 if Revision_Used ('5') or else Output_Object.Force_New_Revision_Colors then
1292 -- Ugly color here, nice color for #5
1293 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert2 {text-decoration: underline; color: rgb(102,0,153) }"); -- Violet.
1294 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete2 {text-decoration: line-through; color: rgb(102,0,153) }");
1295 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both2 {text-decoration: underline, line-through; color: rgb(102,0,153) }");
1296 -- Both doesn't seem to work, so forget it.
1297 else -- Use the nice green here.
1298 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert2 {text-decoration: underline; color: rgb(0,102,0) }"); -- Dark green.
1299 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete2 {text-decoration: line-through; color: rgb(0,102,0) }");
1300 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both2 {text-decoration: underline, line-through; color: rgb(0,102,0) }");
1301 -- Both doesn't seem to work, so forget it.
1302 end if;
1303 -- else not used, don't generate it.
1304 end if;
1305 if Revision_Used ('3') then
1306 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert3 {text-decoration: underline; color: rgb(102,51,0) }"); -- Dark brown.
1307 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete3 {text-decoration: line-through; color: rgb(102,51,0) }");
1308 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both3 {text-decoration: underline, line-through; color: rgb(102,51,0) }");
1309 -- Both doesn't seem to work, so forget it.
1310 -- else not used, don't generate it.
1311 end if;
1312 if Revision_Used ('4') then
1313 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert4 {text-decoration: underline; color: rgb(153,0,0) }"); -- Dark red.
1314 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete4 {text-decoration: line-through; color: rgb(153,0,0) }");
1315 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both4 {text-decoration: underline, line-through; color: rgb(153,0,0) }");
1316 -- Both doesn't seem to work, so forget it.
1317 -- else not used, don't generate it.
1318 end if;
1319 if Revision_Used ('5') then
1320 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert5 {text-decoration: underline; color: rgb(0,102,0) }"); -- Dark green.
1321 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete5 {text-decoration: line-through; color: rgb(0,102,0) }");
1322 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both5 {text-decoration: underline, line-through; color: rgb(0,102,0) }");
1323 -- Both doesn't seem to work, so forget it.
1324 -- else not used, don't generate it.
1325 end if;
1326 if Revision_Used ('6') then
1327 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert6 {text-decoration: underline; color: rgb(0,102,153) }"); -- Turquiose.
1328 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete6 {text-decoration: line-through; color: rgb(0,102,153) }");
1329 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both6 {text-decoration: underline, line-through; color: rgb(0,102,153) }");
1330 -- Both doesn't seem to work, so forget it.
1331 -- else not used, don't generate it.
1332 end if;
1333
1334 -- Link styles:
1335 -- We don't need these (they're given in the BODY command), but I've
1336 -- kept them in case we want to change these in the future.
1337 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " A:link {color: rgb(0,0,255)}");
1338 --Ada.Text_IO.Put_Line (Output_Object.Output_File, " A:visited {color: rgb(128,0,128)}");
1339 -- The following styles are for the Ada-Auth.Org header. It would be nice
1340 -- if we could skip them if they're not needed, but we don't have the
1341 -- information needed to do that.
1342 Ada.Text_IO.Put_Line (Output_Object.Output_File, " A.Bar:link {font-family: Arial, Helvetica, sans-serif; font-style: normal; text-decoration: none; color: rgb(204,204,51)}");
1343 Ada.Text_IO.Put_Line (Output_Object.Output_File, " A.Bar:visited {font-family: Arial, Helvetica, sans-serif; font-style: normal; text-decoration: none; color: rgb(204,204,51)}");
1344
1345 -- Paragraph styles:
1346 for S in ARM_Output.Unprefixed_Style_Subtype loop
1347 for I in ARM_Output.Paragraph_Indent_Type loop
1348 Make_Style (Output_Object, Paragraph_Name (S, I), S, I);
1349 end loop;
1350 end loop;
1351
1352 for S in ARM_Output.Bullet_Prefixed_Style_Subtype loop
1353 -- These styles do not allow Indent 0.
1354 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
1355 if Output_Object.HTML_Kind = HTML_4_Only then
1356 Make_Style (Output_Object, Paragraph_Name (S, I) & "-NoPrefix", S, I,
1357 Kind => Bulleted_No_Prefix);
1358 Make_Style (Output_Object, Paragraph_Name (S, I), S, I,
1359 Kind => Bulleted_Item);
1360 else
1361 Make_Style (Output_Object, Paragraph_Name (S, I), S, I);
1362 end if;
1363 end loop;
1364 end loop;
1365
1366 for S in ARM_Output.Text_Prefixed_Style_Subtype loop
1367 -- These styles do not allow Indent 0.
1368 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
1369 if Paragraph_Used (S, I) then
1370 Make_Style (Output_Object, Paragraph_Name (S, I), S, I, Kind => Hanging_Body);
1371 Make_Hung_Text_Style (Output_Object, Paragraph_Name (S, I), S, I);
1372 -- else not used.
1373 end if;
1374 end loop;
1375 end loop;
1376
1377 end Make_Paragraph_Styles;
1378
1379
1380 MAGIC_STYLE_MARKER : constant String := "&%$# STYLES GO HERE #$%&";
1381
1382
1383 procedure Start_HTML_File (Output_Object : in out HTML_Output_Type;
1384 File_Name : in String;
1385 Title : in String;
1386 Clause : in String) is
1387 -- Internal routine.
1388 -- Create an HTML file, and generate the needed text to start an HTML
1389 -- file. The file name is just the name portion, not the path or
1390 -- extension. Clause is the properly formatted Clause number for
1391 -- this file, if known.
1392 begin
1393 --Ada.Text_IO.Put_Line ("--Creating " & File_Name & ".html");
1394 if Output_Object.HTML_Kind > HTML_3 then
1395 Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
1396 Ada.Strings.Unbounded.To_String (Output_Object.Output_Path) &
1397 File_Name & ".$$$");
1398 elsif Output_Object.DOS_Filenames then
1399 Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
1400 Ada.Strings.Unbounded.To_String (Output_Object.Output_Path) &
1401 File_Name & ".HTM");
1402 else
1403 Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
1404 Ada.Strings.Unbounded.To_String (Output_Object.Output_Path) &
1405 File_Name & ".html");
1406 end if;
1407 -- Save the current clause:
1408 Output_Object.Current_Clause :=
1409 Ada.Strings.Unbounded.To_Unbounded_String(Clause);
1410 -- File introduction:
1411 if Output_Object.HTML_Kind > HTML_3 then
1412 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN""");
1413 Ada.Text_IO.Put_Line (Output_Object.Output_File, """http://www.w3.org/TR/html4/loose.dtd"">"); -- HTML 4.01 (with depreciated features)
1414 else
1415 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 3.2//EN"">"); -- HTML 3.2
1416 end if;
1417 -- so the result can be used on version 3 browsers.)
1418 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HTML>");
1419 -- Header information:
1420 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HEAD>");
1421 Ada.Text_IO.Put_Line (Output_Object.Output_File, " <TITLE>" & Title & "</TITLE>");
1422 Ada.Text_IO.Put_Line (Output_Object.Output_File, " <META http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">");
1423 Ada.Text_IO.Put_Line (Output_Object.Output_File, " <META NAME=""Author"" CONTENT=""JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor"">");
1424 Ada.Text_IO.Put_Line (Output_Object.Output_File, " <META NAME=""GENERATOR"" CONTENT=""Arm_Form.Exe, Ada Reference Manual generator"">");
1425 if Output_Object.HTML_Kind = HTML_4_Only then
1426 -- The style sheet.
1427 Ada.Text_IO.Put_Line (Output_Object.Output_File, " <STYLE type=""text/css"">");
1428 -- Element styles:
1429 Ada.Text_IO.Put_Line (Output_Object.Output_File, " H4.centered {text-align: center}");
1430 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.swiss {font-family: Arial, Helvetica, sans-serif; font-size: 92%}");
1431 Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.roman {font-family: ""Times New Roman"", Times, serif}");
1432
1433 -- Paragraph styles:
1434 --Paragraph_Used := (others => (others => True)); -- Force showing all, we don't know what is used.
1435 --Revision_Used := (others => True);
1436 --Paranum_Used := True;
1437 --Make_Paragraph_Styles (Output_Object);
1438 -- Dummy line to be replaced after the file is created.
1439 Ada.Text_IO.Put_Line (Output_Object.Output_File, MAGIC_STYLE_MARKER);
1440
1441 Paragraph_Used := (others => (others => False));
1442 Revision_Used := (others => False);
1443 Paranum_Used := False;
1444
1445 Ada.Text_IO.Put_Line (Output_Object.Output_File, " </STYLE>");
1446 elsif Output_Object.HTML_Kind = HTML_4_Compatible then
1447 -- The style sheet.
1448 Ada.Text_IO.Put_Line (Output_Object.Output_File, " <STYLE type=""text/css"">");
1449
1450 -- Paragraph styles:
1451 --Paragraph_Used := (others => (others => True)); -- Force showing all, we don't know what is used.
1452 --Revision_Used := (others => True);
1453 --Paranum_Used := True;
1454 --Make_Paragraph_Styles (Output_Object);
1455 -- Dummy line to be replaced after the file is created.
1456 Ada.Text_IO.Put_Line (Output_Object.Output_File, MAGIC_STYLE_MARKER);
1457
1458 Paragraph_Used := (others => (others => False));
1459 Revision_Used := (others => False);
1460 Paranum_Used := False;
1461
1462 Ada.Text_IO.Put_Line (Output_Object.Output_File, " </STYLE>");
1463 end if;
1464
1465 if Ada.Strings.Unbounded.Length(Output_Object.Script_HTML) /= 0 then
1466 Ada.Text_IO.Put_Line (Output_Object.Output_File,
1467 Ada.Strings.Unbounded.To_String(Output_Object.Script_HTML));
1468 end if;
1469
1470 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</HEAD>");
1471 Ada.Text_IO.Put_Line (Output_Object.Output_File,
1472 "<BODY TEXT=""" & Output_Object.Text_Color &
1473 """ BGCOLOR=""" & Output_Object.Background_Color &
1474 """ LINK=""" & Output_Object.Link_Color &
1475 """ VLINK=""" & Output_Object.VLink_Color &
1476 """ ALINK=""" & Output_Object.ALink_Color & """>");
1477
1478 if Ada.Strings.Unbounded.Length(Output_Object.Header_HTML) /= 0 then
1479 Ada.Text_IO.Put_Line (Output_Object.Output_File,
1480 Ada.Strings.Unbounded.To_String(Output_Object.Header_HTML));
1481 end if;
1482
1483 if Output_Object.Nav_on_Top then
1484 Make_Navigation_Bar (Output_Object, Is_Top => True);
1485 -- else no navigation bar
1486 end if;
1487
1488 if Output_Object.Nav_on_Top or else
1489 Ada.Strings.Unbounded.Length(Output_Object.Header_HTML) /= 0 then
1490 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR>"); -- Horizontal line (rule).
1491 -- else nothing on top at all.
1492 end if;
1493 end Start_HTML_File;
1494
1495
1496 procedure End_HTML_File (Output_Object : in out HTML_Output_Type) is
1497 -- Internal routine.
1498 -- Generate the needed text to end an HTML file. Also closes the file.
1499 begin
1500 Ada.Text_IO.New_Line (Output_Object.Output_File); -- Blank line to set off paragraphs.
1501
1502 if Output_Object.Nav_on_Bottom or else
1503 Ada.Strings.Unbounded.Length(Output_Object.Footer_HTML) /= 0 then
1504 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR>"); -- Horizontal line (rule).
1505 -- else nothing on top at all.
1506 end if;
1507
1508 if Output_Object.Nav_on_Bottom then
1509 Make_Navigation_Bar (Output_Object, Is_Top => False);
1510 -- else no navigation bar.
1511 end if;
1512
1513 if Ada.Strings.Unbounded.Length(Output_Object.Footer_HTML) /= 0 then
1514 Ada.Text_IO.Put_Line (Output_Object.Output_File,
1515 Ada.Strings.Unbounded.To_String(Output_Object.Footer_HTML));
1516 end if;
1517
1518 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</BODY>");
1519 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</HTML>");
1520 if Output_Object.HTML_Kind <= HTML_3 then
1521 Ada.Text_IO.Close (Output_Object.Output_File);
1522 else -- Close and reread the file to add JUST the styles used by the
1523 -- file; this decreases the minimum size of the files (by as
1524 -- much as 7K as of this writing [1/2006]), which matters when
1525 -- there are hundreds.
1526 -- We also check spaces before end tags and after opening tags;
1527 -- these should be &nbsp;. (See 9.1 in HTML 4.0: "In order to
1528 -- avoid problems with SGML line break rules and inconsistencies
1529 -- among extant implementations, authors should not rely on user
1530 -- agents to render white space immediately after a start tag or
1531 -- immediately before an end tag.") We haven't seen a problem
1532 -- with this, but why ask for trouble?
1533 -- Note that we assume that all occurrences of "<" and ">" in
1534 -- the literal text are written as "&lt;" and "&gt;"; violations
1535 -- might cause the conversion of spaces to non-breaking spaces,
1536 -- which should not cause problems in general. We also assume that
1537 -- all end tags are on one line (they are all very short), so
1538 -- any ">" is the end of a start tag unless there is a "</" preceding it.
1539 declare
1540 Original_Name : constant String := Ada.Text_IO.Name (Output_Object.Output_File);
1541 Reading_File : Ada.Text_IO.File_Type;
1542 Real_Name : constant String :=
1543 Ada.Strings.Fixed.Head (Original_Name, Original_Name'Length-3);
1544 Buffer : String (1..1600);
1545 Len : Natural;
1546 Body_Seen : Boolean := False;
1547 Loc : Natural;
1548 begin
1549 Ada.Text_IO.Close (Output_Object.Output_File);
1550 Ada.Text_IO.Open (Reading_File, Ada.Text_IO.In_File,
1551 Original_Name);
1552 if Output_Object.DOS_Filenames then
1553 Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
1554 Real_Name & "HTM");
1555 else
1556 Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
1557 Real_Name & "html");
1558 end if;
1559 begin
1560 loop
1561 Ada.Text_IO.Get_Line (Reading_File, Buffer, Len);
1562 if Buffer(1..Len) = MAGIC_STYLE_MARKER then
1563 -- Output only the styles used here.
1564 Make_Paragraph_Styles (Output_Object);
1565 elsif not Body_Seen then
1566 if Ada.Strings.Fixed.Index (Buffer(1..Len), "<BODY") /= 0 then
1567 Body_Seen := True;
1568 end if;
1569 Ada.Text_IO.Put_Line (Output_Object.Output_File, Buffer(1..Len));
1570 else
1571 -- Replace spaces before end tags:
1572 loop
1573 Loc := Ada.Strings.Fixed.Index (Buffer(1..Len), " </");
1574 exit when Loc = 0;
1575 Buffer(Loc+6..Len+5) := Buffer(Loc+1..Len);
1576 Buffer(Loc..Loc+5) := "&nbsp;";
1577 Len := Len+5;
1578 end loop;
1579 -- Replace spaces after start tags:
1580 Loc := 1;
1581 while Loc < Len loop
1582 if Buffer(Loc..Loc+1) = "> " then
1583 -- Candidate; check that this isn't an end tag.
1584 for I in reverse 1..Loc-1 loop
1585 if Buffer(I) = '/' then
1586 -- End tag, nothing to do.
1587 Loc := Loc + 2;
1588 exit;
1589 elsif Buffer(I) = '<' or else I = 1 then
1590 -- Start tag (including reaching the
1591 -- start of the line), replace.
1592 Buffer(Loc+7..Len+5) := Buffer(Loc+2..Len);
1593 Buffer(Loc+1..Loc+6) := "&nbsp;";
1594 Len := Len+5;
1595 Loc := Loc + 7;
1596 -- If these is the *last* character on the
1597 -- line, we have to "unbreak" the line, else we'd get an extra space.
1598 if Loc > Len then
1599 Ada.Text_IO.Put (Output_Object.Output_File, Buffer(1..Len));
1600 goto Skip_Write;
1601 end if;
1602 exit;
1603 -- else continue.
1604 end if;
1605 end loop;
1606 else
1607 Loc := Loc + 1;
1608 end if;
1609 end loop;
1610
1611 Ada.Text_IO.Put_Line (Output_Object.Output_File, Buffer(1..Len));
1612 <<Skip_Write>> null;
1613 end if;
1614 end loop;
1615 exception
1616 when Ada.Text_IO.End_Error => null; -- Done copying.
1617 end;
1618 Ada.Text_IO.Close (Output_Object.Output_File);
1619 Ada.Text_IO.Delete (Reading_File); -- This was temporary.
1620 end;
1621 end if;
1622 end End_HTML_File;
1623
1624
1625 procedure Create (Output_Object : in out HTML_Output_Type;
1626 Big_Files : in Boolean;
1627 File_Prefix : in String;
1628 Output_Path : in String;
1629 DOS_Filenames : in Boolean;
1630 HTML_Kind : in HTML_Type;
1631 Use_Unicode : in Boolean;
1632 Number_Paragraphs : in Boolean;
1633 Ref_URL : in String;
1634 Srch_URL : in String;
1635 Index_URL : in String;
1636 Use_Buttons : Boolean;
1637 Nav_On_Top : Boolean;
1638 Nav_On_Bottom : Boolean;
1639 Tab_Emulation : Tab_Emulation_Type;
1640 Script_HTML : String;
1641 Header_HTML : String;
1642 Footer_HTML : String;
1643 Title : in String := "";
1644 Body_Font : ARM_Output.Font_Family_Type;
1645 Force_New_Revision_Colors : Boolean;
1646 Text_Color : Color_String;
1647 Background_Color : Color_String;
1648 Link_Color : Color_String;
1649 VLink_Color : Color_String;
1650 ALink_Color : Color_String) is
1651 -- Create an Output_Object for a document.
1652 -- Generate a few large output files if
1653 -- Big_Files is True; otherwise generate smaller output files.
1654 -- The prefix of the output file names is File_Prefix - this
1655 -- should be no more than 5 characters allowed in file names.
1656 -- The files will be written into Output_Path.
1657 -- If DOS_Filename is true, use 8.3 file names;
1658 -- in that case, File_Prefix must be less than 4 characters in length;
1659 -- and no clause or subclause number may exceed 35 if Big_Files is False.
1660 -- The title of the document is Title.
1661 -- HTML_Kind determines the kind of HTML generated; HTML_3 works on
1662 -- every browser but has little control over formatting;
1663 -- HTML_4_Compatible has better control, but tries to make the results
1664 -- look good on older browsers; HTML_4_Only uses maximum formatting,
1665 -- but makes no attempt to look good on browsers older than IE 5.0 and
1666 -- Firefox 1.0.
1667 -- If Use_Unicode is true, Unicode characters available on US versions
1668 -- of Windows 2000 are used when appropriate; otherwise, Unicode
1669 -- characters are only used when explicitly requested with
1670 -- Unicode_Character (other characters are replaced with reasonable
1671 -- equivalents). [Note: It's known that IE on Windows 95/98/ME cannot
1672 -- display Unicode characters.] Use_Unicode has no effect if HTML_Kind
1673 -- is set to HTML_3.
1674 -- Number_Paragraphs means that paragraph numbers will be used;
1675 -- otherwise, the Number parameter to Start_Paragraph must be "".
1676 -- Ref_URL, Srch_URL, and Index_URL are the URLs (possibly relative)
1677 -- for the "References", "Search", and "Index" buttons/labels,
1678 -- respectively. If null, these buttons/labels link to sections named
1679 -- "References", "Search", and "Index"; if these do not exist, the
1680 -- buttons/labels are omitted.
1681 -- If Use_Buttons is true, button images are used, otherwise text labels
1682 -- are used for the navigation bar.
1683 -- If Nav_On_Top is true, the navigation bar will appear in the header
1684 -- of each page. If Nav_On_Bottom is true, the navigation bar will
1685 -- appear in the footer of each page.
1686 -- Tab_Emulation determines how tabs are emulated.
1687 -- Script_HTML gives self-contained HTML that will appear immediately
1688 -- before the </HEAD> of every page. This usually will contain
1689 -- Javascript scripts or CSS styles. The original intent was to allow
1690 -- adding the Google Analytics script to each page.
1691 -- Header_HTML gives self-contained HTML that will appear before the
1692 -- navigation bar in the header. Footer_HTML gives self-contained HTML
1693 -- that will appear after the navigation bar in the footer.
1694 -- Body_Font selects the default font for the document body.
1695 -- Text_Color specifies the default text color; Background_Color
1696 -- specifies the default background color; Link_Color specifies the
1697 -- default color of normal links; VLink_Color specifies the
1698 -- default color of visited links; and ALink_Color specifies the
1699 -- default color of active (in the act of clinking) links.
1700 begin
1701 if Output_Object.Is_Valid then
1702 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1703 "Already valid object");
1704 end if;
1705 Output_Object.Is_Valid := True;
1706 Ada.Strings.Fixed.Move (Target => Output_Object.File_Prefix,
1707 Source => File_Prefix);
1708 Output_Object.Title := Ada.Strings.Unbounded.To_Unbounded_String (Title);
1709 Output_Object.Big_Files := Big_Files;
1710 Output_Object.Output_Path := Ada.Strings.Unbounded.To_Unbounded_String(Output_Path);
1711 Output_Object.DOS_Filenames := DOS_Filenames;
1712 Output_Object.HTML_Kind := HTML_Kind;
1713 Output_Object.Use_Unicode := Use_Unicode;
1714 Output_Object.Number_Paragraphs := Number_Paragraphs;
1715 Output_Object.Ref_URL := Ada.Strings.Unbounded.To_Unbounded_String(Ref_URL);
1716 Output_Object.Srch_URL := Ada.Strings.Unbounded.To_Unbounded_String(Srch_URL);
1717 Output_Object.Index_URL := Ada.Strings.Unbounded.To_Unbounded_String(Index_URL);
1718 Output_Object.Use_Buttons := Use_Buttons;
1719 Output_Object.Nav_on_Top := Nav_on_Top;
1720 Output_Object.Nav_on_Bottom := Nav_on_Bottom;
1721 Output_Object.Tab_Emulation := Tab_Emulation;
1722 Output_Object.Script_HTML := Ada.Strings.Unbounded.To_Unbounded_String(Script_HTML);
1723 Output_Object.Header_HTML := Ada.Strings.Unbounded.To_Unbounded_String(Header_HTML);
1724 Output_Object.Footer_HTML := Ada.Strings.Unbounded.To_Unbounded_String(Footer_HTML);
1725 Output_Object.Body_Font := Body_Font;
1726 Output_Object.Force_New_Revision_Colors := Force_New_Revision_Colors;
1727 Output_Object.Text_Color := Text_Color;
1728 Output_Object.Background_Color := Background_Color;
1729 Output_Object.Link_Color := Link_Color;
1730 Output_Object.VLink_Color := VLink_Color;
1731 Output_Object.ALink_Color := ALink_Color;
1732
1733 if DOS_Filenames then
1734 if File_Prefix'Length > 3 then
1735 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1736 "HTML File Prefix too long - MS-DOS mode");
1737 end if;
1738 else
1739 if File_Prefix'Length > 5 then
1740 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1741 "HTML File Prefix too long");
1742 end if;
1743 end if;
1744
1745 if Output_Object.Big_Files then
1746 Start_HTML_File (Output_Object,
1747 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right),
1748 Ada.Strings.Unbounded.To_String (Output_Object.Title),
1749 Clause => "");
1750 -- Insert an anchor for the title page:
1751 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<A NAME=""TTL""></A>");
1752 end if;
1753 end Create;
1754
1755
1756 procedure Close (Output_Object : in out HTML_Output_Type) is
1757 -- Close an Output_Object. No further output to the object is
1758 -- allowed after this call.
1759 begin
1760 if not Output_Object.Is_Valid then
1761 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1762 "Not valid object");
1763 end if;
1764 if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
1765 End_HTML_File (Output_Object);
1766 end if;
1767 Output_Object.Is_Valid := False;
1768 end Close;
1769
1770
1771 procedure Section (Output_Object : in out HTML_Output_Type;
1772 Section_Title : in String;
1773 Section_Name : in String) is
1774 -- Start a new section. The title is Section_Title (this is
1775 -- intended for humans). The name is Section_Name (this is
1776 -- intended to be suitable to be a portion of a file name).
1777 begin
1778 if not Output_Object.Is_Valid then
1779 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1780 "Not valid object");
1781 end if;
1782 if Output_Object.Is_In_Paragraph then
1783 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1784 "Section in paragraph");
1785 end if;
1786 -- We don't generate a file here for HTML. We generate a file for each
1787 -- clause.
1788 if Section_Name'Length > 3 then
1789 Output_Object.Section_Name := Section_Name (Section_Name'First .. Section_Name'First + 2);
1790 else
1791 Output_Object.Section_Name := (others => '-');
1792 Output_Object.Section_Name (1 .. Section_Name'Length) := Section_Name;
1793 end if;
1794 end Section;
1795
1796
1797 procedure Set_Columns (Output_Object : in out HTML_Output_Type;
1798 Number_of_Columns : in ARM_Output.Column_Count) is
1799 -- Set the number of columns.
1800 -- Raises Not_Valid_Error if in a paragraph.
1801 begin
1802 if not Output_Object.Is_Valid then
1803 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1804 "Not valid object");
1805 end if;
1806 if Output_Object.Is_In_Paragraph then
1807 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1808 "In paragraph");
1809 end if;
1810 if Number_of_Columns >= 4 then
1811 -- We have special processing for 4 or more columns. Note that we
1812 -- assume do not contain any nested paragraph formats.
1813 Output_Object.Current_Column := 1;
1814 Output_Object.Current_Item := 1;
1815 elsif Output_Object.Column_Count >= 4 and then Number_of_Columns = 1 then
1816 -- Finished processing columns, output the columns as a table.
1817 if Output_Object.Current_Column = 1 then
1818 -- No New_Column calls; break this into columns ourselves.
1819 -- Current_Item represents the total number of items + 2
1820 -- (there is a double count for the end of the paragraph).
1821 declare
1822 Col_Count : Natural := Output_Object.Current_Item - 2;
1823 Where : Column_Text_Ptr;
1824 begin
1825 Col_Count := (Col_Count + Output_Object.Column_Count - 1) /
1826 Output_Object.Column_Count;
1827 Ada.Text_IO.Put_Line(" @@ Calc columns for" & Natural'Image(Output_Object.Column_Count) &
1828 " columns;" & Natural'Image(Output_Object.Current_Item - 1) & " total items;" &
1829 Natural'Image(Col_Count) & " per column.");
1830
1831 -- Split the item list into the appropriate columns.
1832 -- Note that this list is stored in reverse order.
1833 for I in reverse 2 .. Output_Object.Column_Count loop
1834 --Ada.Text_IO.Put_Line(" @@ For column" & Natural'Image(I) & " split at item" &
1835 --Natural'Image(Col_Count*(I-1)));
1836 Where := Output_Object.Column_Text(1);
1837 exit when Where = null; -- No columns to look at.
1838 if Where.Item <= Col_Count*(I-1) then
1839 -- This column is empty.
1840 null;
1841 else
1842 Output_Object.Column_Text(I) := Where;
1843 while Where.Next /= null and then
1844 Where.Next.Item > Col_Count*(I-1) loop
1845 Where.Item := Where.Item - Col_Count*(I-1);
1846 Where := Where.Next;
1847 end loop;
1848 if Where = null then
1849 Output_Object.Column_Text(1) := null;
1850 else
1851 Output_Object.Column_Text(1) := Where.Next;
1852 Where.Next := null;
1853 --Ada.Text_IO.Put_Line(" split item=" & Natural'Image(Where.Item));
1854 Where.Item := Where.Item - Col_Count*(I-1);
1855 end if;
1856 end if;
1857 end loop;
1858 end;
1859 --else there were explicit New_Column calls; no need to
1860 --do anything here.
1861 end if;
1862 if Output_Object.HTML_Kind = HTML_3 then
1863 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<UL><UL><TABLE Width=""70%"">"); -- Table with no border or caption, takes up 70% of the screen.
1864 else
1865 Ada.Text_IO.Put_Line (Output_Object.Output_File,
1866 "<div class=""" & Paragraph_Name (ARM_Output.Normal, 2) & """><table width=""70%"">"); -- Table with no border or caption, takes up 70% of the screen.
1867 Paragraph_Used(ARM_Output.Normal, 2) := True;
1868 end if;
1869 -- And start the first row:
1870 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
1871 for Item in 1 .. 5000 loop
1872 for Col in 1 .. Output_Object.Column_Count loop
1873 declare
1874 Find : Column_Text_Ptr := Output_Object.Column_Text(Col);
1875 Temp : Column_Text_Ptr;
1876 begin
1877 -- We're going to free this item after outputting it.
1878 if Find = null then
1879 null;
1880 elsif Find.Next = null then
1881 if Find.Item /= Item then
1882 Find := null;
1883 else
1884 Output_Object.Column_Text(Col) := null;
1885 end if;
1886 else
1887 while Find.Next /= null and then Find.Next.Item /= Item loop
1888 Find := Find.Next;
1889 end loop;
1890 Temp := Find;
1891 Find := Find.Next;
1892 Temp.Next := null;
1893 end if;
1894 if Find /= null then
1895 Ada.Text_IO.Put (Output_Object.Output_File,
1896 Find.Text (1 .. Find.Length));
1897 -- This should always be the last item:
1898 if Find.Next /= null then
1899 Ada.Text_IO.Put_Line ("** Column Item invariant failure!");
1900 end if;
1901 Free (Find);
1902 else -- No item, make a blank.
1903 Ada.Text_IO.Put (Output_Object.Output_File,
1904 "&nbsp;");
1905 end if;
1906 end;
1907 Ada.Text_IO.Put (Output_Object.Output_File, "<TD align=""left"">");
1908 end loop;
1909 if Output_Object.Column_Text = Column_Text_Ptrs_Type'(others => null) then
1910 -- We've output everything.
1911 Ada.Text_IO.New_Line (Output_Object.Output_File);
1912 if Output_Object.HTML_Kind = HTML_3 then
1913 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</TABLE></UL></UL>");
1914 else
1915 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</table></div>");
1916 end if;
1917 exit;
1918 end if;
1919 -- End the row:
1920 Ada.Text_IO.New_Line (Output_Object.Output_File);
1921 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
1922 end loop;
1923 Output_Object.Current_Column := 0;
1924 Output_Object.Current_Item := 0;
1925 -- else Two and Three column formats are displayed without any columns.
1926 -- This is mainly used for the syntax cross-reference and index, and
1927 -- these definitely look better without columns.
1928 end if;
1929 Output_Object.Column_Count := Number_of_Columns;
1930 end Set_Columns;
1931
1932
1933 procedure Check_Clause_File (Output_Object : in out HTML_Output_Type) is
1934 -- Check that a Clause file has been made for this clause; if not,
1935 -- create one.
1936 begin
1937 if not Ada.Text_IO.Is_Open (Output_Object.Output_File) then
1938 if (not Output_Object.Big_Files) and then
1939 Output_Object.DOS_Filenames and then
1940 Output_Object.Section_Name(1) = '-' then
1941 Start_HTML_File (Output_Object,
1942 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
1943 Make_Clause_Anchor_Name (Output_Object, Output_Object.Section_Name(2..3)), "", Clause => "");
1944 else
1945 Start_HTML_File (Output_Object,
1946 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
1947 "-" & Output_Object.Section_Name, "", Clause => "");
1948 end if;
1949 end if;
1950 end Check_Clause_File;
1951
1952
1953 procedure Put_Compatibility_Font_Info (Output_Object : in out HTML_Output_Type;
1954 Style : in ARM_Output.Paragraph_Style_Type;
1955 Indent : in ARM_Output.Paragraph_Indent_Type) is
1956 -- Internal:
1957 -- Output the font information for HTML 4.0 compatibility mode.
1958 begin
1959 if Output_Object.HTML_Kind = HTML_4_Compatible then
1960 case Paragraph_Info(Style, Indent).Font is
1961 when ARM_Output.Default =>
1962 if ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Swiss) then
1963 Ada.Text_IO.Put (Output_Object.Output_File, SWISS_FONT_CODE);
1964 Output_Object.Char_Count := Output_Object.Char_Count + SWISS_FONT_CODE'Length;
1965 -- else nothing for Roman.
1966 end if;
1967 when ARM_Output.Roman =>
1968 null;
1969 when ARM_Output.Swiss =>
1970 Ada.Text_IO.Put (Output_Object.Output_File, SWISS_FONT_CODE);
1971 Output_Object.Char_Count := Output_Object.Char_Count + SWISS_FONT_CODE'Length;
1972 when ARM_Output.Fixed =>
1973 Ada.Text_IO.Put (Output_Object.Output_File, "<TT>");
1974 Output_Object.Char_Count := Output_Object.Char_Count + 4;
1975 end case;
1976 if ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
1977 null; -- No font change here.
1978 else
1979 case Paragraph_Info(Style, Indent).Size is
1980 when 0 => null;
1981 when 1 =>
1982 Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""+1"">");
1983 Output_Object.Char_Count := Output_Object.Char_Count + 16;
1984 when 2 =>
1985 Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""+2"">");
1986 Output_Object.Char_Count := Output_Object.Char_Count + 16;
1987 when 3 =>
1988 Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""+3"">");
1989 Output_Object.Char_Count := Output_Object.Char_Count + 16;
1990 when -1 =>
1991 Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""-1"">");
1992 Output_Object.Char_Count := Output_Object.Char_Count + 16;
1993 when -2 =>
1994 Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""-2"">");
1995 Output_Object.Char_Count := Output_Object.Char_Count + 16;
1996 when -3 =>
1997 Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""-3"">");
1998 Output_Object.Char_Count := Output_Object.Char_Count + 16;
1999 when others => null; -- Not supported.
2000 end case;
2001 end if;
2002 end if;
2003 end Put_Compatibility_Font_Info;
2004
2005
2006 procedure Put_End_Compatibility_Font_Info (Output_Object : in out HTML_Output_Type;
2007 Style : in ARM_Output.Paragraph_Style_Type;
2008 Indent : in ARM_Output.Paragraph_Indent_Type) is
2009 -- Internal:
2010 -- Output the font information for HTML 4.0 compatibility mode.
2011 begin
2012 if Output_Object.HTML_Kind = HTML_4_Compatible then
2013 if ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
2014 null; -- No font change here.
2015 else
2016 case Paragraph_Info(Style, Indent).Size is
2017 when 0 => null;
2018 when 1 =>
2019 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2020 when 2 =>
2021 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2022 when -1 =>
2023 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2024 when -2 =>
2025 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2026 when -3 =>
2027 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2028 when others => null; -- Not supported.
2029 end case;
2030 end if;
2031 case Paragraph_Info(Style, Indent).Font is
2032 when ARM_Output.Default =>
2033 if ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Swiss) then
2034 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2035 -- else nothing for Roman.
2036 end if;
2037 when ARM_Output.Roman =>
2038 null;
2039 when ARM_Output.Swiss =>
2040 Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
2041 when ARM_Output.Fixed =>
2042 Ada.Text_IO.Put (Output_Object.Output_File, "</tt>");
2043 end case;
2044 end if;
2045 end Put_End_Compatibility_Font_Info;
2046
2047
2048 procedure Start_Paragraph (Output_Object : in out HTML_Output_Type;
2049 Style : in ARM_Output.Paragraph_Style_Type;
2050 Indent : in ARM_Output.Paragraph_Indent_Type;
2051 Number : in String;
2052 No_Prefix : in Boolean := False;
2053 Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS;
2054 No_Breaks : in Boolean := False;
2055 Keep_with_Next : in Boolean := False;
2056 Space_After : in ARM_Output.Space_After_Type
2057 := ARM_Output.Normal;
2058 Justification : in ARM_Output.Justification_Type
2059 := ARM_Output.Default) is
2060 -- Start a new paragraph. The style and indent of the paragraph is as
2061 -- specified. The (AA)RM paragraph number (which might include update
2062 -- and version numbers as well: [12.1/1]) is Number. If the format is
2063 -- a type with a prefix (bullets, hangining items), the prefix is
2064 -- omitted if No_Prefix is true. Tab_Stops defines the tab stops for
2065 -- the paragraph. If No_Breaks is True, we will try to avoid page breaks
2066 -- in the paragraph. If Keep_with_Next is true, we will try to avoid
2067 -- separating this paragraph and the next one. (These may have no
2068 -- effect in formats that don't have page breaks). Space_After
2069 -- specifies the amount of space following the paragraph. Justification
2070 -- specifies the text justification for the paragraph. Not_Valid_Error
2071 -- is raised if Tab_Stops /= NO_TABS for a hanging or bulleted format.
2072
2073 procedure Put_Style (Name : in String;
2074 Include_Compatibility : in Boolean := True;
2075 Use_DIV : in Boolean := False) is
2076 -- Output a style for HTML 4.0; if Include_Compatibility is True,
2077 -- include compatibility font information as well.
2078 -- If Use_DIV is true, ignore the contents of the
2079 -- style data and use a DIV.
2080 begin
2081 if Use_DIV then
2082 Ada.Text_IO.Put (Output_Object.Output_File, "<div");
2083 Output_Object.Char_Count := 4;
2084 else
2085 case Paragraph_Info(Style, Indent).Tag is
2086 when DIV =>
2087 Ada.Text_IO.Put (Output_Object.Output_File, "<div");
2088 Output_Object.Char_Count := 4;
2089 when UL =>
2090 Ada.Text_IO.Put (Output_Object.Output_File, "<ul");
2091 Output_Object.Char_Count := 3;
2092 when DL =>
2093 Ada.Text_IO.Put (Output_Object.Output_File, "<dl");
2094 Output_Object.Char_Count := 3;
2095 end case;
2096 end if;
2097 Ada.Text_IO.Put (Output_Object.Output_File, " class=""" & Name & """");
2098 Output_Object.Char_Count := Output_Object.Char_Count + 8 + Name'Length + 1;
2099 case Justification is
2100 when ARM_Output.Default | ARM_Output.Left | ARM_Output.Justified =>
2101 null;
2102 when ARM_Output.Center =>
2103 Ada.Text_IO.Put (Output_Object.Output_File, " style=""text-align: center""");
2104 Output_Object.Char_Count := Output_Object.Char_Count + 27;
2105 when ARM_Output.Right =>
2106 Ada.Text_IO.Put (Output_Object.Output_File, " style=""text-align: right""");
2107 Output_Object.Char_Count := Output_Object.Char_Count + 26;
2108 end case;
2109 case Space_After is
2110 when ARM_Output.Normal =>
2111 null;
2112 when ARM_Output.Narrow =>
2113 Ada.Text_IO.Put (Output_Object.Output_File, " style=""margin-bottom: ");
2114 Output_Object.Char_Count := Output_Object.Char_Count + 24;
2115 Put_EMs(Output_Object.Output_File, (Paragraph_Info(Style, Indent).After * LEADING_PERCENT) / 100);
2116 Ada.Text_IO.Put (Output_Object.Output_File, """");
2117 Output_Object.Char_Count := Output_Object.Char_Count + 6;
2118 when ARM_Output.Wide =>
2119 Ada.Text_IO.Put (Output_Object.Output_File, " style=""margin-bottom: ");
2120 Output_Object.Char_Count := Output_Object.Char_Count + 24;
2121 Put_EMs(Output_Object.Output_File, (Paragraph_Info(Style, Indent).After * TRAILING_PERCENT) / 100);
2122 Ada.Text_IO.Put (Output_Object.Output_File, """");
2123 Output_Object.Char_Count := Output_Object.Char_Count + 6;
2124 end case;
2125 Ada.Text_IO.Put (Output_Object.Output_File, ">");
2126 Output_Object.Char_Count := Output_Object.Char_Count + 1;
2127 if Output_Object.HTML_Kind = HTML_4_Compatible and then Include_Compatibility then
2128 Put_Compatibility_Font_Info (Output_Object, Style, Indent);
2129 end if;
2130 end Put_Style;
2131
2132 function Paranum_Anchor (Number : in String) return String is
2133 -- Create the string for an anchor from a paragraph number.
2134 -- Note that anchors cannot use "/", so we strip the
2135 -- slash part. "." is allowed (as well as "-", "_", and ":", but
2136 -- nothing else). We don't need the slash part (the version number),
2137 -- as paragraph numbers are unique without it, and the version
2138 -- is specified by the enclosing document (given by the rest of
2139 -- the page).
2140 Where : constant Natural := Ada.Strings.Fixed.Index (Number, "/");
2141 begin
2142 if Where = 0 then
2143 return Number;
2144 else
2145 return Number(Number'First..Where-1);
2146 end if;
2147 end Paranum_Anchor;
2148
2149 begin
2150 if not Output_Object.Is_Valid then
2151 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2152 "Not valid object");
2153 end if;
2154 if Output_Object.Is_In_Paragraph then
2155 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2156 "Already in paragraph");
2157 end if;
2158 if not Output_Object.Number_Paragraphs and then
2159 Number /= "" then
2160 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2161 "Paragraph number when none used");
2162 end if;
2163 if not Paragraph_Info(Style, Indent).Defined then
2164 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2165 "Undefined style " & ARM_Output.Paragraph_Style_Type'Image(Style) &
2166 " and indent" & ARM_Output.Paragraph_Indent_Type'Image(Indent));
2167 end if;
2168
2169 Output_Object.Is_In_Paragraph := True;
2170 Output_Object.Had_Prefix := not No_Prefix;
2171 Output_Object.Char_Count := 0;
2172 Output_Object.Disp_Char_Count := 0;
2173 Output_Object.Disp_Large_Char_Count := 0;
2174 Output_Object.Any_Nonspace := False;
2175 Output_Object.Last_Was_Space := True; -- Start of line
2176 Output_Object.Conditional_Space := False;
2177 Output_Object.Saw_Hang_End := False;
2178 Output_Object.In_Local_Link := False;
2179 Check_Clause_File (Output_Object);
2180 -- Note: We only support Justification for the Normal and Wide styles.
2181 if Output_Object.Column_Count >= 4 then
2182 -- Formatting is deferred; only a few formats are supported.
2183 if Tab_Stops.Number /= 0 then
2184 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2185 "Tabs in 4+ column text");
2186 end if;
2187 case Style is
2188 when ARM_Output.Normal =>
2189 null;
2190 when others =>
2191 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2192 "Unsupported format in 4+ column text - " & ARM_Output.Paragraph_Style_Type'Image(Style));
2193 end case;
2194 if Number /= "" then
2195 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2196 "No paragraph numbers in 4+ column text");
2197 end if;
2198 return; -- Nothing more to do here.
2199 end if;
2200
2201 -- Set up tabs:
2202 case Style is
2203 when ARM_Output.Normal | ARM_Output.Wide_Above |
2204 ARM_Output.Small | ARM_Output.Small_Wide_Above |
2205 ARM_Output.Header | ARM_Output.Small_Header |
2206 ARM_Output.Index | ARM_Output.Syntax_Summary |
2207 ARM_Output.Title |
2208 ARM_Output.Examples | ARM_Output.Small_Examples |
2209 ARM_Output.Swiss_Examples | ARM_Output.Small_Swiss_Examples =>
2210 Output_Object.Tab_Stops := Tab_Stops;
2211 -- No tabs in HTML; we'll emulate them for fixed fonts.
2212 -- We'll expand proportional stops here (text characters
2213 -- are larger than the variable ones these are set up for).
2214 Output_Object.Can_Emulate_Tabs :=
2215 ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed);
2216 for I in 1 .. Tab_Stops.Number loop
2217 if ARM_Output."=" (Tab_Stops.Stops(I).Kind,
2218 ARM_Output.Left_Proportional) then
2219 if ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
2220 Output_Object.Tab_Stops.Stops(I).Stop :=
2221 (Tab_Stops.Stops(I).Stop * 13 / 12);
2222 else -- Proportional characters are smaller.
2223 Output_Object.Tab_Stops.Stops(I).Stop :=
2224 (Tab_Stops.Stops(I).Stop * 5 / 4);
2225 end if;
2226 else
2227 Output_Object.Tab_Stops.Stops(I).Stop :=
2228 Tab_Stops.Stops(I).Stop;
2229 end if;
2230 end loop;
2231
2232 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
2233 ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted |
2234 ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2235 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2236 ARM_Output.Hanging_in_Bulleted |
2237 ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2238 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2239 ARM_Output.Small_Hanging_in_Bulleted |
2240 ARM_Output.Enumerated | ARM_Output.Small_Enumerated =>
2241 if Tab_Stops.Number /= 0 then
2242 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2243 "Tabs in hanging/bulleted paragraph");
2244 end if;
2245 Output_Object.Can_Emulate_Tabs := False;
2246 end case;
2247
2248 if Output_Object.HTML_Kind = HTML_3 then
2249 -- Note: We can't control the space below the paragraphs here, so
2250 -- Space_After is ignored.
2251 -- Make any indents:
2252 for I in 1 .. Indent loop
2253 Ada.Text_IO.Put (Output_Object.Output_File, "<UL>");
2254 Output_Object.Char_Count := Output_Object.Char_Count + 4;
2255 end loop;
2256 case Style is
2257 when ARM_Output.Normal | ARM_Output.Wide_Above |
2258 ARM_Output.Header =>
2259 if ARM_Output."=" (Indent, 0) then
2260 case Justification is
2261 when ARM_Output.Default | ARM_Output.Left | ARM_Output.Justified =>
2262 Ada.Text_IO.Put (Output_Object.Output_File, "<P>");
2263 Output_Object.Char_Count := 3;
2264 when ARM_Output.Center =>
2265 Ada.Text_IO.Put (Output_Object.Output_File, "<P ALIGN=CENTER>");
2266 Output_Object.Char_Count := 16;
2267 when ARM_Output.Right =>
2268 Ada.Text_IO.Put (Output_Object.Output_File, "<P ALIGN=RIGHT>");
2269 Output_Object.Char_Count := 15;
2270 end case;
2271 else
2272 null; -- Formatting is hard in HTML 3!
2273 end if;
2274
2275 when ARM_Output.Small | ARM_Output.Small_Wide_Above |
2276 ARM_Output.Small_Header =>
2277 Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=-1>");
2278 Output_Object.Char_Count := Output_Object.Char_Count + 14;
2279
2280 when ARM_Output.Index =>
2281 -- Note: We don't put this in a smaller font.
2282 if ARM_Output."=" (Indent, 0) then
2283 Ada.Text_IO.Put (Output_Object.Output_File, "<P>");
2284 Output_Object.Char_Count := 3;
2285 else
2286 null; -- Formatting is hard in HTML 3!
2287 end if;
2288
2289 when ARM_Output.Syntax_Summary =>
2290 -- Note: We don't put this in a smaller font.
2291 null;
2292
2293 when ARM_Output.Title =>
2294 Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=+3>");
2295 Output_Object.Char_Count := Output_Object.Char_Count + 14;
2296
2297 when ARM_Output.Examples =>
2298 Ada.Text_IO.Put (Output_Object.Output_File, "<TT>");
2299 Output_Object.Char_Count := Output_Object.Char_Count + 4;
2300 when ARM_Output.Small_Examples =>
2301 Ada.Text_IO.Put (Output_Object.Output_File, "<TT><FONT SIZE=-1>");
2302 Output_Object.Char_Count := Output_Object.Char_Count + 18;
2303 when ARM_Output.Swiss_Examples =>
2304 Ada.Text_IO.Put (Output_Object.Output_File, SWISS_FONT_CODE);
2305 Output_Object.Char_Count := Output_Object.Char_Count + SWISS_FONT_CODE'Length;
2306 when ARM_Output.Small_Swiss_Examples =>
2307 Ada.Text_IO.Put (Output_Object.Output_File, SMALL_SWISS_FONT_CODE);
2308 Output_Object.Char_Count := Output_Object.Char_Count + SMALL_SWISS_FONT_CODE'Length;
2309
2310 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted =>
2311 if No_Prefix then
2312 null;
2313 else
2314 Ada.Text_IO.Put (Output_Object.Output_File, "<LI TYPE=DISC>");
2315 Output_Object.Char_Count := Output_Object.Char_Count + 14;
2316 end if;
2317
2318 when ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
2319 if No_Prefix then
2320 Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=-1>");
2321 Output_Object.Char_Count := Output_Object.Char_Count + 14;
2322 else
2323 Ada.Text_IO.Put (Output_Object.Output_File, "<LI TYPE=DISC><FONT SIZE=-1>");
2324 Output_Object.Char_Count := Output_Object.Char_Count + 28;
2325 end if;
2326
2327 when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2328 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2329 ARM_Output.Hanging_in_Bulleted |
2330 ARM_Output.Enumerated =>
2331 if No_Prefix then
2332 Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DD>");
2333 Output_Object.Char_Count := Output_Object.Char_Count + 8;
2334 Output_Object.Saw_Hang_End := True;
2335 else -- Has prefix.
2336 Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DT>");
2337 Output_Object.Char_Count := Output_Object.Char_Count + 8;
2338 Output_Object.Saw_Hang_End := False;
2339 end if;
2340
2341 when ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2342 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2343 ARM_Output.Small_Hanging_in_Bulleted |
2344 ARM_Output.Small_Enumerated =>
2345 if No_Prefix then
2346 Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DD><FONT SIZE=-1>");
2347 Output_Object.Char_Count := Output_Object.Char_Count + 22;
2348 Output_Object.Saw_Hang_End := True;
2349 else -- Has prefix.
2350 Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DT><FONT SIZE=-1>");
2351 Output_Object.Char_Count := Output_Object.Char_Count + 22;
2352 Output_Object.Saw_Hang_End := False;
2353 end if;
2354 end case;
2355 Output_Object.Paragraph_Style := Style;
2356 Output_Object.Paragraph_Indent := Indent;
2357 Output_Object.Font := ARM_Output.Default;
2358 Output_Object.Is_Bold := False;
2359 Output_Object.Is_Italic := False;
2360 Output_Object.Size := 0;
2361 Output_Object.Color := ARM_Output.Default;
2362 Output_Object.Change := ARM_Output.None;
2363 Output_Object.Version := '0';
2364 Output_Object.Added_Version := '0';
2365 if Number /= "" then -- Has paragraph number.
2366 Ada.Text_IO.Put (Output_Object.Output_File, "<A NAME=""p");
2367 Ada.Text_IO.Put (Output_Object.Output_File, Paranum_Anchor(Number));
2368 Ada.Text_IO.Put (Output_Object.Output_File, """>");
2369 Ada.Text_IO.Put (Output_Object.Output_File, TINY_SWISS_FONT_CODE);
2370 Ada.Text_IO.Put (Output_Object.Output_File, Number);
2371 Ada.Text_IO.Put (Output_Object.Output_File, Number);
2372 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT></A> ");
2373 Output_Object.Char_Count := Output_Object.Char_Count + TINY_SWISS_FONT_CODE'Length + Number'Length + 8;
2374 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + ((Number'Length+1)/2) + 1;
2375 -- Note: Count these as half characters, as the font is so small.
2376 --Output_Object.Disp_Large_Char_Count := <unchanged>;
2377 end if;
2378
2379 elsif Output_Object.HTML_Kind = HTML_4_Compatible then
2380 if Number /= "" then -- Has paragraph number.
2381 Paranum_Used := True;
2382 Ada.Text_IO.Put (Output_Object.Output_File, "<div class=""paranum"">");
2383 Ada.Text_IO.Put (Output_Object.Output_File, "<a name=""p");
2384 Ada.Text_IO.Put (Output_Object.Output_File, Paranum_Anchor(Number));
2385 Ada.Text_IO.Put (Output_Object.Output_File, """><font size=-2>");
2386 Ada.Text_IO.Put (Output_Object.Output_File, Number);
2387 Ada.Text_IO.Put (Output_Object.Output_File, "</font></a>");
2388 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</div>");
2389 Output_Object.Char_Count := 0;
2390 Output_Object.Disp_Char_Count := 0;
2391 Output_Object.Disp_Large_Char_Count := 0;
2392 Output_Object.Any_Nonspace := False;
2393 Output_Object.Last_Was_Space := True; -- Start of line
2394 Output_Object.Conditional_Space := False; -- Don't need it here.
2395 end if;
2396
2397 case Style is
2398 when ARM_Output.Normal | ARM_Output.Wide_Above |
2399 ARM_Output.Header |
2400 ARM_Output.Small | ARM_Output.Small_Wide_Above |
2401 ARM_Output.Small_Header |
2402 ARM_Output.Index | ARM_Output.Syntax_Summary |
2403 ARM_Output.Title |
2404 ARM_Output.Examples | ARM_Output.Swiss_Examples |
2405 ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
2406 Put_Style (Paragraph_Name (Style, Indent));
2407
2408 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
2409 ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
2410 Put_Style (Paragraph_Name (Style, Indent), Include_Compatibility => False);
2411 if No_Prefix then
2412 null;
2413 else
2414 Ada.Text_IO.Put (Output_Object.Output_File, "<li type=disc>");
2415 Output_Object.Char_Count := Output_Object.Char_Count + 14;
2416 end if;
2417 Put_Compatibility_Font_Info (Output_Object, Style, Indent);
2418
2419 when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2420 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2421 ARM_Output.Hanging_in_Bulleted |
2422 ARM_Output.Enumerated |
2423 ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2424 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2425 ARM_Output.Small_Hanging_in_Bulleted |
2426 ARM_Output.Small_Enumerated =>
2427 declare
2428 PName : constant String :=
2429 Paragraph_Name (Style, Indent);
2430 begin
2431 Put_Style (PName, Include_Compatibility => False);
2432 if No_Prefix then
2433 Ada.Text_IO.Put (Output_Object.Output_File, "<dd class="" & PName & "">");
2434 Output_Object.Char_Count := Output_Object.Char_Count + 13 + PName'Length;
2435 Output_Object.Saw_Hang_End := True;
2436 --Ada.Text_IO.Put_Line("HTML: 4Comp, Hang Start, Noprefix");
2437 else -- Has prefix.
2438 Ada.Text_IO.Put (Output_Object.Output_File, "<dt>");
2439 Output_Object.Char_Count := Output_Object.Char_Count + 4;
2440 Output_Object.Saw_Hang_End := False;
2441 --Ada.Text_IO.Put_Line("HTML: 4Comp, Hang Start");
2442 end if;
2443 Put_Compatibility_Font_Info (Output_Object, Style, Indent);
2444 end;
2445
2446 end case;
2447 Output_Object.Paragraph_Style := Style;
2448 Output_Object.Paragraph_Indent := Indent;
2449 Output_Object.Font := ARM_Output.Default;
2450 Output_Object.Is_Bold := False;
2451 Output_Object.Is_Italic := False;
2452 Output_Object.Size := 0;
2453 Output_Object.Color := ARM_Output.Default;
2454 Output_Object.Change := ARM_Output.None;
2455 Output_Object.Version := '0';
2456 Output_Object.Added_Version := '0';
2457 if Number /= "" then -- Has paragraph number.
2458 if Paragraph_Info(Style, Indent).Indent = 0 and then
2459 ((not No_Prefix) or else
2460 Style in ARM_Output.Unprefixed_Style_Subtype) then
2461 -- No indent, either a prefix or a style that doesn't
2462 -- have a prefix.
2463 -- We may have to make a space for the paragraph number,
2464 -- as absolute positioned or floating items can overlap
2465 -- others.
2466 for I in 1 .. (Number'Length+2)-(INDENT_EMS_FOR_PARANUMS/5) loop
2467 -- We assume that each space is roughly equal to
2468 -- 0.5em (that should be conservative).
2469 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;");
2470 Output_Object.Char_Count := Output_Object.Char_Count + 1;
2471 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
2472 --Output_Object.Disp_Large_Char_Count := <unchanged>;
2473 end loop;
2474 -- else is indented, so we don't need to make space.
2475 end if;
2476 end if;
2477 else -- HTML_4_Only.
2478 if Number /= "" then -- Has paragraph number.
2479 Paranum_Used := True;
2480 Ada.Text_IO.Put (Output_Object.Output_File, "<div class=""paranum"">");
2481 Ada.Text_IO.Put (Output_Object.Output_File, "<a name=""p");
2482 Ada.Text_IO.Put (Output_Object.Output_File, Paranum_Anchor(Number));
2483 Ada.Text_IO.Put (Output_Object.Output_File, """>");
2484 Ada.Text_IO.Put (Output_Object.Output_File, Number);
2485 Ada.Text_IO.Put (Output_Object.Output_File, "</a>");
2486 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</div>");
2487 Output_Object.Char_Count := 0;
2488 Output_Object.Disp_Char_Count := 0;
2489 Output_Object.Disp_Large_Char_Count := 0;
2490 Output_Object.Any_Nonspace := False;
2491 Output_Object.Last_Was_Space := True; -- Start of line
2492 Output_Object.Conditional_Space := False; -- Don't need it here.
2493 end if;
2494
2495 case Style is
2496 when ARM_Output.Normal | ARM_Output.Wide_Above |
2497 ARM_Output.Header |
2498 ARM_Output.Small | ARM_Output.Small_Wide_Above |
2499 ARM_Output.Small_Header |
2500 ARM_Output.Index | ARM_Output.Syntax_Summary |
2501 ARM_Output.Title |
2502 ARM_Output.Examples | ARM_Output.Swiss_Examples |
2503 ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
2504 Put_Style (Paragraph_Name (Style, Indent));
2505
2506 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
2507 ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
2508 -- We use formatted DIVs here, as otherwise the indenting
2509 -- varies wildly between Firefox and IE (and does not
2510 -- match similar enumerated lists).
2511 if No_Prefix then
2512 Put_Style (Paragraph_Name (Style, Indent) & "-NoPrefix", Use_DIV => True);
2513 else
2514 Put_Style (Paragraph_Name (Style, Indent), Use_DIV => True);
2515 end if;
2516
2517 when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2518 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2519 ARM_Output.Hanging_in_Bulleted |
2520 ARM_Output.Enumerated |
2521 ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2522 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2523 ARM_Output.Small_Hanging_in_Bulleted |
2524 ARM_Output.Small_Enumerated =>
2525 if No_Prefix then
2526 Put_Style (Paragraph_Name (Style, Indent) & "-Body", Use_DIV => True);
2527 Output_Object.Saw_Hang_End := True;
2528 --Ada.Text_IO.Put_Line("HTML: 4, Hang Start, Noprefix");
2529 else -- Has prefix.
2530 Put_Style (Paragraph_Name (Style, Indent) & "-Term", Use_DIV => True);
2531 Output_Object.Saw_Hang_End := False;
2532 --Ada.Text_IO.Put_Line("HTML: 4, Hang Start, Normal");
2533 end if;
2534 end case;
2535 Output_Object.Paragraph_Style := Style;
2536 Output_Object.Paragraph_Indent := Indent;
2537 Output_Object.Font := ARM_Output.Default;
2538 Output_Object.Is_Bold := False;
2539 Output_Object.Is_Italic := False;
2540 Output_Object.Size := 0;
2541 Output_Object.Color := ARM_Output.Default;
2542 Output_Object.Change := ARM_Output.None;
2543 Output_Object.Version := '0';
2544 Output_Object.Added_Version := '0';
2545 if Number /= "" then -- Has paragraph number.
2546 if Paragraph_Info(Style, Indent).Indent = 0 and then
2547 ((not No_Prefix) or else
2548 Style in ARM_Output.Unprefixed_Style_Subtype) then
2549 -- No indent, either a prefix or a style that doesn't
2550 -- have a prefix.
2551 -- We may have to make a space for the paragraph number,
2552 -- as absolute positioned or floating items can overlap
2553 -- others.
2554 for I in 1 .. (Number'Length+2)-((INDENT_EMS_FOR_PARANUMS+5)*3/10) loop
2555 -- We assume that each space is roughly equal to
2556 -- 0.33em (that should be conservative). We also assume
2557 -- that the normal left edge space is 1.0em (this is
2558 -- true on IE 5&6). Paragraph numbers are positioned
2559 -- at 0.5ems, so the additional difference is +5.
2560 Ada.Text_IO.Put (Output_Object.Output_File, "&nbsp;");
2561 Output_Object.Char_Count := Output_Object.Char_Count + 1;
2562 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
2563 --Output_Object.Disp_Large_Char_Count := <unchanged>;
2564 end loop;
2565 -- else is indented, so we don't need to make space.
2566 end if;
2567 end if;
2568 end if;
2569 Paragraph_Used(Style, Indent) := True;
2570
2571 -- Note: No_Breaks and Keep_with_Next have no effect here, because
2572 -- HTML doesn't have page breaks.
2573 end Start_Paragraph;
2574
2575
2576 procedure End_Paragraph (Output_Object : in out HTML_Output_Type) is
2577 -- End a paragraph.
2578
2579 procedure Put_End_Style (Style : in ARM_Output.Paragraph_Style_Type;
2580 Indent : in ARM_Output.Paragraph_Indent_Type;
2581 Include_Compatibility : in Boolean := True) is
2582 -- Output a end style for HTML 4.0; if Include_Compatibility is True,
2583 -- include compatibility font information as well.
2584 begin
2585 if Output_Object.HTML_Kind = HTML_4_Compatible and then Include_Compatibility then
2586 Put_End_Compatibility_Font_Info (Output_Object, Style, Indent);
2587 end if;
2588 case Paragraph_Info(Style, Indent).Tag is
2589 when DIV =>
2590 Ada.Text_IO.Put (Output_Object.Output_File, "</div>");
2591 when UL =>
2592 Ada.Text_IO.Put (Output_Object.Output_File, "</ul>");
2593 when DL =>
2594 Ada.Text_IO.Put (Output_Object.Output_File, "</dl>");
2595 end case;
2596 end Put_End_Style;
2597
2598 begin
2599 if not Output_Object.Is_Valid then
2600 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2601 "Not valid object");
2602 end if;
2603 if not Output_Object.Is_In_Paragraph then
2604 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2605 "Not in paragraph");
2606 end if;
2607 Output_Object.Is_In_Paragraph := False;
2608 if Output_Object.In_Local_Link then
2609 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2610 "Unclosed Local_Link");
2611 Output_Object.In_Local_Link := False;
2612 end if;
2613 if Output_Object.Column_Count >= 4 then
2614 -- Formatting is deferred; only a few formats are supported.
2615 if Output_Object.Column_Text (Output_Object.Current_Column) /= null and then
2616 Output_Object.Column_Text (Output_Object.Current_Column).Item = Output_Object.Current_Item then
2617 Output_Object.Column_Text (Output_Object.Current_Column).End_Para := True;
2618 end if;
2619 Output_Object.Current_Item := Output_Object.Current_Item + 2; -- Skip an item.
2620 Output_Object.Char_Count := 0;
2621 Output_Object.Disp_Char_Count := 0;
2622 Output_Object.Disp_Large_Char_Count := 0;
2623 Output_Object.Any_Nonspace := False;
2624 Output_Object.Last_Was_Space := True; -- Start of line.
2625 Output_Object.Conditional_Space := False; -- Don't need it here.
2626 return; -- Nothing else to do here.
2627 end if;
2628
2629 if Output_Object.HTML_Kind = HTML_3 then
2630 case Output_Object.Paragraph_Style is
2631 when ARM_Output.Normal | ARM_Output.Wide_Above | ARM_Output.Header |
2632 ARM_Output.Index =>
2633 if ARM_Output."=" (Output_Object.Paragraph_Indent, 0) then
2634 Ada.Text_IO.Put (Output_Object.Output_File, "</P>");
2635 -- else let the indent nesting handling it.
2636 end if;
2637 when ARM_Output.Syntax_Summary =>
2638 null;
2639 when ARM_Output.Small | ARM_Output.Small_Wide_Above |
2640 ARM_Output.Small_Header =>
2641 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
2642 when ARM_Output.Title =>
2643 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
2644
2645 when ARM_Output.Examples =>
2646 Ada.Text_IO.Put (Output_Object.Output_File, "</TT>");
2647 when ARM_Output.Small_Examples =>
2648 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
2649 when ARM_Output.Swiss_Examples =>
2650 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
2651 when ARM_Output.Small_Swiss_Examples =>
2652 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
2653
2654 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted =>
2655 if Output_Object.Had_Prefix then
2656 Ada.Text_IO.Put (Output_Object.Output_File, "</LI>");
2657 -- else nothing to do.
2658 end if;
2659 when ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
2660 if Output_Object.Had_Prefix then
2661 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT></LI>");
2662 else
2663 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
2664 end if;
2665
2666 when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2667 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2668 ARM_Output.Hanging_in_Bulleted |
2669 ARM_Output.Enumerated =>
2670 Ada.Text_IO.Put (Output_Object.Output_File, "</DL>");
2671
2672 when ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2673 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2674 ARM_Output.Small_Hanging_in_Bulleted |
2675 ARM_Output.Small_Enumerated =>
2676 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT></DL>");
2677
2678 end case;
2679 -- Reverse any indents:
2680 for I in reverse 1 .. Output_Object.Paragraph_Indent loop
2681 Ada.Text_IO.Put (Output_Object.Output_File, "</UL>");
2682 end loop;
2683 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
2684
2685 elsif Output_Object.HTML_Kind = HTML_4_Only then
2686 case Output_Object.Paragraph_Style is
2687 when ARM_Output.Normal | ARM_Output.Wide_Above |
2688 ARM_Output.Header |
2689 ARM_Output.Small | ARM_Output.Small_Wide_Above |
2690 ARM_Output.Small_Header |
2691 ARM_Output.Index | ARM_Output.Syntax_Summary |
2692 ARM_Output.Title |
2693 ARM_Output.Examples | ARM_Output.Swiss_Examples |
2694 ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
2695 Put_End_Style (Output_Object.Paragraph_Style,
2696 Output_Object.Paragraph_Indent);
2697 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
2698 ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
2699 -- We've overridden the style class here.
2700 Ada.Text_IO.Put (Output_Object.Output_File, "</div>");
2701 when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2702 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2703 ARM_Output.Hanging_in_Bulleted |
2704 ARM_Output.Enumerated |
2705 ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2706 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2707 ARM_Output.Small_Hanging_in_Bulleted |
2708 ARM_Output.Small_Enumerated =>
2709 -- We've overridden the style class here.
2710 Ada.Text_IO.Put (Output_Object.Output_File, "</div>");
2711 end case;
2712 Ada.Text_IO.New_Line (Output_Object.Output_File);
2713 else -- if Output_Object.HTML_Kind = HTML_4_Compatible
2714 case Output_Object.Paragraph_Style is
2715 when ARM_Output.Normal | ARM_Output.Wide_Above |
2716 ARM_Output.Header |
2717 ARM_Output.Small | ARM_Output.Small_Wide_Above |
2718 ARM_Output.Small_Header |
2719 ARM_Output.Index | ARM_Output.Syntax_Summary |
2720 ARM_Output.Title |
2721 ARM_Output.Examples | ARM_Output.Swiss_Examples |
2722 ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
2723 Put_End_Style (Output_Object.Paragraph_Style,
2724 Output_Object.Paragraph_Indent);
2725 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
2726 ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
2727 Put_End_Compatibility_Font_Info (Output_Object,
2728 Output_Object.Paragraph_Style,
2729 Output_Object.Paragraph_Indent);
2730 if Output_Object.Had_Prefix then
2731 Ada.Text_IO.Put (Output_Object.Output_File, "</li>");
2732 -- else null;
2733 end if;
2734 Put_End_Style (Output_Object.Paragraph_Style,
2735 Output_Object.Paragraph_Indent,
2736 Include_Compatibility => False);
2737 when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
2738 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
2739 ARM_Output.Hanging_in_Bulleted |
2740 ARM_Output.Enumerated |
2741 ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
2742 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
2743 ARM_Output.Small_Hanging_in_Bulleted |
2744 ARM_Output.Small_Enumerated =>
2745 Put_End_Style (Output_Object.Paragraph_Style,
2746 Output_Object.Paragraph_Indent);
2747 end case;
2748 Ada.Text_IO.New_Line (Output_Object.Output_File);
2749 end if;
2750 Output_Object.Char_Count := 0;
2751 Output_Object.Disp_Char_Count := 0;
2752 Output_Object.Disp_Large_Char_Count := 0;
2753 Output_Object.Any_Nonspace := False;
2754 Output_Object.Last_Was_Space := True; -- Start of line.
2755 Output_Object.Conditional_Space := False; -- Don't need it here.
2756 end End_Paragraph;
2757
2758
2759 procedure Category_Header (Output_Object : in out HTML_Output_Type;
2760 Header_Text : String) is
2761 -- Output a Category header (that is, "Legality Rules",
2762 -- "Dynamic Semantics", etc.)
2763 -- (Note: We did not use a enumeration here to insure that these
2764 -- headers are spelled the same in all output versions).
2765 -- Raises Not_Valid_Error if in a paragraph.
2766 begin
2767 if not Output_Object.Is_Valid then
2768 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2769 "Not valid object");
2770 end if;
2771 if Output_Object.Is_In_Paragraph then
2772 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2773 "Header in paragraph");
2774 end if;
2775 Ada.Text_IO.New_Line (Output_Object.Output_File);
2776 if Output_Object.HTML_Kind = HTML_4_Only then
2777 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H4 Class=""centered"">" & Header_Text & "</H4>");
2778 else
2779 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H4 ALIGN=CENTER>" & Header_Text & "</H4>");
2780 end if;
2781 Output_Object.Char_Count := 0;
2782 Output_Object.Disp_Char_Count := 0;
2783 Output_Object.Disp_Large_Char_Count := 0;
2784 Output_Object.Any_Nonspace := False;
2785 Output_Object.Last_Was_Space := True; -- Start of line.
2786 Output_Object.Conditional_Space := False; -- Don't need it here.
2787 end Category_Header;
2788
2789
2790 procedure Clause_Header (Output_Object : in out HTML_Output_Type;
2791 Header_Text : in String;
2792 Level : in ARM_Contents.Level_Type;
2793 Clause_Number : in String;
2794 Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
2795 No_Page_Break : in Boolean := False) is
2796 -- Output a Clause header. The level of the header is specified
2797 -- in Level. The Clause Number is as specified; the top-level (and
2798 -- other) subdivision names are as specified. These should appear in
2799 -- the table of contents.
2800 -- For hyperlinked formats, this should generate a link target.
2801 -- If No_Page_Break is True, suppress any page breaks.
2802 -- Raises Not_Valid_Error if in a paragraph.
2803 begin
2804 if not Output_Object.Is_Valid then
2805 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2806 "Not valid object");
2807 end if;
2808 if Output_Object.Is_In_Paragraph then
2809 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2810 "Header in paragraph");
2811 end if;
2812
2813 if not Output_Object.Big_Files then
2814 if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
2815 End_HTML_File (Output_Object);
2816 end if;
2817
2818 -- Special for table of contents:
2819 if Clause_Number = "" and then
2820 (Header_Text = "Table of Contents" or else -- Ada 95 format
2821 Header_Text = "Contents") then -- ISO 2004 format.
2822 Start_HTML_File (Output_Object,
2823 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
2824 "-TOC", Header_Text, "");
2825 if Header_Text = "Table of Contents" then -- Ada 95 format
2826 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Table of Contents</H1>");
2827 else
2828 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Contents</H1>");
2829 end if;
2830 Output_Object.Char_Count := 0;
2831 Output_Object.Disp_Char_Count := 0;
2832 Output_Object.Disp_Large_Char_Count := 0;
2833 Output_Object.Any_Nonspace := False;
2834 Output_Object.Last_Was_Space := True; -- Start of line.
2835 Output_Object.Conditional_Space := False; -- Don't need it here.
2836 return;
2837 end if;
2838
2839 Start_HTML_File (Output_Object,
2840 Make_Clause_File_Name (Output_Object, Clause_Number),
2841 Header_Text, Clause_Number);
2842 else -- Big Files:
2843 if Clause_Number = "" and then
2844 (Header_Text = "Table of Contents" or else -- Ada 95 format
2845 Header_Text = "Contents") then -- ISO 2004 format.
2846 -- Insert an anchor:
2847 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<A NAME=""TOC""></A>");
2848 if Header_Text = "Table of Contents" then -- Ada 95 format
2849 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Table of Contents</H1>");
2850 else
2851 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Contents</H1>");
2852 end if;
2853 Output_Object.Char_Count := 0;
2854 Output_Object.Disp_Char_Count := 0;
2855 Output_Object.Disp_Large_Char_Count := 0;
2856 Output_Object.Any_Nonspace := False;
2857 Output_Object.Last_Was_Space := True; -- Start of line.
2858 Output_Object.Conditional_Space := False; -- Don't need it here.
2859 return;
2860 end if;
2861 -- Insert an anchor:
2862 Ada.Text_IO.Put (Output_Object.Output_File, "<A NAME=""");
2863 Ada.Text_IO.Put (Output_Object.Output_File,
2864 Make_Clause_Anchor_Name (Output_Object, Clause_Number));
2865 Ada.Text_IO.Put_Line (Output_Object.Output_File, """></A>");
2866 end if;
2867
2868 case Level is
2869 when ARM_Contents.Plain_Annex =>
2870 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number &
2871 "<BR>"); -- Note: Clause_Number includes "Annex"
2872 Ada.Text_IO.Put_Line (Output_Object.Output_File, Header_Text & "</H1>");
2873 when ARM_Contents.Normative_Annex =>
2874 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
2875 -- Note: Clause_Number includes "Annex"
2876 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(normative)</H2>");
2877 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
2878 when ARM_Contents.Informative_Annex =>
2879 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
2880 -- Note: Clause_Number includes "Annex"
2881 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(informative)</H2>");
2882 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
2883 when ARM_Contents.Unnumbered_Section =>
2884 if Header_Text /= "" then
2885 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
2886 Header_Text & "</H1>");
2887 end if;
2888 when ARM_Contents.Section =>
2889 case Top_Level_Subdivision_Name is
2890 when ARM_Output.Chapter =>
2891 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Chapter " &
2892 Clause_Number & ": " & Header_Text & "</H1>");
2893 when ARM_Output.Section =>
2894 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Section " &
2895 Clause_Number & ": " & Header_Text & "</H1>");
2896 when ARM_Output.Clause =>
2897 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
2898 Clause_Number & " &nbsp; " & Header_Text & "</H1>");
2899 end case;
2900 when ARM_Contents.Clause | ARM_Contents.Subclause |
2901 ARM_Contents.Subsubclause =>
2902 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
2903 Clause_Number & ' ' & Header_Text & "</H1>");
2904 when ARM_Contents.Dead_Clause =>
2905 raise Program_Error; -- No headers for dead clauses.
2906 end case;
2907 Output_Object.Char_Count := 0;
2908 Output_Object.Disp_Char_Count := 0;
2909 Output_Object.Disp_Large_Char_Count := 0;
2910 Output_Object.Any_Nonspace := False;
2911 Output_Object.Last_Was_Space := True; -- Start of line.
2912 Output_Object.Conditional_Space := False; -- Don't need it here.
2913 -- No page breaks in HTML, so we don't need to look at No_Page_Break.
2914 end Clause_Header;
2915
2916
2917 procedure Revised_Clause_Header
2918 (Output_Object : in out HTML_Output_Type;
2919 New_Header_Text : in String;
2920 Old_Header_Text : in String;
2921 Level : in ARM_Contents.Level_Type;
2922 Clause_Number : in String;
2923 Version : in ARM_Contents.Change_Version_Type;
2924 Old_Version : in ARM_Contents.Change_Version_Type;
2925 Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
2926 No_Page_Break : in Boolean := False) is
2927 -- Output a revised clause header. Both the original and new text will
2928 -- be output. The level of the header is specified in Level. The Clause
2929 -- Number is as specified; the top-level (and other) subdivision names
2930 -- are as specified. These should appear in the table of contents.
2931 -- For hyperlinked formats, this should generate a link target.
2932 -- Version is the insertion version of the new text; Old_Version is
2933 -- the insertion version of the old text.
2934 -- If No_Page_Break is True, suppress any page breaks.
2935 -- Raises Not_Valid_Error if in a paragraph.
2936 function Header_Text return String is
2937 begin
2938 if Output_Object.HTML_Kind = HTML_3 then
2939 if Old_Version = '0' then -- Old text is original text
2940 return "<U>" & New_Header_Text & "</U><S>" & Old_Header_Text & "</S>";
2941 else
2942 return "<U>" & New_Header_Text & "</U><S><U>" & Old_Header_Text & "</U></S>";
2943 end if;
2944 elsif Old_Version = '0' then -- Old text is original text
2945 Revision_Used(Version) := True;
2946 return "<span class=""insert" & Version & """>" & New_Header_Text &
2947 "</span><span class=""delete" & Version & """>" & Old_Header_Text & "</span>";
2948 else
2949 Revision_Used(Version) := True;
2950 Revision_Used(Old_Version) := True;
2951 return "<span class=""insert" & Version & """>" & New_Header_Text &
2952 "</span><span class=""delete" & Version & """><span class=""insert" & Old_Version & """>" &
2953 Old_Header_Text & "</span></span>";
2954 end if;
2955 end Header_Text;
2956 begin
2957 if not Output_Object.Is_Valid then
2958 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2959 "Not valid object");
2960 end if;
2961 if Output_Object.Is_In_Paragraph then
2962 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
2963 "Header in paragraph");
2964 end if;
2965
2966 if not Output_Object.Big_Files then
2967 if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
2968 End_HTML_File (Output_Object);
2969 end if;
2970
2971 Start_HTML_File (Output_Object,
2972 Make_Clause_File_Name (Output_Object, Clause_Number),
2973 New_Header_Text, Clause_Number);
2974 else -- Big Files:
2975 -- Insert an anchor:
2976 Ada.Text_IO.Put (Output_Object.Output_File, "<A NAME=""");
2977 Ada.Text_IO.Put (Output_Object.Output_File,
2978 Make_Clause_Anchor_Name (Output_Object, Clause_Number));
2979 Ada.Text_IO.Put_Line (Output_Object.Output_File, """></A>");
2980 end if;
2981
2982 case Level is
2983 when ARM_Contents.Plain_Annex =>
2984 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number &
2985 "<BR>"); -- Note: Clause_Number includes "Annex"
2986 Ada.Text_IO.Put_Line (Output_Object.Output_File, Header_Text & "</H1>");
2987 when ARM_Contents.Normative_Annex =>
2988 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
2989 -- Note: Clause_Number includes "Annex"
2990 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(normative)</H2>");
2991 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
2992 when ARM_Contents.Informative_Annex =>
2993 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
2994 -- Note: Clause_Number includes "Annex"
2995 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(informative)</H2>");
2996 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
2997 when ARM_Contents.Unnumbered_Section =>
2998 if Header_Text /= "" then
2999 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
3000 Header_Text & "</H1>");
3001 end if;
3002 when ARM_Contents.Section =>
3003 case Top_Level_Subdivision_Name is
3004 when ARM_Output.Chapter =>
3005 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Chapter " &
3006 Clause_Number & ": " & Header_Text & "</H1>");
3007 when ARM_Output.Section =>
3008 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Section " &
3009 Clause_Number & ": " & Header_Text & "</H1>");
3010 when ARM_Output.Clause =>
3011 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
3012 Clause_Number & " &nbsp; " & Header_Text & "</H1>");
3013 end case;
3014 when ARM_Contents.Clause | ARM_Contents.Subclause |
3015 ARM_Contents.Subsubclause =>
3016 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
3017 Clause_Number & ' ' & Header_Text & "</H1>");
3018 when ARM_Contents.Dead_Clause =>
3019 raise Program_Error; -- No headers for dead clauses.
3020 end case;
3021 Output_Object.Char_Count := 0;
3022 Output_Object.Disp_Char_Count := 0;
3023 Output_Object.Disp_Large_Char_Count := 0;
3024 Output_Object.Any_Nonspace := False;
3025 Output_Object.Last_Was_Space := True; -- Start of line.
3026 Output_Object.Conditional_Space := False; -- Don't need it here.
3027 -- No page breaks in HTML, so we don't need to look at No_Page_Break.
3028 end Revised_Clause_Header;
3029
3030
3031 procedure TOC_Marker (Output_Object : in out HTML_Output_Type;
3032 For_Start : in Boolean) is
3033 -- Mark the start (if For_Start is True) or end (if For_Start is
3034 -- False) of the table of contents data. Output objects that
3035 -- auto-generate the table of contents can use this to do needed
3036 -- actions.
3037 begin
3038 if not Output_Object.Is_Valid then
3039 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3040 "Not valid object");
3041 end if;
3042 null; -- We don't care about this.
3043 end TOC_Marker;
3044
3045
3046 procedure New_Page (Output_Object : in out HTML_Output_Type;
3047 Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page) is
3048 -- Output a page break.
3049 -- Note that this has no effect on non-printing formats.
3050 -- Any_Page breaks to the top of the next page (whatever it is);
3051 -- Odd_Page_Only breaks to the top of the odd-numbered page;
3052 -- Soft_Page allows a page break but does not force one (use in
3053 -- "No_Breaks" paragraphs.)
3054 -- Raises Not_Valid_Error if in a paragraph if Kind = Any_Page or
3055 -- Odd_Page, and if not in a paragraph if Kind = Soft_Page.
3056 begin
3057 if not Output_Object.Is_Valid then
3058 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3059 "Not valid object");
3060 end if;
3061 case Kind is
3062 when ARM_Output.Any_Page | ARM_Output.Odd_Page_Only =>
3063 if Output_Object.Is_In_Paragraph then
3064 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3065 "Page in paragraph");
3066 end if;
3067 -- No real page breaks supported.
3068 --Ada.Text_IO.Put_Line (Output_Object.Output_File, "<P><BR><BR></P>");
3069 --Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR>"); -- Horizontal line.
3070 --Ada.Text_IO.Put_Line (Output_Object.Output_File, "<P><BR></P>");
3071 -- This horizontal rule looks awful when inserted solely to
3072 -- make PDF formats look good; and it doesn't make much sense
3073 -- any other time, either. (Why would we want to start a page
3074 -- with this?) So it's been removed completely; and we have no
3075 -- other page breaks in HTML.
3076 when ARM_Output.Soft_Page =>
3077 if not Output_Object.Is_In_Paragraph then
3078 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3079 "Soft page not in paragraph");
3080 end if;
3081 null; -- No page breaks in HTML.
3082 end case;
3083 end New_Page;
3084
3085
3086 procedure Separator_Line (Output_Object : in out HTML_Output_Type;
3087 Is_Thin : Boolean := True) is
3088 -- Output a separator line. It is thin if "Is_Thin" is true.
3089 -- Raises Not_Valid_Error if in a paragraph.
3090 begin
3091 if not Output_Object.Is_Valid then
3092 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3093 "Not valid object");
3094 end if;
3095 if Output_Object.Is_In_Paragraph then
3096 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3097 "Separator in paragraph");
3098 end if;
3099 Ada.Text_IO.New_Line (Output_Object.Output_File);
3100 if Is_Thin then
3101 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR SIZE=1>"); -- Horizontal line.
3102 else
3103 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR SIZE=2>"); -- Horizontal line.
3104 end if;
3105 Ada.Text_IO.New_Line (Output_Object.Output_File);
3106 end Separator_Line;
3107
3108
3109 procedure Start_Table (Output_Object : in out HTML_Output_Type;
3110 Columns : in ARM_Output.Column_Count;
3111 First_Column_Width : in ARM_Output.Column_Count;
3112 Last_Column_Width : in ARM_Output.Column_Count;
3113 Alignment : in ARM_Output.Column_Text_Alignment;
3114 No_Page_Break : in Boolean;
3115 Has_Border : in Boolean;
3116 Small_Text_Size : in Boolean;
3117 Header_Kind : in ARM_Output.Header_Kind_Type) is
3118 -- Starts a table. The number of columns is Columns; the first
3119 -- column has First_Column_Width times the normal column width, and
3120 -- the last column has Last_Column_Width times the normal column width.
3121 -- Alignment is the horizontal text alignment within the columns.
3122 -- No_Page_Break should be True to keep the table intact on a single
3123 -- page; False to allow it to be split across pages.
3124 -- Has_Border should be true if a border is desired, false otherwise.
3125 -- Small_Text_Size means that the contents will have the AARM size;
3126 -- otherwise it will have the normal size.
3127 -- Header_Kind determines whether the table has headers.
3128 -- This command starts a paragraph; the entire table is a single
3129 -- paragraph. Text will be considered part of the caption until the
3130 -- next table marker call.
3131 -- Raises Not_Valid_Error if in a paragraph.
3132 use type ARM_Output.Header_Kind_Type;
3133 use type ARM_Output.Column_Text_Alignment;
3134 begin
3135 -- No_Page_Break, First_Column_Width, and Last_Column_Width not used,
3136 -- the latter two because column width is calculated based on the
3137 -- contents.
3138 if not Output_Object.Is_Valid then
3139 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3140 "Not valid object");
3141 end if;
3142 if Output_Object.Is_In_Paragraph then
3143 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3144 "Table in paragraph");
3145 end if;
3146
3147 if Output_Object.HTML_Kind /= HTML_3 then
3148 Ada.Text_IO.Put (Output_Object.Output_File, "<div class=""" &
3149 Paragraph_Name(ARM_Output.Normal, 1) & """>");
3150 Paragraph_Used(ARM_Output.Normal, 1) := True;
3151 end if;
3152 if Has_Border then
3153 Ada.Text_IO.Put (Output_Object.Output_File, "<TABLE frame=""border"" rules=""all"" border=""2"" cellpadding=""4"">");
3154 else
3155 Ada.Text_IO.Put (Output_Object.Output_File, "<TABLE frame=""void"" rules=""none"" border=""0"" cellpadding=""2"">");
3156 end if;
3157 if Header_Kind = ARM_Output.Both_Caption_and_Header then
3158 Ada.Text_IO.Put (Output_Object.Output_File, "<CAPTION>");
3159 Output_Object.Char_Count := 9;
3160 Output_Object.In_Header := True;
3161 elsif Header_Kind = ARM_Output.Header_Only then
3162 if Alignment = ARM_Output.Center_All then
3163 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""center"">");
3164 Output_Object.Char_Count := 24;
3165 else
3166 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""left"">");
3167 Output_Object.Char_Count := 22;
3168 end if;
3169 Output_Object.In_Header := True;
3170 else -- Header_Kind = ARM_Output.No_Headers then
3171 if Alignment = ARM_Output.Center_All then
3172 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""center"">");
3173 Output_Object.Char_Count := 24;
3174 else
3175 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
3176 Output_Object.Char_Count := 22;
3177 end if;
3178 Output_Object.In_Header := False;
3179 end if;
3180 Output_Object.Disp_Char_Count := 0;
3181 Output_Object.Disp_Large_Char_Count := 0;
3182 Output_Object.Any_Nonspace := False;
3183 Output_Object.Last_Was_Space := True; -- Start of line.
3184 Output_Object.Conditional_Space := False; -- Don't need it here.
3185
3186 Output_Object.Is_In_Paragraph := True;
3187 Output_Object.Is_In_Table := True;
3188
3189 Output_Object.Table_Column_Alignment := Alignment;
3190 Output_Object.Table_Has_Small_Text := Small_Text_Size;
3191 if Output_Object.Table_Has_Small_Text then
3192 if Output_Object.HTML_Kind = HTML_4_Only then
3193 Ada.Text_IO.Put (Output_Object.Output_File, "<SPAN STYLE=""font-size: 80%"">");
3194 Output_Object.Char_Count := Output_Object.Char_Count + 29;
3195 else
3196 Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=""-1"">");
3197 Output_Object.Char_Count := Output_Object.Char_Count + 16;
3198 end if;
3199 end if;
3200 end Start_Table;
3201
3202
3203 procedure Table_Marker (Output_Object : in out HTML_Output_Type;
3204 Marker : in ARM_Output.Table_Marker_Type) is
3205 -- Marks the end of an entity in a table.
3206 -- If Marker is End_Caption, the table caption ends and the
3207 -- future text is part of the table header.
3208 -- If Marker is End_Header, the table header ends and the
3209 -- future text is part of the table body.
3210 -- If Marker is End_Row, a row in the table is completed, and another
3211 -- row started.
3212 -- If Marker is End_Row_Next_Is_Last, a row in the table is completed,
3213 -- and another row started. That row is the last row in the table.
3214 -- If Marker is End_Item, an item in the table header or body is ended,
3215 -- and another started.
3216 -- If Marker is End_Table, the entire table is finished.
3217 -- Raises Not_Valid_Error if not in a table.
3218 use type ARM_Output.Column_Text_Alignment;
3219 begin
3220 if not Output_Object.Is_Valid then
3221 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3222 "Not valid object");
3223 end if;
3224 if (not Output_Object.Is_In_Paragraph) or (not Output_Object.Is_In_Table) then
3225 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3226 "Table marker not in table");
3227 end if;
3228
3229 -- Close the small fonts (we always need to do this):
3230 if Output_Object.Table_Has_Small_Text then
3231 if Output_Object.HTML_Kind = HTML_4_Only then
3232 Ada.Text_IO.Put (Output_Object.Output_File, "</SPAN>");
3233 Output_Object.Char_Count := Output_Object.Char_Count + 7;
3234 else
3235 Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
3236 Output_Object.Char_Count := Output_Object.Char_Count + 7;
3237 end if;
3238 end if;
3239
3240 case Marker is
3241 when ARM_Output.End_Item =>
3242 -- Note: This isn't the first item on a row.
3243 if Output_Object.In_Header then
3244 if Output_Object.Table_Column_Alignment = ARM_Output.Left_All then
3245 Ada.Text_IO.Put (Output_Object.Output_File, "<TH align=""left"">");
3246 Output_Object.Char_Count := Output_Object.Char_Count + 18;
3247 else
3248 Ada.Text_IO.Put (Output_Object.Output_File, "<TH align=""center"">");
3249 Output_Object.Char_Count := Output_Object.Char_Count + 20;
3250 end if;
3251 else
3252 if Output_Object.Table_Column_Alignment = ARM_Output.Left_All then
3253 Ada.Text_IO.Put (Output_Object.Output_File, "<TD align=""left"">");
3254 Output_Object.Char_Count := Output_Object.Char_Count + 18;
3255 else
3256 Ada.Text_IO.Put (Output_Object.Output_File, "<TD align=""center"">");
3257 Output_Object.Char_Count := Output_Object.Char_Count + 20;
3258 end if;
3259 end if;
3260 when ARM_Output.End_Caption =>
3261 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</CAPTION>");
3262 if Output_Object.Table_Column_Alignment = ARM_Output.Center_All then
3263 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""center"">");
3264 Output_Object.Char_Count := 24;
3265 else
3266 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""left"">");
3267 Output_Object.Char_Count := 22;
3268 end if;
3269 Output_Object.Disp_Char_Count := 0;
3270 Output_Object.Disp_Large_Char_Count := 0;
3271 Output_Object.Any_Nonspace := False;
3272 Output_Object.Last_Was_Space := True; -- Start of line.
3273 Output_Object.Conditional_Space := False; -- Don't need it here.
3274 when ARM_Output.End_Header =>
3275 Ada.Text_IO.New_Line (Output_Object.Output_File);
3276 if Output_Object.Table_Column_Alignment = ARM_Output.Center_All then
3277 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""center"">");
3278 Output_Object.Char_Count := 24;
3279 else
3280 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
3281 Output_Object.Char_Count := 22;
3282 end if;
3283 Output_Object.Disp_Char_Count := 0;
3284 Output_Object.Disp_Large_Char_Count := 0;
3285 Output_Object.Any_Nonspace := False;
3286 Output_Object.Last_Was_Space := True; -- Start of line.
3287 Output_Object.Conditional_Space := False; -- Don't need it here.
3288 Output_Object.In_Header := False;
3289 when ARM_Output.End_Row | ARM_Output.End_Row_Next_Is_Last =>
3290 Ada.Text_IO.New_Line (Output_Object.Output_File);
3291 if Output_Object.Table_Column_Alignment = ARM_Output.Center_All then
3292 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""center"">");
3293 Output_Object.Char_Count := 24;
3294 else
3295 Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
3296 Output_Object.Char_Count := 22;
3297 end if;
3298 Output_Object.Disp_Char_Count := 0;
3299 Output_Object.Disp_Large_Char_Count := 0;
3300 Output_Object.Any_Nonspace := False;
3301 Output_Object.Last_Was_Space := True; -- Start of line.
3302 Output_Object.Conditional_Space := False; -- Don't need it here.
3303 when ARM_Output.End_Table =>
3304 Ada.Text_IO.New_Line (Output_Object.Output_File);
3305 if Output_Object.HTML_Kind /= HTML_3 then
3306 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</table></div>");
3307 else
3308 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</TABLE>");
3309 end if;
3310 Output_Object.Is_In_Paragraph := False;
3311 Output_Object.Is_In_Table := False;
3312 end case;
3313
3314 if Output_Object.Table_Has_Small_Text and then ARM_Output."/=" (Marker,
3315 ARM_Output.End_Table) then
3316 if Output_Object.HTML_Kind = HTML_4_Only then
3317 Ada.Text_IO.Put (Output_Object.Output_File, "<SPAN STYLE=""font-size: 80%"">");
3318 Output_Object.Char_Count := Output_Object.Char_Count + 29;
3319 else
3320 Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=""-1"">");
3321 Output_Object.Char_Count := Output_Object.Char_Count + 16;
3322 end if;
3323 end if;
3324 end Table_Marker;
3325
3326
3327 -- Text output: These are only allowed after a Start_Paragraph and
3328 -- before any End_Paragraph. Raises Not_Valid_Error if not allowed.
3329
3330 Special_Set : constant Ada.Strings.Maps.Character_Set :=
3331 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (Ada.Strings.Maps.Character_Range'(Low => Character'Val(127), High => Character'Val(255))),
3332 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('<'),
3333 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('>'),
3334 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('"'),
3335 Ada.Strings.Maps.To_Set ('&')))));
3336
3337 No_Conditional_Set : constant Ada.Strings.Maps.Character_Set :=
3338 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (' '),
3339 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('.'),
3340 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (','),
3341 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (':'),
3342 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (';'),
3343 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('!'),
3344 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('('),
3345 Ada.Strings.Maps.To_Set (')'))))))));
3346
3347 Large_Char_Set : constant Ada.Strings.Maps.Character_Set :=
3348 Ada.Strings.Maps."or" (Ada.Strings.Maps.Constants.Upper_Set,
3349 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (Ada.Strings.Maps.Character_Range'(Low => '0', High => '9')),
3350 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('m'),
3351 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('w'),
3352 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('<'),
3353 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('>'),
3354 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('&'),
3355 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('%'),
3356 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('@'),
3357 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('$'),
3358 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('*'),
3359 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('+'),
3360 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('='),
3361 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('?'),
3362 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('/'),
3363 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('\'),
3364 Ada.Strings.Maps.To_Set ('#')))))))))))))))));
3365
3366
3367 procedure Output_Text (Output_Object : in out HTML_Output_Type;
3368 Text : in String) is
3369 -- Output the text to the current output place.
3370 begin
3371 if Output_Object.Column_Count >= 4 then
3372 if (Output_Object.Column_Text(Output_Object.Current_Column) = null) or else
3373 -- No items stored.
3374 (Output_Object.Column_Text(Output_Object.Current_Column).Item /=
3375 Output_Object.Current_Item) then
3376 -- Start a new item.
3377 Output_Object.Column_Text(Output_Object.Current_Column) :=
3378 new Column_Text_Item_Type'(Text => (others => ' '),
3379 Length => 0, Item => Output_Object.Current_Item,
3380 End_Para => False, Next => Output_Object.Column_Text(Output_Object.Current_Column));
3381 end if;
3382 if Output_Object.Column_Text(Output_Object.Current_Column).Length +
3383 Text'Length > Output_Object.Column_Text(Output_Object.Current_Column).Text'Length then
3384 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3385 "Column item full, but more text! - " &
3386 Output_Object.Column_Text(Output_Object.Current_Column).Text(1..Output_Object.Column_Text(Output_Object.Current_Column).Length) & Text);
3387 else
3388 Output_Object.Column_Text(Output_Object.Current_Column).Text(
3389 Output_Object.Column_Text(Output_Object.Current_Column).Length+1..
3390 Output_Object.Column_Text(Output_Object.Current_Column).Length+Text'Length) :=
3391 Text;
3392 Output_Object.Column_Text(Output_Object.Current_Column).Length :=
3393 Output_Object.Column_Text(Output_Object.Current_Column).Length + Text'Length;
3394 end if;
3395 else -- Normal, use Text_IO.
3396 Ada.Text_IO.Put (Output_Object.Output_File, Text);
3397 Output_Object.Char_Count := Output_Object.Char_Count + Text'Length;
3398 end if;
3399 end Output_Text;
3400
3401
3402 procedure Ordinary_Text (Output_Object : in out HTML_Output_Type;
3403 Text : in String) is
3404 -- Output ordinary text.
3405 -- The text must end at a word break, never in the middle of a word.
3406 begin
3407 if not Output_Object.Is_Valid then
3408 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3409 "Not valid object");
3410 end if;
3411 if not Output_Object.Is_In_Paragraph then
3412 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3413 "Not in paragraph");
3414 end if;
3415 if Text'Length = 0 then
3416 return; -- Nothing to do.
3417 end if;
3418 if Ada.Strings.Fixed.Count (Text, Special_Set) = 0 then
3419 if Output_Object.Char_Count + Text'Length >= LINE_LENGTH - 10 then
3420 -- We can only break on a space.
3421 for I in Text'range loop
3422 Ordinary_Character (Output_Object, Text(I));
3423 end loop;
3424 else
3425 if Output_Object.Conditional_Space then
3426 Output_Object.Conditional_Space := False;
3427 if Ada.Strings.Maps.Is_In (Text(Text'First), No_Conditional_Set) then
3428 null; -- Don't need the conditional space.
3429 else
3430 Output_Text (Output_Object, " ");
3431 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3432 --Output_Object.Disp_Large_Char_Count := <unchanged>;
3433 end if;
3434 end if;
3435 Output_Text (Output_Object, Text);
3436 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + Text'Length;
3437 Output_Object.Disp_Large_Char_Count :=
3438 Output_Object.Disp_Large_Char_Count +
3439 Ada.Strings.Fixed.Count (Text, Large_Char_Set);
3440 Output_Object.Any_Nonspace := True;
3441 Output_Object.Last_was_Space := Text(Text'Last) = ' ';
3442 end if;
3443 else
3444 for I in Text'range loop
3445 Ordinary_Character (Output_Object, Text(I));
3446 end loop;
3447 end if;
3448 end Ordinary_Text;
3449
3450
3451 procedure Ordinary_Character (Output_Object : in out HTML_Output_Type;
3452 Char : in Character) is
3453 -- Output an ordinary character.
3454 -- Spaces will be used to break lines as needed.
3455 begin
3456 if not Output_Object.Is_Valid then
3457 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3458 "Not valid object");
3459 end if;
3460 if not Output_Object.Is_In_Paragraph then
3461 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3462 "Not in paragraph");
3463 end if;
3464 if Output_Object.Conditional_Space then
3465 Output_Object.Conditional_Space := False;
3466 if Ada.Strings.Maps.Is_In (Char, No_Conditional_Set) then
3467 null; -- Don't need the conditional space.
3468 else
3469 Output_Text (Output_Object, " ");
3470 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3471 --Output_Object.Disp_Large_Char_Count := <unchanged>;
3472 end if;
3473 end if;
3474 Output_Object.Last_was_Space := False;
3475 if Char = ' ' then
3476 if Output_Object.Char_Count >= LINE_LENGTH - 10 and then
3477 Output_Object.Column_Count < 4 then
3478 if Output_Object.HTML_Kind > HTML_3 then
3479 -- Note: We leave the space here so that later code can tell
3480 -- the difference between a line broken on a space, and a
3481 -- line broken for because it's convinient.
3482 Ada.Text_IO.Put_Line (Output_Object.Output_File, " ");
3483 else -- No later code.
3484 Ada.Text_IO.New_Line (Output_Object.Output_File);
3485 end if;
3486 Output_Object.Char_Count := 0;
3487 Output_Object.Last_was_Space := True;
3488 else
3489 Output_Text (Output_Object, " ");
3490 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3491 --Output_Object.Disp_Large_Char_Count := <unchanged>;
3492 end if;
3493 -- Output_Object.Any_Nonspace := <unchanged>;
3494 Output_Object.Last_was_Space := True;
3495 elsif Char = '<' then
3496 Output_Text (Output_Object, "&lt;");
3497 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3498 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3499 Output_Object.Any_Nonspace := True;
3500 elsif Char = '>' then
3501 Output_Text (Output_Object, "&gt;");
3502 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3503 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3504 Output_Object.Any_Nonspace := True;
3505 elsif Char = '"' then
3506 Output_Text (Output_Object, "&quot;");
3507 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3508 -- No change in Disp_Large_Char_Count.
3509 Output_Object.Any_Nonspace := True;
3510 elsif Char = '&' then
3511 Output_Text (Output_Object, "&amp;");
3512 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3513 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3514 Output_Object.Any_Nonspace := True;
3515 elsif Char >= Character'Val(126) then -- All higher Latin-1 characters.
3516 case Character'Pos(Char) is
3517 when 160 =>
3518 Output_Text (Output_Object, "&nbsp;");
3519 when 161 =>
3520 Output_Text (Output_Object, "&iexcl;");
3521 when 162 =>
3522 Output_Text (Output_Object, "&cent;");
3523 when 163 =>
3524 Output_Text (Output_Object, "&pound;");
3525 when 164 =>
3526 Output_Text (Output_Object, "&curren;");
3527 when 165 =>
3528 Output_Text (Output_Object, "&yen;");
3529 when 166 =>
3530 Output_Text (Output_Object, "&brvbar;");
3531 when 167 =>
3532 Output_Text (Output_Object, "&sect;");
3533 when 168 =>
3534 Output_Text (Output_Object, "&uml;");
3535 when 169 =>
3536 Output_Text (Output_Object, "&copy;");
3537 when 170 =>
3538 Output_Text (Output_Object, "&ordf;");
3539 when 171 =>
3540 Output_Text (Output_Object, "&laquo;");
3541 when 172 =>
3542 Output_Text (Output_Object, "&not;");
3543 when 173 =>
3544 Output_Text (Output_Object, "&shy;");
3545 when 174 =>
3546 Output_Text (Output_Object, "&reg;");
3547 when 175 =>
3548 Output_Text (Output_Object, "&macr;");
3549 when 176 =>
3550 Output_Text (Output_Object, "&deg;");
3551 when 177 =>
3552 Output_Text (Output_Object, "&plusmn;");
3553 when 178 =>
3554 Output_Text (Output_Object, "&sup2;");
3555 when 179 =>
3556 Output_Text (Output_Object, "&sup3;");
3557 when 180 =>
3558 Output_Text (Output_Object, "&acute;");
3559 when 181 =>
3560 Output_Text (Output_Object, "&micro;");
3561 when 182 =>
3562 Output_Text (Output_Object, "&para;");
3563 when 183 =>
3564 Output_Text (Output_Object, "&middot;");
3565 when 184 =>
3566 Output_Text (Output_Object, "&cedil;");
3567 when 185 =>
3568 Output_Text (Output_Object, "&sup1;");
3569 when 186 =>
3570 Output_Text (Output_Object, "&ordm;");
3571 when 187 =>
3572 Output_Text (Output_Object, "&raquo;");
3573 when 188 =>
3574 Output_Text (Output_Object, "&frac14;");
3575 when 189 =>
3576 Output_Text (Output_Object, "&frac12;");
3577 when 190 =>
3578 Output_Text (Output_Object, "&frac34;");
3579 when 191 =>
3580 Output_Text (Output_Object, "&iquest;");
3581 when 192 =>
3582 Output_Text (Output_Object, "&Agrave;");
3583 when 193 =>
3584 Output_Text (Output_Object, "&Aacute;");
3585 when 194 =>
3586 Output_Text (Output_Object, "&Acirc;");
3587 when 195 =>
3588 Output_Text (Output_Object, "&Atilde;");
3589 when 196 =>
3590 Output_Text (Output_Object, "&Auml;");
3591 when 197 =>
3592 Output_Text (Output_Object, "&Aring;");
3593 when 198 =>
3594 Output_Text (Output_Object, "&AElig;");
3595 when 199 =>
3596 Output_Text (Output_Object, "&Ccedil;");
3597 when 200 =>
3598 Output_Text (Output_Object, "&Egrave;");
3599 when 201 =>
3600 Output_Text (Output_Object, "&Eacute;");
3601 when 202 =>
3602 Output_Text (Output_Object, "&Ecirc;");
3603 when 203 =>
3604 Output_Text (Output_Object, "&Euml;");
3605 when 204 =>
3606 Output_Text (Output_Object, "&Igrave;");
3607 when 205 =>
3608 Output_Text (Output_Object, "&Iacute;");
3609 when 206 =>
3610 Output_Text (Output_Object, "&Icirc;");
3611 when 207 =>
3612 Output_Text (Output_Object, "&Iuml;");
3613 when 208 =>
3614 Output_Text (Output_Object, "&ETH;");
3615 when 209 =>
3616 Output_Text (Output_Object, "&Ntilde;");
3617 when 210 =>
3618 Output_Text (Output_Object, "&Ograve;");
3619 when 211 =>
3620 Output_Text (Output_Object, "&Oacute;");
3621 when 212 =>
3622 Output_Text (Output_Object, "&Ocirc;");
3623 when 213 =>
3624 Output_Text (Output_Object, "&Otilde;");
3625 when 214 =>
3626 Output_Text (Output_Object, "&Ouml;");
3627 when 215 =>
3628 Output_Text (Output_Object, "&times;");
3629 when 216 =>
3630 Output_Text (Output_Object, "&Oslash;");
3631 when 217 =>
3632 Output_Text (Output_Object, "&Ugrave;");
3633 when 218 =>
3634 Output_Text (Output_Object, "&Uacute;");
3635 when 219 =>
3636 Output_Text (Output_Object, "&Ucirc;");
3637 when 220 =>
3638 Output_Text (Output_Object, "&Uuml;");
3639 when 221 =>
3640 Output_Text (Output_Object, "&Yacute;");
3641 when 222 =>
3642 Output_Text (Output_Object, "&THORN;");
3643 when 223 =>
3644 Output_Text (Output_Object, "&szlig;");
3645
3646 when 224 =>
3647 Output_Text (Output_Object, "&agrave;");
3648 when 225 =>
3649 Output_Text (Output_Object, "&aacute;");
3650 when 226 =>
3651 Output_Text (Output_Object, "&acirc;");
3652 when 227 =>
3653 Output_Text (Output_Object, "&atilde;");
3654 when 228 =>
3655 Output_Text (Output_Object, "&auml;");
3656 when 229 =>
3657 Output_Text (Output_Object, "&aring;");
3658 when 230 =>
3659 Output_Text (Output_Object, "&aelig;");
3660 when 231 =>
3661 Output_Text (Output_Object, "&ccedil;");
3662 when 232 =>
3663 Output_Text (Output_Object, "&egrave;");
3664 when 233 =>
3665 Output_Text (Output_Object, "&eacute;");
3666 when 234 =>
3667 Output_Text (Output_Object, "&ecirc;");
3668 when 235 =>
3669 Output_Text (Output_Object, "&euml;");
3670 when 236 =>
3671 Output_Text (Output_Object, "&igrave;");
3672 when 237 =>
3673 Output_Text (Output_Object, "&iacute;");
3674 when 238 =>
3675 Output_Text (Output_Object, "&icirc;");
3676 when 239 =>
3677 Output_Text (Output_Object, "&iuml;");
3678 when 240 =>
3679 Output_Text (Output_Object, "&eth;");
3680 when 241 =>
3681 Output_Text (Output_Object, "&ntilde;");
3682 when 242 =>
3683 Output_Text (Output_Object, "&ograve;");
3684 when 243 =>
3685 Output_Text (Output_Object, "&oacute;");
3686 when 244 =>
3687 Output_Text (Output_Object, "&ocirc;");
3688 when 245 =>
3689 Output_Text (Output_Object, "&otilde;");
3690 when 246 =>
3691 Output_Text (Output_Object, "&ouml;");
3692 when 247 =>
3693 Output_Text (Output_Object, "&divide;");
3694 when 248 =>
3695 Output_Text (Output_Object, "&oslash;");
3696 when 249 =>
3697 Output_Text (Output_Object, "&ugrave;");
3698 when 250 =>
3699 Output_Text (Output_Object, "&uacute;");
3700 when 251 =>
3701 Output_Text (Output_Object, "&ucirc;");
3702 when 252 =>
3703 Output_Text (Output_Object, "&uuml;");
3704 when 253 =>
3705 Output_Text (Output_Object, "&yacute;");
3706 when 254 =>
3707 Output_Text (Output_Object, "&thorn;");
3708 when 255 =>
3709 Output_Text (Output_Object, "&yuml;");
3710
3711
3712 when others =>
3713 declare
3714 Code : constant String :=
3715 Natural'Image(Character'Pos(Char));
3716 begin
3717 Output_Text (Output_Object, "&#" & Code(2..4) & ';');
3718 end;
3719 end case;
3720 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3721 if Ada.Strings.Maps.Is_In (Char, Large_Char_Set) then
3722 Output_Object.Disp_Large_Char_Count :=
3723 Output_Object.Disp_Large_Char_Count + 1;
3724 -- else not a large character.
3725 end if;
3726 Output_Object.Any_Nonspace := True;
3727 else
3728 Output_Text (Output_Object, Char & "");
3729 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3730 if Ada.Strings.Maps.Is_In (Char, Large_Char_Set) then
3731 Output_Object.Disp_Large_Char_Count :=
3732 Output_Object.Disp_Large_Char_Count + 1;
3733 -- else not a large character.
3734 end if;
3735 Output_Object.Any_Nonspace := True;
3736 end if;
3737 end Ordinary_Character;
3738
3739
3740 procedure Hard_Space (Output_Object : in out HTML_Output_Type) is
3741 -- Output a hard space. No line break should happen at a hard space.
3742 begin
3743 if not Output_Object.Is_Valid then
3744 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3745 "Not valid object");
3746 end if;
3747 if not Output_Object.Is_In_Paragraph then
3748 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3749 "Not in paragraph");
3750 end if;
3751 Output_Text (Output_Object, "&nbsp;");
3752 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3753 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3754 -- Output_Object.Any_Nonspace := <unchanged>;
3755 Output_Object.Last_was_Space := True;
3756 Output_Object.Conditional_Space := False; -- Never need a conditional space here.
3757 end Hard_Space;
3758
3759
3760 procedure Line_Break (Output_Object : in out HTML_Output_Type) is
3761 -- Output a line break. This does not start a new paragraph.
3762 -- This corresponds to a "<BR>" in HTML.
3763 begin
3764 if not Output_Object.Is_Valid then
3765 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3766 "Not valid object");
3767 end if;
3768 if not Output_Object.Is_In_Paragraph then
3769 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3770 "Not in paragraph");
3771 end if;
3772 if Output_Object.Column_Count >= 4 then
3773 -- Output is deferred; mark the end of an item.
3774 if Output_Object.Column_Text (Output_Object.Current_Column) /= null and then
3775 Output_Object.Column_Text (Output_Object.Current_Column).Item = Output_Object.Current_Item then
3776 Output_Object.Column_Text (Output_Object.Current_Column).End_Para := False;
3777 end if;
3778 Output_Object.Current_Item := Output_Object.Current_Item + 1;
3779 Output_Object.Char_Count := 0;
3780 Output_Object.Disp_Char_Count := 0;
3781 Output_Object.Disp_Large_Char_Count := 0;
3782 Output_Object.Any_Nonspace := False;
3783 Output_Object.Last_Was_Space := True; -- Start of line.
3784 Output_Object.Conditional_Space := False; -- Don't need it here.
3785 else -- Normal.
3786 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<BR>");
3787 Output_Object.Char_Count := 0;
3788 Output_Object.Disp_Char_Count := 0;
3789 Output_Object.Disp_Large_Char_Count := 0;
3790 Output_Object.Any_Nonspace := False;
3791 Output_Object.Last_Was_Space := True; -- Start of line.
3792 Output_Object.Conditional_Space := False; -- Don't need it here.
3793 end if;
3794 end Line_Break;
3795
3796
3797 procedure Index_Line_Break (Output_Object : in out HTML_Output_Type;
3798 Clear_Keep_with_Next : in Boolean) is
3799 -- Output a line break for the index. This does not start a new
3800 -- paragraph in terms of spacing. This corresponds to a "<BR>"
3801 -- in HTML. If Clear_Keep_with_Next is true, insure that the next
3802 -- line does not require the following line to stay with it.
3803 -- Raises Not_Valid_Error if the paragraph is not in the index format.
3804 begin
3805 if ARM_Output."/=" (Output_Object.Paragraph_Style, ARM_Output.Index) then
3806 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3807 "Not index format");
3808 end if;
3809 Line_Break (Output_Object);
3810 end Index_Line_Break;
3811
3812
3813 procedure Soft_Line_Break (Output_Object : in out HTML_Output_Type) is
3814 -- Output a soft line break. This is a place (in the middle of a
3815 -- "word") that we allow a line break. It is usually used after
3816 -- underscores in long non-terminals.
3817 begin
3818 if not Output_Object.Is_Valid then
3819 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3820 "Not valid object");
3821 end if;
3822 if not Output_Object.Is_In_Paragraph then
3823 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3824 "Not in paragraph");
3825 end if;
3826 if Output_Object.HTML_Kind > HTML_3 and then Output_Object.Use_Unicode then
3827 Output_Text (Output_Object, "&#8203;");
3828 -- else no Soft break in HTML 3.2.
3829 end if;
3830 end Soft_Line_Break;
3831
3832
3833 procedure Soft_Hyphen_Break (Output_Object : in out HTML_Output_Type) is
3834 -- Output a soft line break, with a hyphen. This is a place (in the middle of
3835 -- a "word") that we allow a line break. If the line break is used,
3836 -- a hyphen will be added to the text.
3837 begin
3838 if not Output_Object.Is_Valid then
3839 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3840 "Not valid object");
3841 end if;
3842 if not Output_Object.Is_In_Paragraph then
3843 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3844 "Not in paragraph");
3845 end if;
3846 null; -- Soft hyphens exist, but don't work on either Internet Exploder 4
3847 -- or Netcrash 3. That is, they are always displayed. (They should
3848 -- only be displayed at the location of a line break).
3849 --Output_Text (Output_Object, "&shy;"); -- A Latin-1 char.
3850 end Soft_Hyphen_Break;
3851
3852
3853 procedure Tab (Output_Object : in out HTML_Output_Type) is
3854 -- Output a tab, inserting space up to the next tab stop.
3855 -- Raises Not_Valid_Error if the paragraph was created with
3856 -- Tab_Stops = ARM_Output.NO_TABS.
3857 begin
3858 -- HTML does not have tabs. Emulation is not successful on proportional
3859 -- fonts, so we let the user select how to do it.
3860 if not Output_Object.Is_Valid then
3861 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3862 "Not valid object");
3863 end if;
3864 if not Output_Object.Is_In_Paragraph then
3865 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3866 "Not in paragraph");
3867 end if;
3868 if ARM_Output."="(Output_Object.Tab_Stops, ARM_Output.NO_TABS) then
3869 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3870 "Tab, but none set");
3871 end if;
3872
3873 Output_Object.Conditional_Space := False; -- Never need a conditional space here.
3874 Output_Object.Last_was_Space := True; -- Treat this as a space.
3875 if Output_Object.Tab_Emulation = Single_Space then
3876 -- Don't emulate these, just use a single space.
3877 Output_Text (Output_Object, "&nbsp;");
3878 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3879 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3880 elsif Output_Object.Tab_Emulation = Quad_Space then
3881 -- Don't emulate these, just use a single space.
3882 Output_Text (Output_Object, "&nbsp;&nbsp;&nbsp;&nbsp;");
3883 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 4;
3884 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3885 elsif Output_Object.Tab_Emulation = Emulate_Fixed_Only or else
3886 Output_Object.Tab_Emulation = Emulate_Fixed_Only_Quad then
3887 if Output_Object.Can_Emulate_Tabs or else
3888 (not Output_Object.Any_Nonspace) then -- Always can emulate if they're first on a line.
3889 Output_Text (Output_Object, "&nbsp;");
3890 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3891 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3892 for I in 1 .. Output_Object.Tab_Stops.Number loop
3893 if Output_Object.Tab_Stops.Stops(I).Stop >= Output_Object.Disp_Char_Count then
3894 for J in Output_Object.Disp_Char_Count+1 .. Output_Object.Tab_Stops.Stops(I).Stop loop
3895 Output_Text (Output_Object, "&nbsp;");
3896 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3897 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3898 end loop;
3899 exit;
3900 end if;
3901 end loop; -- If we drop out without finding a tab, we just use the single
3902 -- space already written.
3903 elsif Output_Object.Tab_Emulation = Emulate_Fixed_Only then
3904 -- Put in a space.
3905 Output_Text (Output_Object, "&nbsp;");
3906 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3907 if ARM_Output."=" (Output_Object.Paragraph_Style, ARM_Output.Syntax_Summary) and then
3908 Output_Object.Column_Count > 1 then
3909 -- Special case (hack!) to make Syntax cross-reference look better:
3910 Output_Text (Output_Object, "&nbsp;&nbsp;");
3911 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
3912 end if;
3913 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3914 elsif Output_Object.Tab_Emulation = Emulate_Fixed_Only_Quad then
3915 -- Put in four hard spaces.
3916 Output_Text (Output_Object, "&nbsp;&nbsp;&nbsp;&nbsp;");
3917 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 4;
3918 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3919 end if;
3920 else -- Emulate all.
3921 Output_Text (Output_Object, "&nbsp;");
3922 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3923 for I in 1 .. Output_Object.Tab_Stops.Number loop
3924 if Output_Object.Tab_Stops.Stops(I).Stop >= Output_Object.Disp_Char_Count then
3925 for J in Output_Object.Disp_Char_Count+1 .. Output_Object.Tab_Stops.Stops(I).Stop loop
3926 Output_Text (Output_Object, "&nbsp;");
3927 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3928 end loop;
3929 exit;
3930 end if;
3931 end loop; -- If we drop out without finding a tab, we just use the
3932 -- single space already written.
3933 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3934 end if;
3935 end Tab;
3936
3937
3938 procedure Special_Character (Output_Object : in out HTML_Output_Type;
3939 Char : in ARM_Output.Special_Character_Type) is
3940 -- Output an special character.
3941 begin
3942 if not Output_Object.Is_Valid then
3943 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3944 "Not valid object");
3945 end if;
3946 if not Output_Object.Is_In_Paragraph then
3947 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
3948 "Not in paragraph");
3949 end if;
3950 if Output_Object.Conditional_Space then
3951 Output_Object.Conditional_Space := False;
3952 Output_Text (Output_Object, " ");
3953 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3954 -- Output_Object.Disp_Large_Char_Count := <unchanged>;
3955 end if;
3956 case Char is
3957 when ARM_Output.EM_Dash =>
3958 if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
3959 Output_Text (Output_Object, "&mdash;");
3960 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3961 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3962 else
3963 Output_Text (Output_Object, "--");
3964 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
3965 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
3966 end if;
3967 when ARM_Output.EN_Dash =>
3968 if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
3969 Output_Text (Output_Object, "&ndash;");
3970 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3971 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3972 else
3973 Output_Text (Output_Object, "-");
3974 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3975 --Output_Object.Disp_Large_Char_Count := <unchanged>;
3976 end if;
3977 when ARM_Output.GEQ =>
3978 if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
3979 Output_Text (Output_Object, "&ge;");
3980 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3981 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3982 else
3983 Output_Text (Output_Object, ">=");
3984 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
3985 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
3986 end if;
3987 when ARM_Output.LEQ =>
3988 if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
3989 Output_Text (Output_Object, "&le;");
3990 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
3991 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
3992 else
3993 Output_Text (Output_Object, "<=");
3994 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
3995 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
3996 end if;
3997 when ARM_Output.NEQ =>
3998 if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
3999 Output_Text (Output_Object, "&ne;");
4000 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4001 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4002 else
4003 Output_Text (Output_Object, "/=");
4004 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
4005 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
4006 end if;
4007 when ARM_Output.PI =>
4008 if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
4009 Output_Text (Output_Object, "&pi;");
4010 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4011 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4012 else
4013 Output_Text (Output_Object, "PI");
4014 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
4015 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
4016 end if;
4017 when ARM_Output.Left_Ceiling =>
4018 if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
4019 -- This character doesn't display on US Windows 2000/XP.
4020 Output_Text (Output_Object, "&lceil;");
4021 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4022 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4023 else
4024 Output_Text (Output_Object, "<I>Ceiling</I>(");
4025 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 8;
4026 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4027 end if;
4028 when ARM_Output.Right_Ceiling =>
4029 if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
4030 -- This character doesn't display on US Windows 2000/XP.
4031 Output_Text (Output_Object, "&rceil;");
4032 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4033 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4034 else
4035 Output_Text (Output_Object, ")");
4036 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4037 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4038 end if;
4039 when ARM_Output.Left_Floor =>
4040 if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
4041 -- This character doesn't display on US Windows 2000/XP.
4042 Output_Text (Output_Object, "&lfloor;");
4043 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4044 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4045 else
4046 Output_Text (Output_Object, "<I>Floor</I>(");
4047 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 6;
4048 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4049 end if;
4050 when ARM_Output.Right_Floor =>
4051 if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
4052 -- This character doesn't display on US Windows 2000/XP.
4053 Output_Text (Output_Object, "&rfloor;");
4054 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4055 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4056 else
4057 Output_Text (Output_Object, ")");
4058 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4059 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4060 end if;
4061 when ARM_Output.Thin_Space =>
4062 if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
4063 -- This character doesn't display on US Windows 2000/XP.
4064 Output_Text (Output_Object, "&thinsp;");
4065 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4066 else
4067 Output_Text (Output_Object, " ");
4068 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4069 end if;
4070 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4071 when ARM_Output.Left_Quote =>
4072 if Output_Object.HTML_Kind > HTML_3 then
4073 Output_Text (Output_Object, "&lsquo;");
4074 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4075 else
4076 Output_Text (Output_Object, "`");
4077 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4078 end if;
4079 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4080 when ARM_Output.Right_Quote =>
4081 if Output_Object.HTML_Kind > HTML_3 then
4082 Output_Text (Output_Object, "&rsquo;");
4083 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4084 else
4085 Output_Text (Output_Object, "'");
4086 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4087 end if;
4088 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4089 when ARM_Output.Left_Double_Quote =>
4090 if Output_Object.HTML_Kind > HTML_3 then
4091 Output_Text (Output_Object, "&ldquo;");
4092 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4093 else
4094 Output_Text (Output_Object, """");
4095 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4096 end if;
4097 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4098 when ARM_Output.Right_Double_Quote =>
4099 if Output_Object.HTML_Kind > HTML_3 then
4100 Output_Text (Output_Object, "&rdquo;");
4101 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4102 else
4103 Output_Text (Output_Object, """");
4104 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4105 end if;
4106 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4107 when ARM_Output.Small_Dotless_I =>
4108 if Output_Object.HTML_Kind > HTML_3 then --and Output_Object.Use_Unicode then -- We'll use it if it might be supported.
4109 Output_Text (Output_Object, "&#0305;");
4110 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4111 else
4112 Output_Text (Output_Object, "i");
4113 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4114 end if;
4115 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4116 when ARM_Output.Capital_Dotted_I =>
4117 if Output_Object.HTML_Kind > HTML_3 then --and Output_Object.Use_Unicode then -- We'll use it if it might be supported.
4118 Output_Text (Output_Object, "&#0304;");
4119 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4120 else
4121 Output_Text (Output_Object, "I");
4122 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4123 end if;
4124 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
4125 end case;
4126 Output_Object.Any_Nonspace := True;
4127 Output_Object.Last_was_Space := False;
4128 end Special_Character;
4129
4130
4131 procedure Unicode_Character (Output_Object : in out HTML_Output_Type;
4132 Char : in ARM_Output.Unicode_Type) is
4133 -- Output a Unicode character, with code position Char.
4134 Char_Code : constant String := ARM_Output.Unicode_Type'Image(Char);
4135 begin
4136 if not Output_Object.Is_Valid then
4137 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4138 "Not valid object");
4139 end if;
4140 if not Output_Object.Is_In_Paragraph then
4141 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4142 "Not in paragraph");
4143 end if;
4144 if Output_Object.HTML_Kind = HTML_3 then
4145 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4146 "Unicode not available for HTML 3");
4147 end if;
4148 if Output_Object.Conditional_Space then
4149 Output_Object.Conditional_Space := False;
4150 Output_Text (Output_Object, " ");
4151 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4152 --Output_Object.Disp_Large_Char_Count := <unchanged>;
4153 end if;
4154 -- We don't check if this is valid, we just use it. So be sparing!
4155 Output_Text (Output_Object, "&#" & Char_Code(2..Char_Code'Length) & ';');
4156 Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
4157 Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1; -- Assume it is large.
4158 Output_Object.Any_Nonspace := True;
4159 Output_Object.Last_was_Space := False;
4160 end Unicode_Character;
4161
4162
4163 procedure End_Hang_Item (Output_Object : in out HTML_Output_Type) is
4164 -- Marks the end of a hanging item. Call only once per paragraph.
4165 -- Raises Not_Valid_Error if the paragraph style is not in
4166 -- Text_Prefixed_Style_Subtype, or if this has already been
4167 -- called for the current paragraph, or if the paragraph was started
4168 -- with No_Prefix = True.
4169 begin
4170 --Ada.Text_IO.Put_Line("HTML: End_Hang");
4171 if not Output_Object.Is_Valid then
4172 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4173 "Not valid object");
4174 end if;
4175 if not Output_Object.Is_In_Paragraph then
4176 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4177 "Not in paragraph");
4178 end if;
4179 if Output_Object.Paragraph_Style not in
4180 ARM_Output.Text_Prefixed_Style_Subtype then
4181 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4182 "Not a hanging paragraph - " & ARM_Output.Paragraph_Style_Type'Image(Output_Object.Paragraph_Style));
4183 end if;
4184 if Output_Object.Saw_Hang_End then
4185 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4186 "Already saw the end of the hanging part");
4187 end if;
4188 Output_Object.Saw_Hang_End := True;
4189 if Output_Object.HTML_Kind = HTML_3 then
4190 case Output_Object.Paragraph_Style is
4191 -- Part of a definition list.
4192 when ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
4193 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
4194 ARM_Output.Small_Hanging_in_Bulleted |
4195 ARM_Output.Small_Enumerated =>
4196 Ada.Text_IO.Put_Line (Output_Object.Output_File, "</FONT><DD><FONT SIZE=-1>");
4197 when others =>
4198 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<DD>");
4199 end case;
4200 elsif Output_Object.HTML_Kind = HTML_4_Only then
4201 declare
4202 Saved_Format : ARM_Output.Format_Type;
4203 begin
4204 -- Save original format:
4205 Saved_Format :=
4206 (Bold => Output_Object.Is_Bold,
4207 Italic => Output_Object.Is_Italic,
4208 Font => Output_Object.Font,
4209 Size => Output_Object.Size,
4210 Color => Output_Object.Color,
4211 Change => Output_Object.Change,
4212 Version => Output_Object.Version,
4213 Added_Version => Output_Object.Added_Version,
4214 Location => Output_Object.Location);
4215
4216 -- Close any open formatting (can't leave it open across a DIV):
4217 Text_Format (Output_Object,
4218 Format => (Bold => False,
4219 Italic => False,
4220 Font => ARM_Output.Default,
4221 Size => 0,
4222 Color => ARM_Output.Default,
4223 Change => ARM_Output.None,
4224 Version => '0',
4225 Added_Version => '0',
4226 Location => ARM_Output.Normal));
4227 -- This has to be a hanging style, so we ignore other cases:
4228 Ada.Text_IO.Put (Output_Object.Output_File, "</div><div class=""" &
4229 Paragraph_Name (Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent) & "-Body"">");
4230 -- If the prefix is too long, add a <BR>. A "unit" is 2.0 ems;
4231 -- a large character is 0.65 ems; and a small character is 0.4 ems.
4232 -- That should be quite conservative.
4233 --Ada.Text_IO.Put_Line("Break hang check: large chars=" & Natural'Image(Output_Object.Disp_Large_Char_Count) &
4234 --" small chars=" & Natural'Image(Output_Object.Disp_Char_Count - Output_Object.Disp_Large_Char_Count) &
4235 --" Hang_Outdent=" & Natural'Image(Paragraph_Info(Output_Object.Paragraph_Format).Hang_Outdent));
4236 if (Output_Object.Disp_Large_Char_Count*13) +
4237 ((Output_Object.Disp_Char_Count-Output_Object.Disp_Large_Char_Count)*8) >
4238 Paragraph_Info(Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent).Hang_Outdent*40 then
4239 Ada.Text_IO.Put_Line (Output_Object.Output_File, "<br clear=""left"">");
4240 -- We use "clear=left" so that the next line always
4241 -- starts at the left margin. This shouldn't be necessary,
4242 -- but I've seen cases where it was.
4243 else
4244 Ada.Text_IO.New_Line (Output_Object.Output_File);
4245 end if;
4246 -- Reopen any formatting (using the previously saved values):
4247 Text_Format (Output_Object, Format => Saved_Format);
4248 end;
4249 else -- HTML 4 Compatibility
4250 -- We have to close and reopen the font info here, so that we
4251 -- properly nest these operations to pass the WC3 validator.
4252 Put_End_Compatibility_Font_Info (Output_Object,
4253 Output_Object.Paragraph_Style,
4254 Output_Object.Paragraph_Indent);
4255 -- This has to be a hanging style, so we ignore other cases:
4256 Ada.Text_IO.Put (Output_Object.Output_File, "<dd class=""" &
4257 Paragraph_Name (Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent) & """>");
4258 Put_Compatibility_Font_Info (Output_Object,
4259 Output_Object.Paragraph_Style,
4260 Output_Object.Paragraph_Indent);
4261 end if;
4262 Paragraph_Used(Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent) := True;
4263 Output_Object.Char_Count := 0;
4264 Output_Object.Disp_Char_Count := 0;
4265 Output_Object.Disp_Large_Char_Count := 0;
4266 Output_Object.Any_Nonspace := False;
4267 Output_Object.Last_Was_Space := True; -- Start of line.
4268 Output_Object.Conditional_Space := False; -- Don't need it here.
4269 end End_Hang_Item;
4270
4271
4272 procedure New_Column (Output_Object : in out HTML_Output_Type) is
4273 -- Output a column break.
4274 -- Raises Not_Valid_Error if in a paragraph, or if the number of
4275 -- columns is 1.
4276 begin
4277 if not Output_Object.Is_Valid then
4278 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4279 "Not valid object");
4280 end if;
4281 if Output_Object.Is_In_Paragraph then
4282 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4283 "New Column in paragraph");
4284 end if;
4285 if Output_Object.Column_Count <= 1 then
4286 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4287 "Not in a multi-column area");
4288 end if;
4289 if Output_Object.Column_Count >= 4 then
4290 Output_Object.Current_Column := Output_Object.Current_Column + 1;
4291 Output_Object.Current_Item := 1;
4292 -- else ignore it, no columns will be used.
4293 end if;
4294 end New_Column;
4295
4296
4297 procedure Text_Format (Output_Object : in out HTML_Output_Type;
4298 Format : in ARM_Output.Format_Type) is
4299 -- Change the text format so that all of the properties are as specified.
4300 -- Note: Changes to these properties ought be stack-like; that is,
4301 -- Bold on, Italic on, Italic off, Bold off is OK; Bold on, Italic on,
4302 -- Bold off, Italic off should be avoided (as separate commands).
4303 use type ARM_Output.Change_Type;
4304 use type ARM_Output.Location_Type;
4305 use type ARM_Output.Size_Type;
4306 use type ARM_Output.Color_Type;
4307
4308 function Change_Needs_Close_or_Open return Boolean is
4309 -- Returns True if "Change" needs to open or close something, based
4310 -- on the current values of Output_Object.
4311 begin
4312 return (Format.Change /= Output_Object.Change or else
4313 Format.Version /= Output_Object.Version or else
4314 Format.Added_Version /= Output_Object.Added_Version);
4315 end Change_Needs_Close_or_Open;
4316
4317 function Font_Needs_Close_or_Open return Boolean is
4318 -- Returns True if "Font" needs to close something, based
4319 -- on the current values of Output_Object and the new value.
4320 -- Note that this depends on whether the Change needs to open
4321 -- or close something; if it does, we need to close and reopen
4322 -- the font even if it is not changing.
4323 begin
4324 return (ARM_Output."/=" (Format.Font, Output_Object.Font) or else
4325 Change_Needs_Close_or_Open);
4326 end Font_Needs_Close_or_Open;
4327
4328 function Location_Needs_Close_or_Open return Boolean is
4329 -- Returns True if "Location" needs to close something, based
4330 -- on the current values of Output_Object and the new value.
4331 -- Note that this depends on whether the Change or Font needs
4332 -- to open or close something; if they do, we need to close and
4333 -- reopen the location even if it is not changing.
4334 begin
4335 return Format.Location /= Output_Object.Location or else
4336 Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open;
4337 end Location_Needs_Close_or_Open;
4338
4339 function Color_Needs_Close_or_Open return Boolean is
4340 -- Returns True if "Color" needs to close something, based
4341 -- on the current values of Output_Object, and the new value.
4342 -- Note that this depends on whether the Change, Font,
4343 -- or Location needs to open or close something; if they do,
4344 -- we need to close the size even if it is not changing.
4345 begin
4346 return (Format.Color /= Output_Object.Color or else
4347 Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open or else
4348 Location_Needs_Close_or_Open);
4349 end Color_Needs_Close_or_Open;
4350
4351 function Size_Needs_Close_or_Open return Boolean is
4352 -- Returns True if "Size" needs to close something, based
4353 -- on the current values of Output_Object, and the new value.
4354 -- Note that this depends on whether the Change, Color, Font,
4355 -- or Location needs to open or close something; if they do,
4356 -- we need to close the size even if it is not changing.
4357 begin
4358 return (Format.Size /= Output_Object.Size or else
4359 Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open or else
4360 Location_Needs_Close_or_Open or else Color_Needs_Close_or_Open);
4361 end Size_Needs_Close_or_Open;
4362
4363 function Italic_Needs_Close_or_Open return Boolean is
4364 -- Returns True if "Italic" needs to close something, based
4365 -- on the current values of Output_Object, and the new value.
4366 -- Note that this depends on whether the Change, Font, Color,
4367 -- Location, or Size needs to open or close something; if they do,
4368 -- we need to close the italics even if it is not changing.
4369 begin
4370 return (Format.Italic /= Output_Object.Is_Italic or else
4371 Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open or else
4372 Location_Needs_Close_or_Open or else Size_Needs_Close_or_Open or else
4373 Color_Needs_Close_or_Open);
4374 end Italic_Needs_Close_or_Open;
4375
4376 begin
4377 if not Output_Object.Is_Valid then
4378 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4379 "Not valid object");
4380 end if;
4381 if not Output_Object.Is_In_Paragraph then
4382 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4383 "Not in paragraph");
4384 end if;
4385 -- We do these in this order so that the changes are stacked properly.
4386 -- Note that we have to open and close stuff that is not changing
4387 -- in order to get proper nesting in all cases.
4388
4389 if Output_Object.Is_Bold and then
4390 ((not Format.Bold) or else
4391 Italic_Needs_Close_or_Open) then
4392 -- The latter so that nesting is preserved; we'll reopen
4393 -- the boldfacing on the other side if needed. Otherwise, when
4394 -- Bold remains on, we'd leave the markup open but close some outer
4395 -- item. That's wrong (even though many browsers can handle it).
4396 Output_Text (Output_Object, "</B>");
4397 Output_Object.Is_Bold := False;
4398 end if;
4399
4400 if Output_Object.Is_Italic and then
4401 ((not Format.Italic) or else
4402 Size_Needs_Close_or_Open) then
4403 -- The latter so that nesting is preserved; we'll reopen
4404 -- the italics on the other side in that case.
4405 Output_Text (Output_Object, "</I>");
4406 Output_Object.Is_Italic := False;
4407 end if;
4408
4409 if Format.Size /= Output_Object.Size or else
4410 Color_Needs_Close_or_Open then
4411 -- The latter so that nesting is preserved; we'll reopen
4412 -- the size on the other side in that case.
4413 if Output_Object.Size /= 0 then
4414 if Output_Object.HTML_Kind = HTML_4_Only then
4415 Output_Text (Output_Object, "</SPAN>");
4416 else
4417 Output_Text (Output_Object, "</FONT>");
4418 end if;
4419 Output_Object.Size := 0; -- That's the size now.
4420 end if;
4421 end if;
4422
4423 if Format.Color /= Output_Object.Color or else
4424 Location_Needs_Close_or_Open then
4425 -- The latter so that nesting is preserved; we'll reopen
4426 -- the size on the other side in that case.
4427 if Output_Object.Color /= ARM_Output.Default then
4428 if Output_Object.HTML_Kind = HTML_4_Only then
4429 Output_Text (Output_Object, "</SPAN>");
4430 else
4431 Output_Text (Output_Object, "</FONT>");
4432 end if;
4433 Output_Object.Color := ARM_Output.Default; -- That's the color now.
4434 end if;
4435 end if;
4436
4437 if Format.Location /= Output_Object.Location or else
4438 Change_Needs_Close_or_Open then
4439 -- The latter so that nesting is preserved; we'll reopen
4440 -- the location on the other side in that case.
4441 case Output_Object.Location is
4442 when ARM_Output.Superscript =>
4443 if Output_Object.HTML_Kind = HTML_4_Only then
4444 Output_Text (Output_Object, "</SPAN></SUP>");
4445 else
4446 Output_Text (Output_Object, "</FONT></SUP>");
4447 end if;
4448 when ARM_Output.Subscript =>
4449 if Output_Object.HTML_Kind = HTML_4_Only then
4450 Output_Text (Output_Object, "</SPAN></SUB>");
4451 else
4452 Output_Text (Output_Object, "</FONT></SUB>");
4453 end if;
4454 when ARM_Output.Normal =>
4455 null;
4456 end case;
4457 Output_Object.Location := ARM_Output.Normal; -- That's the location now.
4458 end if;
4459
4460 if ARM_Output."/=" (Format.Font, Output_Object.Font) or else
4461 Change_Needs_Close_or_Open then
4462 -- The latter so that nesting is preserved; we'll reopen
4463 -- the font on the other side in that case.
4464 case Output_Object.Font is
4465 when ARM_Output.Default => null;
4466 when ARM_Output.Fixed =>
4467 Output_Text (Output_Object, "</TT>");
4468 when ARM_Output.Roman =>
4469 if Output_Object.HTML_Kind = HTML_4_Only then
4470 Output_Text (Output_Object, "</SPAN>");
4471 else
4472 null; -- Default, currently.
4473 --Output_Text (Output_Object, "</FONT>");
4474 end if;
4475 when ARM_Output.Swiss =>
4476 if Output_Object.HTML_Kind = HTML_4_Only then
4477 Output_Text (Output_Object, "</SPAN>");
4478 else
4479 Output_Text (Output_Object, "</FONT>");
4480 end if;
4481 end case;
4482 Output_Object.Font := ARM_Output.Default; -- We're now in the default state.
4483 end if;
4484
4485 if Format.Change /= Output_Object.Change or else
4486 Format.Version /= Output_Object.Version or else
4487 Format.Added_Version /= Output_Object.Added_Version then
4488 case Output_Object.Change is
4489 when ARM_Output.Insertion =>
4490 if Output_Object.HTML_Kind = HTML_3 then
4491 Output_Text (Output_Object, "</U>");
4492 else
4493 --Output_Text (Output_Object, "</ins>");
4494 Output_Text (Output_Object, "</span>");
4495 end if;
4496 -- Note: We need to follow these with a space so that
4497 -- we don't get words running together for indexing
4498 -- purposes (Google, Ada Indexer). That's only a concern
4499 -- for deletions directly following insertions (at least in
4500 -- the absence of nesting), so we only add the extra space
4501 -- after insertions. RTF needs insertions and deletions
4502 -- without spaces to work properly, thus the source does not
4503 -- have them.
4504 -- If the last character of the displayed text is a space,
4505 -- we don't need this, and don't generate it. We do
4506 -- generate it for punctuation, as we want a space following
4507 -- that in general.
4508 -- If the next visible character is not in some sort of
4509 -- change section, we'd prefer to not generate
4510 -- the space, but there is no obvious way to determine that
4511 -- (we don't know when the command ends here).
4512 -- We can, however, generate a conditional space that is
4513 -- not generated if the next visible character is a space
4514 -- or punctuation (we don't usually want a space *before*
4515 -- punctuation).
4516 if Output_Object.Last_was_Space then
4517 null;
4518 else
4519 Output_Object.Conditional_Space := True;
4520 end if;
4521 when ARM_Output.Deletion =>
4522 if Output_Object.HTML_Kind = HTML_3 then
4523 Output_Text (Output_Object, "</S>");
4524 else
4525 --Output_Text (Output_Object, "</del>");
4526 Output_Text (Output_Object, "</span>");
4527 end if;
4528 when ARM_Output.Both =>
4529 if Output_Object.HTML_Kind = HTML_3 then
4530 Output_Text (Output_Object, "</S></U>");
4531 else
4532 --Output_Text (Output_Object, "</del></ins>");
4533 --Output_Text (Output_Object, "</span>");
4534 -- CSS2 doesn't allow multiple decorations in a single definition, so we have
4535 -- to nest them. But that might not be right, either (it works on IE).
4536 Output_Text (Output_Object, "</span></span>");
4537 end if;
4538 if Output_Object.Last_was_Space then -- See above for reasons for this.
4539 null;
4540 else
4541 Output_Object.Conditional_Space := True;
4542 end if;
4543 when ARM_Output.None =>
4544 null;
4545 end case;
4546 case Format.Change is
4547 when ARM_Output.Insertion =>
4548 if Output_Object.HTML_Kind = HTML_3 then
4549 Output_Text (Output_Object, "<U>");
4550 else
4551 --Output_Text (Output_Object, "<ins>");
4552 Output_Text (Output_Object, "<span class=""insert" & Format.Version & """>");
4553 Revision_Used(Format.Version) := True;
4554 end if;
4555 when ARM_Output.Deletion =>
4556 if Output_Object.HTML_Kind = HTML_3 then
4557 Output_Text (Output_Object, "<S>");
4558 else
4559 --Output_Text (Output_Object, "<del>");
4560 Output_Text (Output_Object, "<span class=""delete" & Format.Version & """>");
4561 Revision_Used(Format.Version) := True;
4562 end if;
4563 when ARM_Output.Both =>
4564 if Output_Object.HTML_Kind = HTML_3 then
4565 Output_Text (Output_Object, "<U><S>");
4566 else
4567 --Output_Text (Output_Object, "<ins><del>");
4568 --Output_Text (Output_Object, "<span class=""both" & Format.Version & """>");
4569 -- CSS2 doesn't allow multiple decorations in a single definition, so we have
4570 -- to nest them. But that might not be right, either (it works on IE).
4571 Output_Text (Output_Object, "<span class=""insert" & Format.Added_Version & """>");
4572 Output_Text (Output_Object, "<span class=""delete" & Format.Version & """>");
4573 Revision_Used(Format.Added_Version) := True;
4574 Revision_Used(Format.Version) := True;
4575 end if;
4576 when ARM_Output.None =>
4577 null;
4578 end case;
4579 Output_Object.Change := Format.Change;
4580 Output_Object.Version := Format.Version;
4581 Output_Object.Added_Version := Format.Added_Version;
4582 end if;
4583
4584 if ARM_Output."/=" (Format.Font, Output_Object.Font) then
4585 case Format.Font is
4586 when ARM_Output.Default => null;
4587 when ARM_Output.Fixed =>
4588 Output_Text (Output_Object, "<TT>");
4589 when ARM_Output.Roman =>
4590 if Output_Object.HTML_Kind = HTML_4_Only then
4591 Output_Text (Output_Object, "<SPAN Class=""roman"">");
4592 else
4593 null; -- Default, currently.
4594 --Output_Text (Output_Object, "<FONT xxx>");
4595 end if;
4596 when ARM_Output.Swiss =>
4597 if Output_Object.HTML_Kind = HTML_4_Only then
4598 Output_Text (Output_Object, "<SPAN Class=""swiss"">");
4599 else
4600 Output_Text (Output_Object, SWISS_FONT_CODE);
4601 end if;
4602 end case;
4603 Output_Object.Font := Format.Font;
4604 end if;
4605
4606 if Format.Location /= Output_Object.Location then
4607 -- Note: Location needs to be changed before size, as they
4608 -- typically are changed together, and <SUP> and <SUB> reset the
4609 -- size.
4610 case Format.Location is
4611 when ARM_Output.Superscript =>
4612 if Output_Object.HTML_Kind = HTML_4_Only then
4613 Output_Text (Output_Object, "<SUP><SPAN STYLE=""font-size: 140%"">");
4614 -- This is a bit larger than +1; the text is usually too small.
4615 else
4616 Output_Text (Output_Object, "<SUP><FONT SIZE=""+1"">");
4617 end if;
4618 when ARM_Output.Subscript =>
4619 if Output_Object.HTML_Kind = HTML_4_Only then
4620 Output_Text (Output_Object, "<SUB><SPAN STYLE=""font-size: 140%"">");
4621 -- This is a bit larger than +1; the text is usually too small.
4622 else
4623 Output_Text (Output_Object, "<SUB><FONT SIZE=""+1"">");
4624 end if;
4625 when ARM_Output.Normal =>
4626 null;
4627 end case;
4628 Output_Object.Location := Format.Location;
4629 end if;
4630
4631 if Format.Color /= Output_Object.Color then
4632 if Output_Object.HTML_Kind = HTML_4_Only then
4633 case Format.Color is
4634 when ARM_Output.Default => null;
4635 when ARM_Output.Black =>
4636 Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(0,0,0)"">");
4637 when ARM_Output.Red =>
4638 Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(153,0,0)"">");
4639 when ARM_Output.Green =>
4640 Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(0,153,0)"">");
4641 when ARM_Output.Blue =>
4642 Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(0,0,153)"">");
4643 end case;
4644 else
4645 case Format.Color is
4646 when ARM_Output.Default => null;
4647 when ARM_Output.Black =>
4648 Output_Text (Output_Object, "<FONT COLOR=""#000000"">");
4649 when ARM_Output.Red =>
4650 Output_Text (Output_Object, "<FONT COLOR=""#990000"">");
4651 when ARM_Output.Green =>
4652 Output_Text (Output_Object, "<FONT COLOR=""#009900"">");
4653 when ARM_Output.Blue =>
4654 Output_Text (Output_Object, "<FONT COLOR=""#000099"">");
4655 end case;
4656 end if;
4657 Output_Object.Color := Format.Color;
4658 end if;
4659
4660 if Format.Size /= Output_Object.Size then
4661 if Output_Object.HTML_Kind = HTML_4_Only then
4662 case Format.Size is
4663 when 0 => null; -- Do nothing.
4664 when 1 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 125%"">");
4665 when 2 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 156%"">");
4666 when 3 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 194%"">");
4667 when 4 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 244%"">");
4668 when 5 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 305%"">");
4669 when -1 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 80%"">");
4670 when -2 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 64%"">");
4671 when -3 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 51%"">");
4672 when -4 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 41%"">");
4673 when -5 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 33%"">");
4674 when others =>
4675 -- Too much change:
4676 if Format.Size > 0 then
4677 Output_Text (Output_Object, "<SPAN STYLE=""font-size: 305%"">");
4678 else
4679 Output_Text (Output_Object, "<SPAN STYLE=""font-size: 33%"">");
4680 end if;
4681 end case;
4682 else
4683 -- HTML sizes are 1..7, with a default of 3. So we limit the changes.
4684 if Format.Size > 0 then
4685 if Format.Size > 5 then
4686 Output_Text (Output_Object, "<FONT SIZE=""+5"">");
4687 else
4688 Output_Text (Output_Object, "<FONT SIZE=""+" &
4689 Character'Val(Format.Size + Character'Pos('0')) & """>");
4690 end if;
4691 elsif Format.Size < 0 then
4692 if Format.Size < -4 then
4693 Output_Text (Output_Object, "<FONT SIZE=""-4"">");
4694 else
4695 Output_Text (Output_Object, "<FONT SIZE=""-" &
4696 Character'Val(abs Format.Size + Character'Pos('0')) & """>");
4697 end if;
4698 -- else Format.Size=0, nothing to do.
4699 end if;
4700 end if;
4701 Output_Object.Size := Format.Size;
4702 end if;
4703
4704 if Format.Italic and (not Output_Object.Is_Italic) then
4705 Output_Text (Output_Object, "<I>");
4706 Output_Object.Is_Italic := True;
4707 end if;
4708 if Format.Bold and (not Output_Object.Is_Bold) then
4709 Output_Text (Output_Object, "<B>");
4710 Output_Object.Is_Bold := True;
4711 end if;
4712
4713 end Text_Format;
4714
4715
4716 procedure Clause_Reference (Output_Object : in out HTML_Output_Type;
4717 Text : in String;
4718 Clause_Number : in String) is
4719 -- Generate a reference to a clause in the standard. The text of
4720 -- the reference is "Text", and the number of the clause is
4721 -- Clause_Number. For hyperlinked formats, this should generate
4722 -- a link; for other formats, the text alone is generated.
4723 begin
4724 if not Output_Object.Is_Valid then
4725 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4726 "Not valid object");
4727 end if;
4728 if not Output_Object.Is_In_Paragraph then
4729 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4730 "Not in paragraph");
4731 end if;
4732 if Clause_Number = "X.X" then
4733 -- Link to a dead clause, just output the text (presumably this
4734 -- is deleted).
4735 Ordinary_Text (Output_Object, Text);
4736 else
4737 Output_Text (Output_Object, "<A HREF=""");
4738 declare
4739 Name : constant String :=
4740 Make_Clause_Link_Name (Output_Object, Clause_Number);
4741 begin
4742 Output_Text (Output_Object, Name);
4743 end;
4744 Output_Text (Output_Object, """>");
4745 Ordinary_Text (Output_Object, Text);
4746 Output_Text (Output_Object, "</A>");
4747 end if;
4748 end Clause_Reference;
4749
4750
4751 procedure Index_Target (Output_Object : in out HTML_Output_Type;
4752 Index_Key : in Natural) is
4753 -- Generate a index target. This marks the location where an index
4754 -- reference occurs. Index_Key names the index item involved.
4755 -- For hyperlinked formats, this should generate a link target;
4756 -- for other formats, nothing is generated.
4757 begin
4758 if not Output_Object.Is_Valid then
4759 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4760 "Not valid object");
4761 end if;
4762 if not Output_Object.Is_In_Paragraph then
4763 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4764 "Not in paragraph");
4765 end if;
4766 -- Insert an anchor:
4767 Output_Text (Output_Object, "<A NAME=""I");
4768 declare
4769 Key_Name : constant String := Natural'Image(Index_Key);
4770 begin
4771 Output_Text (Output_Object, Key_Name(2..Key_Name'Last));
4772 end;
4773 Output_Text (Output_Object, """></A>");
4774 end Index_Target;
4775
4776
4777 procedure Index_Reference (Output_Object : in out HTML_Output_Type;
4778 Text : in String;
4779 Index_Key : in Natural;
4780 Clause_Number : in String) is
4781 -- Generate a reference to an index target in the standard. The text
4782 -- of the reference is "Text", and Index_Key and Clause_Number denotes
4783 -- the target. For hyperlinked formats, this should generate
4784 -- a link; for other formats, the text alone is generated.
4785 begin
4786 if not Output_Object.Is_Valid then
4787 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4788 "Not valid object");
4789 end if;
4790 if not Output_Object.Is_In_Paragraph then
4791 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4792 "Not in paragraph");
4793 end if;
4794 Output_Text (Output_Object, "<A HREF=""");
4795 if Output_Object.Big_Files then
4796 null; -- No file name needed, this is a self-reference.
4797 else
4798 if Output_Object.DOS_Filenames then
4799 Output_Text (Output_Object,
4800 Make_Clause_File_Name (Output_Object, Clause_Number)
4801 & ".HTM");
4802 else
4803 Output_Text (Output_Object,
4804 Make_Clause_File_Name (Output_Object, Clause_Number)
4805 & ".html");
4806 end if;
4807 end if;
4808 Output_Text (Output_Object, "#I");
4809 declare
4810 Key_Name : constant String := Natural'Image(Index_Key);
4811 begin
4812 Output_Text (Output_Object, Key_Name(2..Key_Name'Last));
4813 end;
4814 Output_Text (Output_Object, """>");
4815 Ordinary_Text (Output_Object, Text);
4816 Output_Text (Output_Object, "</A>");
4817 end Index_Reference;
4818
4819
4820 procedure DR_Reference (Output_Object : in out HTML_Output_Type;
4821 Text : in String;
4822 DR_Number : in String) is
4823 -- Generate a reference to an DR from the standard. The text
4824 -- of the reference is "Text", and DR_Number denotes
4825 -- the target. For hyperlinked formats, this should generate
4826 -- a link; for other formats, the text alone is generated.
4827 begin
4828 if not Output_Object.Is_Valid then
4829 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4830 "Not valid object");
4831 end if;
4832 if not Output_Object.Is_In_Paragraph then
4833 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4834 "Not in paragraph");
4835 end if;
4836 declare
4837 Num : Integer := Integer'Value(DR_Number(DR_Number'Last-3 .. DR_Number'Last));
4838 begin
4839 Output_Text (Output_Object, "<A HREF=""");
4840 if Num <= 93 then -- In Defect Reports 1. -- %%%% Update if changed.
4841 Output_Text (Output_Object, "defect1.html");
4842 else -- In Defect Reports 2.
4843 Output_Text (Output_Object, "defect2.html");
4844 end if;
4845 Output_Text (Output_Object, "#");
4846 Output_Text (Output_Object, DR_Number);
4847 end;
4848 Output_Text (Output_Object, """>");
4849 Ordinary_Text (Output_Object, Text);
4850 Output_Text (Output_Object, "</A>");
4851 end DR_Reference;
4852
4853
4854 function Folded_AI95_Number (AI_String : in String) return String is
4855 -- Internal routine.
4856 -- Calculate the "folded" AI number from the full version.
4857 -- AI_String should be in the form "AIzz-00xxx-yy", where -yy, 00,
4858 -- and zz are optional, and 'zz' = 95 if given.
4859 Result : String(1..5);
4860 Hyphen_1 : Natural := Ada.Strings.Fixed.Index (AI_String, "-");
4861 Hyphen_2 : Natural;
4862 begin
4863 if Hyphen_1 = 0 or else AI_String'Last < Hyphen_1+3 then
4864 Result := "00001";
4865 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4866 "Bad AI reference " & AI_String);
4867 elsif Hyphen_1 = AI_String'First+4 and then
4868 AI_String(AI_String'First..Hyphen_1-1) /= "AI95" then
4869 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4870 "Unknown AI reference " & AI_String);
4871 Result := "00001";
4872 elsif Hyphen_1 = AI_String'First+2 and then
4873 AI_String(AI_String'First..Hyphen_1-1) /= "AI" then
4874 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4875 "Unknown short AI reference " & AI_String);
4876 Result := "00001";
4877 else
4878 Hyphen_2 := Ada.Strings.Fixed.Index (AI_String(Hyphen_1+1..AI_String'Last), "-");
4879 if Hyphen_2 = 0 then
4880 if AI_String'Last = Hyphen_1+5 then
4881 Result := AI_String(Hyphen_1+1 .. Hyphen_1+5);
4882 elsif AI_String'Last = Hyphen_1+4 then
4883 Result(2..5) := AI_String(Hyphen_1+1 .. Hyphen_1+4);
4884 Result(1) := '0';
4885 elsif AI_String'Last = Hyphen_1+3 then
4886 Result(3..5) := AI_String(Hyphen_1+1 .. Hyphen_1+3);
4887 Result(1) := '0';
4888 Result(2) := '0';
4889 else
4890 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4891 "AI reference too wrong length " & AI_String);
4892 Result := "00001";
4893 end if;
4894 else
4895 if (Hyphen_2-1) - (Hyphen_1+1) = 5-1 then
4896 Result := AI_String (Hyphen_1+1 .. Hyphen_2-1);
4897 elsif (Hyphen_2-1) - (Hyphen_1+1) = 4-1 then
4898 Result(2..5) := AI_String (Hyphen_1+1 .. Hyphen_2-1);
4899 Result(1) := '0';
4900 elsif (Hyphen_2-1) - (Hyphen_1+1) = 3-1 then
4901 Result(3..5) := AI_String (Hyphen_1+1 .. Hyphen_2-1);
4902 Result(1) := '0';
4903 Result(2) := '0';
4904 else
4905 Result := "00001";
4906 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4907 "Bad AI reference (hyphen dist) " & AI_String);
4908 end if;
4909 if AI_String'Last < Hyphen_2+1 or else
4910 AI_String'Last > Hyphen_2+2 then
4911 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4912 "Bad AI alternative reference " & AI_String);
4913 elsif AI_String'Last = Hyphen_2+1 then
4914 Result(1) := Character'Pred(AI_String(Hyphen_2+1));
4915 elsif AI_String'Last = Hyphen_2+2 and then AI_String(Hyphen_2+1) = '0' then
4916 Result(1) := Character'Pred(AI_String(Hyphen_2+2));
4917 elsif AI_String'Last = Hyphen_2+2 and then AI_String(Hyphen_2+1) = '1' then
4918 if AI_String(Hyphen_2+2) = '0' then
4919 Result(1) := '9';
4920 else
4921 Result(1) := Character'Val(Character'Pos(AI_String(Hyphen_2+2)) - Character'Pos('1') + Character'Pos('A'));
4922 end if;
4923 elsif AI_String'Last = Hyphen_2+2 and then AI_String(Hyphen_2+1) = '2' then
4924 Result(1) := Character'Val(Character'Pos(AI_String(Hyphen_2+2)) - Character'Pos('1') + Character'Pos('A') + 10);
4925 else
4926 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4927 "Bad AI alternative reference " & AI_String);
4928 end if;
4929 end if;
4930 end if;
4931 return Result;
4932 end Folded_AI95_Number;
4933
4934
4935 procedure AI_Reference (Output_Object : in out HTML_Output_Type;
4936 Text : in String;
4937 AI_Number : in String) is
4938 -- Generate a reference to an AI from the standard. The text
4939 -- of the reference is "Text", and AI_Number denotes
4940 -- the target (in unfolded format). For hyperlinked formats, this should
4941 -- generate a link; for other formats, the text alone is generated.
4942 --
4943 -- We assume AI number is of the form:
4944 -- ZZZZ-nnnn-m whre ZZZZ=AI05, AI12, or SI99, nnnn is a four digit number,
4945 -- and -m is an optional number (-1 is used if it is omitted); or
4946 -- AIzz-nnnnn-mm where AIzz=AI95 or AI (meaning AI95);
4947 -- nnnnn is a five digit number, and -mm is an optional two digit number.
4948 -- We raise Not_Valid_Error otherwise.
4949 begin
4950 if not Output_Object.Is_Valid then
4951 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4952 "Not valid object");
4953 end if;
4954 if not Output_Object.Is_In_Paragraph then
4955 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4956 "Not in paragraph");
4957 end if;
4958 if AI_Number'Length > 5 and then
4959 AI_Number(AI_Number'First..AI_Number'First+4) = "AI12-" then
4960 -- AI12:
4961 if AI_Number'Length >= 9 then
4962 if AI_Number(AI_Number'First+5) not in '0'..'9' or else
4963 AI_Number(AI_Number'First+6) not in '0'..'9' or else
4964 AI_Number(AI_Number'First+7) not in '0'..'9' or else
4965 AI_Number(AI_Number'First+8) not in '0'..'9' then
4966 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4967 "Bad number in AI12 number: " & AI_Number);
4968 end if;
4969 end if;
4970 if AI_Number'Length = 9 then
4971 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI12s/");
4972 Output_Text (Output_Object, AI_Number & "-1");
4973 elsif AI_Number'Length = 11 then
4974 if AI_Number(AI_Number'Last-1) /= '-' or else
4975 AI_Number(AI_Number'Last) not in '0'..'9' then
4976 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4977 "Bad sequence number in AI12 number: " & AI_Number);
4978 end if;
4979 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI12s/");
4980 Output_Text (Output_Object, AI_Number);
4981 else
4982 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4983 "Bad AI12 number: " & AI_Number);
4984 end if;
4985 elsif AI_Number'Length > 5 and then
4986 AI_Number(AI_Number'First..AI_Number'First+4) = "AI05-" then
4987 -- AI05:
4988 if AI_Number'Length >= 9 then
4989 if AI_Number(AI_Number'First+5) not in '0'..'9' or else
4990 AI_Number(AI_Number'First+6) not in '0'..'9' or else
4991 AI_Number(AI_Number'First+7) not in '0'..'9' or else
4992 AI_Number(AI_Number'First+8) not in '0'..'9' then
4993 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
4994 "Bad number in AI05 number: " & AI_Number);
4995 end if;
4996 end if;
4997 if AI_Number'Length = 9 then
4998 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI05s/");
4999 Output_Text (Output_Object, AI_Number & "-1");
5000 elsif AI_Number'Length = 11 then
5001 if AI_Number(AI_Number'Last-1) /= '-' or else
5002 AI_Number(AI_Number'Last) not in '0'..'9' then
5003 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5004 "Bad sequence number in AI05 number: " & AI_Number);
5005 end if;
5006 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI05s/");
5007 Output_Text (Output_Object, AI_Number);
5008 else
5009 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5010 "Bad AI05 number: " & AI_Number);
5011 end if;
5012 elsif AI_Number'Length > 5 and then
5013 AI_Number(AI_Number'First..AI_Number'First+4) = "SI99-" then
5014 if AI_Number'Length >= 9 then
5015 if AI_Number(AI_Number'First+5) not in '0'..'9' or else
5016 AI_Number(AI_Number'First+6) not in '0'..'9' or else
5017 AI_Number(AI_Number'First+7) not in '0'..'9' or else
5018 AI_Number(AI_Number'First+8) not in '0'..'9' then
5019 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5020 "Bad number in SI99 number: " & AI_Number);
5021 end if;
5022 end if;
5023 if AI_Number'Length = 9 then
5024 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/SI99s/");
5025 Output_Text (Output_Object, AI_Number & "-1");
5026 elsif AI_Number'Length = 11 then
5027 if AI_Number(AI_Number'Last-1) /= '-' or else
5028 AI_Number(AI_Number'Last) not in '0'..'9' then
5029 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5030 "Bad sequence number in SI99 number: " & AI_Number);
5031 end if;
5032 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/SI99s/");
5033 Output_Text (Output_Object, AI_Number);
5034 else
5035 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5036 "Bad SI99 number: " & AI_Number);
5037 end if;
5038 else -- Must be AI95:
5039 declare
5040 Folded : constant String :=
5041 Folded_AI95_Number(AI_Number); -- We don't want to have written anything if we raise an exception.
5042 begin
5043 Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-");
5044 Output_Text (Output_Object, Folded);
5045 end;
5046 end if;
5047 Output_Text (Output_Object, ".TXT"">");
5048 Ordinary_Text (Output_Object, Text);
5049 Output_Text (Output_Object, "</A>");
5050
5051 end AI_Reference;
5052
5053
5054 procedure Local_Target (Output_Object : in out HTML_Output_Type;
5055 Text : in String;
5056 Target : in String) is
5057 -- Generate a local target. This marks the potential target of local
5058 -- links identified by "Target". Text is the text of the target.
5059 -- For hyperlinked formats, this should generate a link target;
5060 -- for other formats, only the text is generated.
5061 begin
5062 if not Output_Object.Is_Valid then
5063 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5064 "Not valid object");
5065 end if;
5066 if not Output_Object.Is_In_Paragraph then
5067 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5068 "Not in paragraph");
5069 end if;
5070 -- Insert an anchor:
5071 Output_Text (Output_Object, "<A NAME=""");
5072 Output_Text (Output_Object, Target);
5073 Output_Text (Output_Object, """>");
5074 Ordinary_Text (Output_Object, Text);
5075 Output_Text (Output_Object, "</A>");
5076 end Local_Target;
5077
5078
5079 procedure Local_Link (Output_Object : in out HTML_Output_Type;
5080 Text : in String;
5081 Target : in String;
5082 Clause_Number : in String) is
5083 -- Generate a local link to the target and clause given.
5084 -- Text is the text of the link.
5085 -- For hyperlinked formats, this should generate a link;
5086 -- for other formats, only the text is generated.
5087 begin
5088 if not Output_Object.Is_Valid then
5089 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5090 "Not valid object");
5091 end if;
5092 if not Output_Object.Is_In_Paragraph then
5093 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5094 "Not in paragraph");
5095 end if;
5096 -- Insert an anchor:
5097 Output_Text (Output_Object, "<A HREF=""");
5098 if Output_Object.Big_Files then
5099 null; -- No file name needed, this is a self-reference.
5100 else
5101 if Output_Object.DOS_Filenames then
5102 Output_Text (Output_Object,
5103 Make_Clause_File_Name (Output_Object, Clause_Number)
5104 & ".HTM");
5105 else
5106 Output_Text (Output_Object,
5107 Make_Clause_File_Name (Output_Object, Clause_Number)
5108 & ".html");
5109 end if;
5110 end if;
5111 Output_Text (Output_Object, "#" & Target);
5112 Output_Text (Output_Object, """>");
5113 Ordinary_Text (Output_Object, Text);
5114 Output_Text (Output_Object, "</A>");
5115 end Local_Link;
5116
5117
5118 procedure Local_Link_Start (Output_Object : in out HTML_Output_Type;
5119 Target : in String;
5120 Clause_Number : in String) is
5121 -- Generate a local link to the target and clause given.
5122 -- The link will surround text until Local_Link_End is called.
5123 -- Local_Link_End must be called before this routine can be used again.
5124 -- For hyperlinked formats, this should generate a link;
5125 -- for other formats, only the text is generated.
5126 begin
5127 if not Output_Object.Is_Valid then
5128 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5129 "Not valid object");
5130 end if;
5131 if not Output_Object.Is_In_Paragraph then
5132 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5133 "Not in paragraph");
5134 end if;
5135 if Output_Object.In_Local_Link then
5136 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5137 "Already in a local link");
5138 end if;
5139 Output_Object.In_Local_Link := True;
5140 -- Insert an anchor:
5141 Output_Text (Output_Object, "<A HREF=""");
5142 if Output_Object.Big_Files then
5143 null; -- No file name needed, this is a self-reference.
5144 else
5145 if Output_Object.DOS_Filenames then
5146 Output_Text (Output_Object,
5147 Make_Clause_File_Name (Output_Object, Clause_Number)
5148 & ".HTM");
5149 else
5150 Output_Text (Output_Object,
5151 Make_Clause_File_Name (Output_Object, Clause_Number)
5152 & ".html");
5153 end if;
5154 end if;
5155 Output_Text (Output_Object, "#" & Target);
5156 Output_Text (Output_Object, """>");
5157 end Local_Link_Start;
5158
5159
5160 procedure Local_Link_End (Output_Object : in out HTML_Output_Type;
5161 Target : in String;
5162 Clause_Number : in String) is
5163 -- End a local link for the target and clause given.
5164 -- This must be in the same paragraph as the Local_Link_Start.
5165 -- For hyperlinked formats, this should generate a link;
5166 -- for other formats, only the text is generated.
5167 begin
5168 if not Output_Object.Is_Valid then
5169 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5170 "Not valid object");
5171 end if;
5172 if not Output_Object.Is_In_Paragraph then
5173 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5174 "Not in paragraph");
5175 end if;
5176 if not Output_Object.In_Local_Link then
5177 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5178 "Not in a local link");
5179 end if;
5180 Output_Text (Output_Object, "</A>");
5181 Output_Object.In_Local_Link := False;
5182 end Local_Link_End;
5183
5184
5185 procedure URL_Link (Output_Object : in out HTML_Output_Type;
5186 Text : in String;
5187 URL : in String) is
5188 -- Generate a link to the URL given.
5189 -- Text is the text of the link.
5190 -- For hyperlinked formats, this should generate a link;
5191 -- for other formats, only the text is generated.
5192 begin
5193 if not Output_Object.Is_Valid then
5194 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5195 "Not valid object");
5196 end if;
5197 if not Output_Object.Is_In_Paragraph then
5198 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5199 "Not in paragraph");
5200 end if;
5201 -- Insert an anchor:
5202 Output_Text (Output_Object, "<A HREF=""");
5203 Output_Text (Output_Object, URL);
5204 Output_Text (Output_Object, """>");
5205 Ordinary_Text (Output_Object, Text);
5206 Output_Text (Output_Object, "</A>");
5207 end URL_Link;
5208
5209
5210 procedure Picture (Output_Object : in out HTML_Output_Type;
5211 Name : in String;
5212 Descr : in String;
5213 Alignment : in ARM_Output.Picture_Alignment;
5214 Height, Width : in Natural;
5215 Border : in ARM_Output.Border_Kind) is
5216 -- Generate a picture.
5217 -- Name is the (simple) file name of the picture; Descr is a
5218 -- descriptive name for the picture (it will appear in some web
5219 -- browsers).
5220 -- We assume that it is a .PNG or .JPG and that it will be present
5221 -- in the same directory as the output files.
5222 -- Alignment specifies the picture alignment.
5223 -- Height and Width specify the picture size in pixels.
5224 -- Border specifies the kind of border.
5225
5226 procedure Make_Img (Extra_Attribs : in String) is
5227 H : constant String := Natural'Image(Height);
5228 W : constant String := Natural'Image(Width);
5229 begin
5230 Output_Text (Output_Object, "<IMG src=""" & Name & """");
5231 Output_Text (Output_Object, " height=""" & H(2..H'Last) &
5232 """ width=""" & W(2..W'Last) & """");
5233 if Extra_Attribs /= "" then
5234 Output_Text (Output_Object, Extra_Attribs);
5235 end if;
5236 Output_Text (Output_Object, " alt=""" & Descr & """");
5237 case Border is
5238 when ARM_Output.None =>
5239 Output_Text (Output_Object, " border=""0"">");
5240 when ARM_Output.Thin =>
5241 Output_Text (Output_Object, " border=""1"">");
5242 when ARM_Output.Thick =>
5243 Output_Text (Output_Object, " border=""2"">");
5244 end case;
5245 end Make_Img;
5246
5247 begin
5248 if not Output_Object.Is_Valid then
5249 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5250 "Not valid object");
5251 end if;
5252 case Alignment is
5253 when ARM_Output.Inline =>
5254 if not Output_Object.Is_In_Paragraph then
5255 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5256 "Not in paragraph");
5257 end if;
5258 if Output_Object.HTML_Kind = HTML_3 then
5259 Make_Img ("");
5260 else
5261 Make_Img (" style=""margin-left: 0.3em; margin-right: 0.3em""");
5262 end if;
5263 when ARM_Output.Float_Left =>
5264 if not Output_Object.Is_In_Paragraph then
5265 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5266 "Not in paragraph");
5267 end if;
5268 if Output_Object.HTML_Kind = HTML_3 then
5269 Make_Img (" align=""left""");
5270 else
5271 Make_Img (" align=""left"" style=""margin-right: 0.3em""");
5272 -- Space on right only; left should align with containing
5273 -- margin.
5274 end if;
5275 when ARM_Output.Float_Right =>
5276 if not Output_Object.Is_In_Paragraph then
5277 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5278 "Not in paragraph");
5279 end if;
5280 if Output_Object.HTML_Kind = HTML_3 then
5281 Make_Img (" align=""right""");
5282 else
5283 Make_Img (" align=""right"" style=""margin-left: 0.3em""");
5284 -- Space on right only; left should align with containing
5285 -- margin.
5286 end if;
5287 when ARM_Output.Alone_Left =>
5288 if Output_Object.Is_In_Paragraph then
5289 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5290 "In paragraph");
5291 end if;
5292 if Output_Object.HTML_Kind = HTML_4_Only then
5293 Output_Text (Output_Object, "<DIV Style=""text-align: left; margin-bottom: ");
5294 Put_EMs(Output_Object.Output_File, (Paragraph_Info(ARM_Output.Normal, 0).After * LEADING_PERCENT) / 100);
5295 Output_Text (Output_Object, """>");
5296 else
5297 Output_Text (Output_Object, "<P>");
5298 end if;
5299 Make_Img("");
5300 if Output_Object.HTML_Kind = HTML_4_Only then
5301 Output_Text (Output_Object, "</DIV>");
5302 else
5303 Output_Text (Output_Object, "</P>");
5304 end if;
5305 Ada.Text_IO.New_Line (Output_Object.Output_File);
5306 Output_Object.Char_Count := 0;
5307 Output_Object.Disp_Char_Count := 0;
5308 Output_Object.Disp_Large_Char_Count := 0;
5309 Output_Object.Any_Nonspace := False;
5310 Output_Object.Last_Was_Space := True; -- Start of line.
5311 Output_Object.Conditional_Space := False; -- Don't need it here.
5312 when ARM_Output.Alone_Right =>
5313 if Output_Object.Is_In_Paragraph then
5314 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5315 "In paragraph");
5316 end if;
5317 if Output_Object.HTML_Kind = HTML_4_Only then
5318 Output_Text (Output_Object, "<DIV Style=""text-align: right; margin-bottom: ");
5319 Put_EMs(Output_Object.Output_File, (Paragraph_Info(ARM_Output.Normal, 0).After * LEADING_PERCENT) / 100);
5320 Output_Text (Output_Object, """>");
5321 else
5322 Output_Text (Output_Object, "<RIGHT>");
5323 end if;
5324 Make_Img("");
5325 if Output_Object.HTML_Kind = HTML_4_Only then
5326 Output_Text (Output_Object, "</DIV>");
5327 else
5328 Output_Text (Output_Object, "</RIGHT>");
5329 end if;
5330 Ada.Text_IO.New_Line (Output_Object.Output_File);
5331 Output_Object.Char_Count := 0;
5332 Output_Object.Disp_Char_Count := 0;
5333 Output_Object.Disp_Large_Char_Count := 0;
5334 Output_Object.Any_Nonspace := False;
5335 Output_Object.Last_Was_Space := True; -- Start of line.
5336 Output_Object.Conditional_Space := False; -- Don't need it here.
5337 when ARM_Output.Alone_Center =>
5338 if Output_Object.Is_In_Paragraph then
5339 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
5340 "In paragraph");
5341 end if;
5342 if Output_Object.HTML_Kind = HTML_4_Only then
5343 Output_Text (Output_Object, "<DIV Style=""text-align: center; margin-bottom: ");
5344 Put_EMs(Output_Object.Output_File, (Paragraph_Info(ARM_Output.Normal, 0).After * LEADING_PERCENT) / 100);
5345 Output_Text (Output_Object, """>");
5346 else
5347 Output_Text (Output_Object, "<CENTER>");
5348 end if;
5349 Make_Img("");
5350 if Output_Object.HTML_Kind = HTML_4_Only then
5351 Output_Text (Output_Object, "</DIV>");
5352 else
5353 Output_Text (Output_Object, "</CENTER>");
5354 end if;
5355 Ada.Text_IO.New_Line (Output_Object.Output_File);
5356 Output_Object.Char_Count := 0;
5357 Output_Object.Disp_Char_Count := 0;
5358 Output_Object.Disp_Large_Char_Count := 0;
5359 Output_Object.Any_Nonspace := False;
5360 Output_Object.Last_Was_Space := True; -- Start of line.
5361 Output_Object.Conditional_Space := False; -- Don't need it here.
5362 end case;
5363 end Picture;
5364
5365 begin
5366 -- Define the styles:
5367 -- Normal:
5368 for I in ARM_Output.Paragraph_Indent_Type loop
5369 Paragraph_Info(ARM_Output.Normal, I) :=
5370 (Defined => True,
5371 Tag => DIV,
5372 Size => 0, -- 18
5373 Font => ARM_Output.Default,
5374 Indent => Natural(I),
5375 Right_Indent => 0,
5376 Hang_Outdent => 0,
5377 Before => 0,
5378 After => 6); -- 120
5379 end loop;
5380 -- Wide_Above:
5381 for I in ARM_Output.Paragraph_Indent_Type loop
5382 Paragraph_Info(ARM_Output.Wide_Above, I) :=
5383 (Defined => True,
5384 Tag => DIV,
5385 Size => 0, -- 18
5386 Font => ARM_Output.Default,
5387 Indent => Natural(I),
5388 Right_Indent => 0,
5389 Hang_Outdent => 0,
5390 Before => 6,
5391 After => 6);
5392 end loop;
5393 -- Header:
5394 for I in ARM_Output.Paragraph_Indent_Type loop
5395 Paragraph_Info(ARM_Output.Header, I) :=
5396 (Defined => True,
5397 Tag => DIV,
5398 Size => 0, -- 18
5399 Font => ARM_Output.Default,
5400 Indent => Natural(I),
5401 Right_Indent => 0,
5402 Hang_Outdent => 0,
5403 Before => 0,
5404 After => 0);
5405 end loop;
5406 -- Small:
5407 for I in ARM_Output.Paragraph_Indent_Type loop
5408 Paragraph_Info(ARM_Output.Small, I) :=
5409 (Defined => True,
5410 Tag => DIV,
5411 Size => -1, -- 15
5412 Font => ARM_Output.Default,
5413 Indent => Natural(I),
5414 Right_Indent => 0,
5415 Hang_Outdent => 0,
5416 Before => 0,
5417 After => 6); -- 120
5418 end loop;
5419 -- Small_Wide_Above:
5420 for I in ARM_Output.Paragraph_Indent_Type loop
5421 Paragraph_Info(ARM_Output.Small_Wide_Above, I) :=
5422 (Defined => True,
5423 Tag => DIV,
5424 Size => -1, -- 15
5425 Font => ARM_Output.Default,
5426 Indent => Natural(I),
5427 Right_Indent => 0,
5428 Hang_Outdent => 0,
5429 Before => 6,
5430 After => 6);
5431 end loop;
5432 -- Small Header:
5433 for I in ARM_Output.Paragraph_Indent_Type loop
5434 Paragraph_Info(ARM_Output.Small_Header, I) :=
5435 (Defined => True,
5436 Tag => DIV,
5437 Size => -1, -- 15
5438 Font => ARM_Output.Default,
5439 Indent => Natural(I),
5440 Right_Indent => 0,
5441 Hang_Outdent => 0,
5442 Before => 0,
5443 After => 0);
5444 end loop;
5445
5446 -- Examples:
5447 for I in ARM_Output.Paragraph_Indent_Type loop
5448 Paragraph_Info(ARM_Output.Examples, I) :=
5449 (Defined => True,
5450 Tag => DIV,
5451 Size => 0, -- 18
5452 Font => ARM_Output.Fixed,
5453 Indent => Natural(I),
5454 Right_Indent => 0,
5455 Hang_Outdent => 0,
5456 Before => 0,
5457 After => 6); -- 120
5458 end loop;
5459 -- Small Examples:
5460 for I in ARM_Output.Paragraph_Indent_Type loop
5461 Paragraph_Info(ARM_Output.Small_Examples, I) :=
5462 (Defined => True,
5463 Tag => DIV,
5464 Size => -1, -- 15
5465 Font => ARM_Output.Fixed,
5466 Indent => Natural(I),
5467 Right_Indent => 0,
5468 Hang_Outdent => 0,
5469 Before => 0,
5470 After => 6); -- 120
5471 end loop;
5472 -- Swiss Examples:
5473 for I in ARM_Output.Paragraph_Indent_Type loop
5474 Paragraph_Info(ARM_Output.Swiss_Examples, I) :=
5475 (Defined => True,
5476 Tag => DIV,
5477 Size => 0, -- 18
5478 Font => ARM_Output.Swiss,
5479 Indent => Natural(I),
5480 Right_Indent => 0,
5481 Hang_Outdent => 0,
5482 Before => 0,
5483 After => 6); -- 120
5484 end loop;
5485 -- Small Swiss Examples:
5486 for I in ARM_Output.Paragraph_Indent_Type loop
5487 Paragraph_Info(ARM_Output.Small_Swiss_Examples, I) :=
5488 (Defined => True,
5489 Tag => DIV,
5490 Size => -1, -- 15
5491 Font => ARM_Output.Swiss,
5492 Indent => Natural(I),
5493 Right_Indent => 0,
5494 Hang_Outdent => 0,
5495 Before => 0,
5496 After => 6); -- 120
5497 end loop;
5498
5499 -- Bulleted:
5500 -- Note: Indent = 0 is not allowed.
5501 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5502 Paragraph_Info(ARM_Output.Bulleted, I) :=
5503 (Defined => True,
5504 Tag => UL,
5505 Size => 0, -- 18
5506 Font => ARM_Output.Default,
5507 Indent => Natural(I),
5508 Right_Indent => 1,
5509 Hang_Outdent => 0,
5510 Before => 0,
5511 After => 5);
5512 end loop;
5513 -- Nested Bulleted:
5514 -- Note: Indent = 0 is not allowed.
5515 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5516 Paragraph_Info(ARM_Output.Nested_Bulleted, I) :=
5517 (Defined => True,
5518 Tag => UL,
5519 Size => 0, -- 18
5520 Font => ARM_Output.Default,
5521 Indent => Natural(I),
5522 Right_Indent => 1,
5523 Hang_Outdent => 0,
5524 Before => 0,
5525 After => 5);
5526 end loop;
5527 -- Small Bulleted:
5528 -- Note: Indent = 0 is not allowed.
5529 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5530 Paragraph_Info(ARM_Output.Small_Bulleted, I) :=
5531 (Defined => True,
5532 Tag => UL,
5533 Size => -1, -- 15
5534 Font => ARM_Output.Default,
5535 Indent => Natural(I),
5536 Right_Indent => 1,
5537 Hang_Outdent => 0,
5538 Before => 0,
5539 After => 5);
5540 end loop;
5541 -- Small Nested Bulleted:
5542 -- Note: Indent = 0 is not allowed.
5543 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5544 Paragraph_Info(ARM_Output.Small_Nested_Bulleted, I) :=
5545 (Defined => True,
5546 Tag => UL,
5547 Size => -1, -- 15
5548 Font => ARM_Output.Default,
5549 Indent => Natural(I),
5550 Right_Indent => 1,
5551 Hang_Outdent => 0,
5552 Before => 0,
5553 After => 5);
5554 end loop;
5555
5556 -- Enumerated:
5557 -- Note: Indent = 0 is not allowed.
5558 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5559 Paragraph_Info(ARM_Output.Enumerated, I) :=
5560 (Defined => True,
5561 Tag => DL,
5562 Size => 0, -- 18
5563 Font => ARM_Output.Default,
5564 Indent => Natural(I)-1,
5565 Right_Indent => 1,
5566 Hang_Outdent => 1,
5567 Before => 0,
5568 After => 5);
5569 end loop;
5570 -- Small Enumerated:
5571 -- Note: Indent = 0 is not allowed.
5572 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5573 Paragraph_Info(ARM_Output.Small_Enumerated, I) :=
5574 (Defined => True,
5575 Tag => DL,
5576 Size => -1, -- 15
5577 Font => ARM_Output.Default,
5578 Indent => Natural(I)-1,
5579 Right_Indent => 1,
5580 Hang_Outdent => 1,
5581 Before => 0,
5582 After => 5);
5583 end loop;
5584
5585 -- Giant Hanging
5586 -- Note: Indent < 4 is not allowed.
5587 for I in 4 .. ARM_Output.Paragraph_Indent_Type'Last loop
5588 Paragraph_Info(ARM_Output.Giant_Hanging, I) :=
5589 (Defined => True,
5590 Tag => DL,
5591 Size => 0, -- 18
5592 Font => ARM_Output.Default,
5593 Indent => Natural(I)-4,
5594 Right_Indent => 0,
5595 Hang_Outdent => 4,
5596 Before => 0,
5597 After => 6);
5598 end loop;
5599 -- Small Giant Hanging:
5600 -- Note: Indent < 4 is not allowed.
5601 for I in 4 .. ARM_Output.Paragraph_Indent_Type'Last loop
5602 Paragraph_Info(ARM_Output.Small_Giant_Hanging, I) :=
5603 (Defined => True,
5604 Tag => DL,
5605 Size => -1, -- 15
5606 Font => ARM_Output.Default,
5607 Indent => Natural(I)-4,
5608 Right_Indent => 0,
5609 Hang_Outdent => 4,
5610 Before => 0,
5611 After => 6);
5612 end loop;
5613 -- Wide Hanging
5614 -- Note: Indent < 3 is not allowed.
5615 for I in 3 .. ARM_Output.Paragraph_Indent_Type'Last loop
5616 Paragraph_Info(ARM_Output.Wide_Hanging, I) :=
5617 (Defined => True,
5618 Tag => DL,
5619 Size => 0, -- 18
5620 Font => ARM_Output.Default,
5621 Indent => Natural(I)-3,
5622 Right_Indent => 0,
5623 Hang_Outdent => 3,
5624 Before => 0,
5625 After => 6);
5626 end loop;
5627 -- Small Wide Hanging:
5628 -- Note: Indent < 3 is not allowed.
5629 for I in 3 .. ARM_Output.Paragraph_Indent_Type'Last loop
5630 Paragraph_Info(ARM_Output.Small_Wide_Hanging, I) :=
5631 (Defined => True,
5632 Tag => DL,
5633 Size => -1, -- 15
5634 Font => ARM_Output.Default,
5635 Indent => Natural(I)-3,
5636 Right_Indent => 0,
5637 Hang_Outdent => 3,
5638 Before => 0,
5639 After => 6);
5640 end loop;
5641 -- Medium Hanging
5642 -- Note: Indent < 2 is not allowed.
5643 for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
5644 Paragraph_Info(ARM_Output.Medium_Hanging, I) :=
5645 (Defined => True,
5646 Tag => DL,
5647 Size => 0, -- 18
5648 Font => ARM_Output.Default,
5649 Indent => Natural(I)-2,
5650 Right_Indent => 0,
5651 Hang_Outdent => 2,
5652 Before => 0,
5653 After => 6);
5654 end loop;
5655 -- Small Medium Hanging:
5656 -- Note: Indent < 2 is not allowed.
5657 for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
5658 Paragraph_Info(ARM_Output.Small_Medium_Hanging, I) :=
5659 (Defined => True,
5660 Tag => DL,
5661 Size => -1, -- 15
5662 Font => ARM_Output.Default,
5663 Indent => Natural(I)-2,
5664 Right_Indent => 0,
5665 Hang_Outdent => 2,
5666 Before => 0,
5667 After => 6);
5668 end loop;
5669 -- Narrow Hanging
5670 -- Note: Indent < 1 is not allowed.
5671 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5672 Paragraph_Info(ARM_Output.Narrow_Hanging, I) :=
5673 (Defined => True,
5674 Tag => DL,
5675 Size => 0, -- 18
5676 Font => ARM_Output.Default,
5677 Indent => Natural(I)-1,
5678 Right_Indent => 0,
5679 Hang_Outdent => 1,
5680 Before => 0,
5681 After => 6);
5682 end loop;
5683 -- Small Narrow Hanging:
5684 -- Note: Indent < 1 is not allowed.
5685 for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
5686 Paragraph_Info(ARM_Output.Small_Narrow_Hanging, I) :=
5687 (Defined => True,
5688 Tag => DL,
5689 Size => -1, -- 15
5690 Font => ARM_Output.Default,
5691 Indent => Natural(I)-1,
5692 Right_Indent => 0,
5693 Hang_Outdent => 1,
5694 Before => 0,
5695 After => 6);
5696 end loop;
5697 -- Hanging in Bulleted
5698 -- Note: Indent < 2 is not allowed.
5699 for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
5700 Paragraph_Info(ARM_Output.Hanging_in_Bulleted, I) :=
5701 (Defined => True,
5702 Tag => DL,
5703 Size => 0, -- 18
5704 Font => ARM_Output.Default,
5705 Indent => Natural(I)-2,
5706 Right_Indent => 1,
5707 Hang_Outdent => 2,
5708 Before => 0,
5709 After => 5);
5710 end loop;
5711 -- Small Hanging in Bulleted
5712 -- Note: Indent < 2 is not allowed.
5713 for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
5714 Paragraph_Info(ARM_Output.Small_Hanging_in_Bulleted, I) :=
5715 (Defined => True,
5716 Tag => DL,
5717 Size => -1, -- 15
5718 Font => ARM_Output.Default,
5719 Indent => Natural(I)-2,
5720 Right_Indent => 1,
5721 Hang_Outdent => 2,
5722 Before => 0,
5723 After => 5);
5724 end loop;
5725
5726 -- Index. Only define the form that we'll use.
5727 Paragraph_Info(ARM_Output.Index, 0) :=
5728 (Defined => True,
5729 Tag => DIV,
5730 Size => 0,
5731 Font => ARM_Output.Default,
5732 Indent => 0,
5733 Right_Indent => 0,
5734 Hang_Outdent => 0,
5735 Before => 0,
5736 After => 0);
5737
5738 -- Syntax Summary. Only define the form that we'll use.
5739 Paragraph_Info(ARM_Output.Syntax_Summary, 1) :=
5740 (Defined => True,
5741 Tag => DIV,
5742 Size => -1,
5743 Font => ARM_Output.Default,
5744 Indent => 1,
5745 Right_Indent => 0,
5746 Hang_Outdent => 0,
5747 Before => 0,
5748 After => 4);
5749
5750 -- Title. Only define the form that we'll use.
5751 Paragraph_Info(ARM_Output.Title, 0) :=
5752 (Defined => True,
5753 Tag => DIV,
5754 Size => 3, -- 36
5755 Font => ARM_Output.Default,
5756 Indent => 0,
5757 Right_Indent => 0,
5758 Hang_Outdent => 0,
5759 Before => 6,
5760 After => 6);
5761
5762 end ARM_HTML;