| 1 |
with ARM_Output, |
| 2 |
ARM_Contents, |
| 3 |
Ada.Text_IO; |
| 4 |
-- private |
| 5 |
with Ada.Strings.Unbounded; |
| 6 |
package ARM_HTML is |
| 7 |
|
| 8 |
-- |
| 9 |
-- Ada reference manual formatter (ARM_Form). |
| 10 |
-- |
| 11 |
-- This package defines the HTML output object. |
| 12 |
-- Output objects are responsible for implementing the details of |
| 13 |
-- a particular format. |
| 14 |
-- |
| 15 |
-- --------------------------------------- |
| 16 |
-- Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2011, 2012, 2013, |
| 17 |
-- 2016 |
| 18 |
-- AXE Consultants. All rights reserved. |
| 19 |
-- P.O. Box 1512, Madison WI 53701 |
| 20 |
-- E-Mail: [email protected] |
| 21 |
-- |
| 22 |
-- ARM_Form is free software: you can redistribute it and/or modify |
| 23 |
-- it under the terms of the GNU General Public License version 3 |
| 24 |
-- as published by the Free Software Foundation. |
| 25 |
-- |
| 26 |
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS" |
| 27 |
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY, |
| 28 |
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL. |
| 29 |
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL, |
| 30 |
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES, |
| 31 |
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 32 |
-- DAMAGES. |
| 33 |
-- |
| 34 |
-- A copy of the GNU General Public License is available in the file |
| 35 |
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool. |
| 36 |
-- Otherwise, see <http://www.gnu.org/licenses/>. |
| 37 |
-- |
| 38 |
-- If the GPLv3 license is not satisfactory for your needs, a commercial |
| 39 |
-- use license is available for this tool. Contact Randy at AXE Consultants |
| 40 |
-- for more information. |
| 41 |
-- |
| 42 |
-- --------------------------------------- |
| 43 |
-- |
| 44 |
-- Edit History: |
| 45 |
-- |
| 46 |
-- 4/19/00 - RLB - Created base package. |
| 47 |
-- 4/21/00 - RLB - Added line break and hard space routines. |
| 48 |
-- 4/24/00 - RLB - Added DR references and Insert/Delete text formats. |
| 49 |
-- 4/25/00 - RLB - Added size to format. |
| 50 |
-- 5/10/00 - RLB - Added End_Hang_Item. |
| 51 |
-- 5/12/00 - RLB - Added No_Prefix to Start_Paragraph. |
| 52 |
-- 5/13/00 - RLB - Added Special_Character. |
| 53 |
-- 5/17/00 - RLB - Added New_Page. |
| 54 |
-- 5/22/00 - RLB - Added Includes_Changes to Create. |
| 55 |
-- 5/23/00 - RLB - Added Set_Column and New_Column. |
| 56 |
-- - Added Tab_Info and Tab_Stops. |
| 57 |
-- 5/24/00 - RLB - Added Location to Text_Format. |
| 58 |
-- - RLB - Added No_Breaks and Keep_with_Next to Start_Paragraph. |
| 59 |
-- 5/25/00 - RLB - Added Big_Files to Create. Added Justification. |
| 60 |
-- - RLB - Added Separator_Lines and TOC routines. |
| 61 |
-- 5/26/00 - RLB - Added table operations. |
| 62 |
-- 6/ 2/00 - RLB - Added Soft_Line_Break. |
| 63 |
-- 8/ 2/00 - RLB - Added Soft_Hyphen_Break. |
| 64 |
-- 8/ 7/00 - RLB - Added Leading flag to Start_Paragraph. |
| 65 |
-- 8/17/00 - RLB - Replaced "Leading" by "Space_After". |
| 66 |
-- 8/22/00 - RLB - Added Revised_Clause_Header. |
| 67 |
-- 9/27/00 - RLB - Added tab emulation when in the fixed font. |
| 68 |
-- - RLB - Added column emulation. |
| 69 |
-- 9/29/00 - RLB - Added Any_Nonspace flag. |
| 70 |
-- 7/18/01 - RLB - Added support for Big_Files. |
| 71 |
-- 7/18/02 - RLB - Removed Document parameter from Create, replaced by |
| 72 |
-- three strings and For_ISO boolean. |
| 73 |
-- - RLB - Added AI_Reference. |
| 74 |
-- - RLB - Added Change_Version_Type and uses. |
| 75 |
-- 9/10/04 - RLB - Added "Both" to possible changes to handle |
| 76 |
-- replacement of changed text. |
| 77 |
-- 9/14/04 - RLB - Moved Change_Version_Type to ARM_Contents. |
| 78 |
-- 5/27/05 - RLB - Added arbitrary Unicode characters. |
| 79 |
-- 1/11/06 - RLB - Eliminated dispatching Create in favor of tailored |
| 80 |
-- versions. |
| 81 |
-- 1/12/06 - RLB - Added a number of parameters to Create. |
| 82 |
-- 1/13/06 - RLB - Added new Link operations. |
| 83 |
-- 1/16/06 - RLB - Added Index_URL to Create. |
| 84 |
-- 1/27/06 - RLB - Added Tab_Emulation. |
| 85 |
-- 2/ 8/06 - RLB - Added additional parameters to the table command. |
| 86 |
-- 2/10/06 - RLB - Added even more additional parameters to the |
| 87 |
-- table command. |
| 88 |
-- - RLB - Added picture command. |
| 89 |
-- 2/19/06 - RLB - Added Number_Paragraphs flag and large letter count. |
| 90 |
-- 9/21/06 - RLB - Added Body_Font. |
| 91 |
-- 9/25/06 - RLB - Added Last_Column_Width to Start_Table. |
| 92 |
-- 10/13/06 - RLB - Added specifiable colors. |
| 93 |
-- - RLB - Added Local_Link_Start and Local_Link_End to allow |
| 94 |
-- formatting in the linked text. |
| 95 |
-- 2/ 9/07 - RLB - Changed comments on AI_Reference. |
| 96 |
-- 2/13/07 - RLB - Revised to separate style and indent information |
| 97 |
-- for paragraphs. |
| 98 |
-- 12/19/07 - RLB - Added DOS_Filename flag. |
| 99 |
-- - RLB - Added limited colors to Text_Format. |
| 100 |
-- 10/18/11 - RLB - Changed to GPLv3 license. |
| 101 |
-- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header. |
| 102 |
-- 8/31/12 - RLB - Added Output_Path. |
| 103 |
-- 11/26/12 - RLB - Added subdivision names to Clause_Header and |
| 104 |
-- Revised_Clause_Header. |
| 105 |
-- 3/26/13 - RLB - Added HTML_Script to allow adding Google Analytics |
| 106 |
-- code as needed. |
| 107 |
-- 4/20/16 - RLB - Added Force_New_Revision_Colors. |
| 108 |
-- 8/18/16 - RLB - Added a more column text to avoid overflow. |
| 109 |
|
| 110 |
type HTML_Output_Type is new ARM_Output.Output_Type with private; |
| 111 |
|
| 112 |
type HTML_Type is (HTML_3, -- Use only HTML 3 elements. |
| 113 |
HTML_4_Compatible, -- Use HTML 4 when needed, but try to look good on old browsers. |
| 114 |
HTML_4_Only); -- Use only HTML 4 elements (no attempt to look good on old browsers). |
| 115 |
|
| 116 |
type Tab_Emulation_Type is |
| 117 |
(Single_Space, -- Replace all tabs by a single space. |
| 118 |
Quad_Space, -- Replace all tabs by four hard spaces. |
| 119 |
Emulate_Fixed_Only, -- Emulate tabs in fixed font styles; |
| 120 |
-- replace others by a single space. |
| 121 |
Emulate_Fixed_Only_Quad,--Emulate tabs in fixed font styles; |
| 122 |
-- replace others by four hard spaces. |
| 123 |
Emulate_All); -- Replace tabs in all styles; note that |
| 124 |
-- it is unlikely that they will line |
| 125 |
-- up perfectly for non-fixed fonts. |
| 126 |
|
| 127 |
subtype Color_String is String (1..7); -- "#hhhhhh" to specify a color. |
| 128 |
|
| 129 |
procedure Create (Output_Object : in out HTML_Output_Type; |
| 130 |
Big_Files : in Boolean; |
| 131 |
File_Prefix : in String; |
| 132 |
Output_Path : in String; |
| 133 |
DOS_Filenames : in Boolean; |
| 134 |
HTML_Kind : in HTML_Type; |
| 135 |
Use_Unicode : in Boolean; |
| 136 |
Number_Paragraphs : in Boolean; |
| 137 |
Ref_URL : in String; |
| 138 |
Srch_URL : in String; |
| 139 |
Index_URL : in String; |
| 140 |
Use_Buttons : Boolean; |
| 141 |
Nav_On_Top : Boolean; |
| 142 |
Nav_On_Bottom : Boolean; |
| 143 |
Tab_Emulation : Tab_Emulation_Type; |
| 144 |
Script_HTML : String; |
| 145 |
Header_HTML : String; |
| 146 |
Footer_HTML : String; |
| 147 |
Title : in String := ""; |
| 148 |
Body_Font : ARM_Output.Font_Family_Type; |
| 149 |
Force_New_Revision_Colors : Boolean; |
| 150 |
Text_Color : Color_String; |
| 151 |
Background_Color : Color_String; |
| 152 |
Link_Color : Color_String; |
| 153 |
VLink_Color : Color_String; |
| 154 |
ALink_Color : Color_String); |
| 155 |
-- Create an Output_Object for a document. |
| 156 |
-- Generate a few large output files if |
| 157 |
-- Big_Files is True; otherwise generate smaller output files. |
| 158 |
-- The prefix of the output file names is File_Prefix - this |
| 159 |
-- should be no more than 5 characters allowed in file names. |
| 160 |
-- The files will be written into Output_Path. |
| 161 |
-- If DOS_Filename is true, use 8.3 file names; |
| 162 |
-- in that case, File_Prefix must be less than 4 characters in length; |
| 163 |
-- and no clause or subclause number may exceed 35 if Big_Files is False. |
| 164 |
-- The title of the document is Title. |
| 165 |
-- HTML_Kind determines the kind of HTML generated; HTML_3 works on |
| 166 |
-- every browser but has little control over formatting; |
| 167 |
-- HTML_4_Compatible has better control, but tries to make the results |
| 168 |
-- look good on older browsers; HTML_4_Only uses maximum formatting, |
| 169 |
-- but makes no attempt to look good on browsers older than IE 5.0 and |
| 170 |
-- Firefox 1.0. |
| 171 |
-- If Use_Unicode is true, Unicode characters available on US versions |
| 172 |
-- of Windows 2000 are used when appropriate; otherwise, Unicode |
| 173 |
-- characters are only used when explicitly requested with |
| 174 |
-- Unicode_Character (other characters are replaced with reasonable |
| 175 |
-- equivalents). [Note: It's known that IE on Windows 95/98/ME cannot |
| 176 |
-- display Unicode characters.] Use_Unicode has no effect if HTML_Kind |
| 177 |
-- is set to HTML_3. |
| 178 |
-- Number_Paragraphs means that paragraph numbers will be used; |
| 179 |
-- otherwise, the Number parameter to Start_Paragraph must be "". |
| 180 |
-- Ref_URL, Srch_URL, and Index_URL are the URLs (possibly relative) |
| 181 |
-- for the "References", "Search", and "Index" buttons/labels, |
| 182 |
-- respectively. If null, these buttons/labels link to sections named |
| 183 |
-- "References", "Search", and "Index"; if these do not exist, the |
| 184 |
-- buttons/labels are omitted. |
| 185 |
-- If Use_Buttons is true, button images are used, otherwise text labels |
| 186 |
-- are used for the navigation bar. |
| 187 |
-- If Nav_On_Top is true, the navigation bar will appear in the header |
| 188 |
-- of each page. If Nav_On_Bottom is true, the navigation bar will |
| 189 |
-- appear in the footer of each page. |
| 190 |
-- Tab_Emulation determines how tabs are emulated. |
| 191 |
-- Script_HTML gives self-contained HTML that will appear immediately |
| 192 |
-- before the </HEAD> of every page. This usually will contain |
| 193 |
-- Javascript scripts or CSS styles. The original intent was to allow |
| 194 |
-- adding the Google Analytics script to each page. |
| 195 |
-- Header_HTML gives self-contained HTML that will appear before the |
| 196 |
-- navigation bar in the header. Footer_HTML gives self-contained HTML |
| 197 |
-- that will appear after the navigation bar in the footer. |
| 198 |
-- Body_Font selects the default font for the document body. |
| 199 |
-- Text_Color specifies the default text color; Background_Color |
| 200 |
-- specifies the default background color; Link_Color specifies the |
| 201 |
-- default color of normal links; VLink_Color specifies the |
| 202 |
-- default color of visited links; and ALink_Color specifies the |
| 203 |
-- default color of active (in the act of clinking) links. |
| 204 |
|
| 205 |
|
| 206 |
procedure Close (Output_Object : in out HTML_Output_Type); |
| 207 |
-- Close an Output_Object. No further output to the object is |
| 208 |
-- allowed after this call. |
| 209 |
|
| 210 |
|
| 211 |
procedure Section (Output_Object : in out HTML_Output_Type; |
| 212 |
Section_Title : in String; |
| 213 |
Section_Name : in String); |
| 214 |
-- Start a new section. The title is Section_Title (this is |
| 215 |
-- intended for humans). The name is Section_Name (this is |
| 216 |
-- intended to be suitable to be a portion of a file name). |
| 217 |
|
| 218 |
procedure Set_Columns (Output_Object : in out HTML_Output_Type; |
| 219 |
Number_of_Columns : in ARM_Output.Column_Count); |
| 220 |
-- Set the number of columns. |
| 221 |
-- Raises Not_Valid_Error if in a paragraph. |
| 222 |
|
| 223 |
procedure Start_Paragraph (Output_Object : in out HTML_Output_Type; |
| 224 |
Style : in ARM_Output.Paragraph_Style_Type; |
| 225 |
Indent : in ARM_Output.Paragraph_Indent_Type; |
| 226 |
Number : in String; |
| 227 |
No_Prefix : in Boolean := False; |
| 228 |
Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS; |
| 229 |
No_Breaks : in Boolean := False; |
| 230 |
Keep_with_Next : in Boolean := False; |
| 231 |
Space_After : in ARM_Output.Space_After_Type |
| 232 |
:= ARM_Output.Normal; |
| 233 |
Justification : in ARM_Output.Justification_Type |
| 234 |
:= ARM_Output.Default); |
| 235 |
-- Start a new paragraph. The style and indent of the paragraph is as |
| 236 |
-- specified. The (AA)RM paragraph number (which might include update |
| 237 |
-- and version numbers as well: [12.1/1]) is Number. If the format is |
| 238 |
-- a type with a prefix (bullets, hangining items), the prefix is |
| 239 |
-- omitted if No_Prefix is true. Tab_Stops defines the tab stops for |
| 240 |
-- the paragraph. If No_Breaks is True, we will try to avoid page breaks |
| 241 |
-- in the paragraph. If Keep_with_Next is true, we will try to avoid |
| 242 |
-- separating this paragraph and the next one. (These may have no |
| 243 |
-- effect in formats that don't have page breaks). Space_After |
| 244 |
-- specifies the amount of space following the paragraph. Justification |
| 245 |
-- specifies the text justification for the paragraph. Not_Valid_Error |
| 246 |
-- is raised if Tab_Stops /= NO_TABS for a hanging or bulleted format. |
| 247 |
|
| 248 |
procedure End_Paragraph (Output_Object : in out HTML_Output_Type); |
| 249 |
-- End a paragraph. |
| 250 |
|
| 251 |
procedure Category_Header (Output_Object : in out HTML_Output_Type; |
| 252 |
Header_Text : String); |
| 253 |
-- Output a Category header (that is, "Legality Rules", |
| 254 |
-- "Dynamic Semantics", etc.) |
| 255 |
-- (Note: We did not use a enumeration here to insure that these |
| 256 |
-- headers are spelled the same in all output versions). |
| 257 |
-- Raises Not_Valid_Error if in a paragraph. |
| 258 |
|
| 259 |
procedure Clause_Header (Output_Object : in out HTML_Output_Type; |
| 260 |
Header_Text : in String; |
| 261 |
Level : in ARM_Contents.Level_Type; |
| 262 |
Clause_Number : in String; |
| 263 |
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; |
| 264 |
No_Page_Break : in Boolean := False); |
| 265 |
-- Output a Clause header. The level of the header is specified |
| 266 |
-- in Level. The Clause Number is as specified; the top-level (and |
| 267 |
-- other) subdivision names are as specified. These should appear in |
| 268 |
-- the table of contents. |
| 269 |
-- For hyperlinked formats, this should generate a link target. |
| 270 |
-- If No_Page_Break is True, suppress any page breaks. |
| 271 |
-- Raises Not_Valid_Error if in a paragraph. |
| 272 |
|
| 273 |
procedure Revised_Clause_Header |
| 274 |
(Output_Object : in out HTML_Output_Type; |
| 275 |
New_Header_Text : in String; |
| 276 |
Old_Header_Text : in String; |
| 277 |
Level : in ARM_Contents.Level_Type; |
| 278 |
Clause_Number : in String; |
| 279 |
Version : in ARM_Contents.Change_Version_Type; |
| 280 |
Old_Version : in ARM_Contents.Change_Version_Type; |
| 281 |
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind; |
| 282 |
No_Page_Break : in Boolean := False); |
| 283 |
-- Output a revised clause header. Both the original and new text will |
| 284 |
-- be output. The level of the header is specified in Level. The Clause |
| 285 |
-- Number is as specified; the top-level (and other) subdivision names |
| 286 |
-- are as specified. These should appear in the table of contents. |
| 287 |
-- For hyperlinked formats, this should generate a link target. |
| 288 |
-- Version is the insertion version of the new text; Old_Version is |
| 289 |
-- the insertion version of the old text. |
| 290 |
-- If No_Page_Break is True, suppress any page breaks. |
| 291 |
-- Raises Not_Valid_Error if in a paragraph. |
| 292 |
|
| 293 |
procedure TOC_Marker (Output_Object : in out HTML_Output_Type; |
| 294 |
For_Start : in Boolean); |
| 295 |
-- Mark the start (if For_Start is True) or end (if For_Start is |
| 296 |
-- False) of the table of contents data. Output objects that |
| 297 |
-- auto-generate the table of contents can use this to do needed |
| 298 |
-- actions. |
| 299 |
|
| 300 |
procedure New_Page (Output_Object : in out HTML_Output_Type; |
| 301 |
Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page); |
| 302 |
-- Output a page break. |
| 303 |
-- Note that this has no effect on non-printing formats. |
| 304 |
-- Any_Page breaks to the top of the next page (whatever it is); |
| 305 |
-- Odd_Page_Only breaks to the top of the odd-numbered page; |
| 306 |
-- Soft_Page allows a page break but does not force one (use in |
| 307 |
-- "No_Breaks" paragraphs.) |
| 308 |
-- Raises Not_Valid_Error if in a paragraph if Kind = Any_Page or |
| 309 |
-- Odd_Page, and if not in a paragraph if Kind = Soft_Page. |
| 310 |
|
| 311 |
procedure New_Column (Output_Object : in out HTML_Output_Type); |
| 312 |
-- Output a column break. |
| 313 |
-- Raises Not_Valid_Error if in a paragraph, or if the number of |
| 314 |
-- columns is 1. |
| 315 |
|
| 316 |
procedure Separator_Line (Output_Object : in out HTML_Output_Type; |
| 317 |
Is_Thin : Boolean := True); |
| 318 |
-- Output a separator line. It is thin if "Is_Thin" is true. |
| 319 |
-- Raises Not_Valid_Error if in a paragraph. |
| 320 |
|
| 321 |
procedure Start_Table (Output_Object : in out HTML_Output_Type; |
| 322 |
Columns : in ARM_Output.Column_Count; |
| 323 |
First_Column_Width : in ARM_Output.Column_Count; |
| 324 |
Last_Column_Width : in ARM_Output.Column_Count; |
| 325 |
Alignment : in ARM_Output.Column_Text_Alignment; |
| 326 |
No_Page_Break : in Boolean; |
| 327 |
Has_Border : in Boolean; |
| 328 |
Small_Text_Size : in Boolean; |
| 329 |
Header_Kind : in ARM_Output.Header_Kind_Type); |
| 330 |
-- Starts a table. The number of columns is Columns; the first |
| 331 |
-- column has First_Column_Width times the normal column width, and |
| 332 |
-- the last column has Last_Column_Width times the normal column width. |
| 333 |
-- Alignment is the horizontal text alignment within the columns. |
| 334 |
-- No_Page_Break should be True to keep the table intact on a single |
| 335 |
-- page; False to allow it to be split across pages. |
| 336 |
-- Has_Border should be true if a border is desired, false otherwise. |
| 337 |
-- Small_Text_Size means that the contents will have the AARM size; |
| 338 |
-- otherwise it will have the normal size. |
| 339 |
-- Header_Kind determines whether the table has headers. |
| 340 |
-- This command starts a paragraph; the entire table is a single |
| 341 |
-- paragraph. Text will be considered part of the caption until the |
| 342 |
-- next table marker call. |
| 343 |
-- Raises Not_Valid_Error if in a paragraph. |
| 344 |
|
| 345 |
procedure Table_Marker (Output_Object : in out HTML_Output_Type; |
| 346 |
Marker : in ARM_Output.Table_Marker_Type); |
| 347 |
-- Marks the end of an entity in a table. |
| 348 |
-- If Marker is End_Caption, the table caption ends and the |
| 349 |
-- future text is part of the table header. |
| 350 |
-- If Marker is End_Header, the table header ends and the |
| 351 |
-- future text is part of the table body. |
| 352 |
-- If Marker is End_Row, a row in the table is completed, and another |
| 353 |
-- row started. |
| 354 |
-- If Marker is End_Item, an item in the table header or body is ended, |
| 355 |
-- and another started. |
| 356 |
-- If Marker is End_Table, the entire table is finished. |
| 357 |
-- Raises Not_Valid_Error if not in a table. |
| 358 |
|
| 359 |
-- Text output: These are only allowed after a Start_Paragraph and |
| 360 |
-- before any End_Paragraph. Raises Not_Valid_Error if not in a paragraph, |
| 361 |
-- or another error. |
| 362 |
|
| 363 |
procedure Ordinary_Text (Output_Object : in out HTML_Output_Type; |
| 364 |
Text : in String); |
| 365 |
-- Output ordinary text. |
| 366 |
-- The text must end at a word break, never in the middle of a word. |
| 367 |
|
| 368 |
procedure Ordinary_Character (Output_Object : in out HTML_Output_Type; |
| 369 |
Char : in Character); |
| 370 |
-- Output an ordinary character. |
| 371 |
-- Spaces will be used to break lines as needed. |
| 372 |
|
| 373 |
procedure Hard_Space (Output_Object : in out HTML_Output_Type); |
| 374 |
-- Output a hard space. No line break should happen at a hard space. |
| 375 |
|
| 376 |
procedure Line_Break (Output_Object : in out HTML_Output_Type); |
| 377 |
-- Output a line break. This does not start a new paragraph. |
| 378 |
-- This corresponds to a "<BR>" in HTML. |
| 379 |
|
| 380 |
procedure Index_Line_Break (Output_Object : in out HTML_Output_Type; |
| 381 |
Clear_Keep_with_Next : in Boolean); |
| 382 |
-- Output a line break for the index. This does not start a new |
| 383 |
-- paragraph in terms of spacing. This corresponds to a "<BR>" |
| 384 |
-- in HTML. If Clear_Keep_with_Next is true, insure that the next |
| 385 |
-- line does not require the following line to stay with it. |
| 386 |
-- Raises Not_Valid_Error if the paragraph is not in the index format. |
| 387 |
|
| 388 |
procedure Soft_Line_Break (Output_Object : in out HTML_Output_Type); |
| 389 |
-- Output a soft line break. This is a place (in the middle of a |
| 390 |
-- "word") that we allow a line break. It is usually used after |
| 391 |
-- underscores in long non-terminals. |
| 392 |
|
| 393 |
procedure Soft_Hyphen_Break (Output_Object : in out HTML_Output_Type); |
| 394 |
-- Output a soft line break, with a hyphen. This is a place (in the middle of |
| 395 |
-- a "word") that we allow a line break. If the line break is used, |
| 396 |
-- a hyphen will be added to the text. |
| 397 |
|
| 398 |
procedure Tab (Output_Object : in out HTML_Output_Type); |
| 399 |
-- Output a tab, inserting space up to the next tab stop. |
| 400 |
-- Raises Not_Valid_Error if the paragraph was created with |
| 401 |
-- Tab_Stops = ARM_Output.NO_TABS. |
| 402 |
|
| 403 |
procedure Special_Character (Output_Object : in out HTML_Output_Type; |
| 404 |
Char : in ARM_Output.Special_Character_Type); |
| 405 |
-- Output an special character. |
| 406 |
|
| 407 |
procedure Unicode_Character (Output_Object : in out HTML_Output_Type; |
| 408 |
Char : in ARM_Output.Unicode_Type); |
| 409 |
-- Output a Unicode character, with code position Char. |
| 410 |
|
| 411 |
procedure End_Hang_Item (Output_Object : in out HTML_Output_Type); |
| 412 |
-- Marks the end of a hanging item. Call only once per paragraph. |
| 413 |
-- Raises Not_Valid_Error if the paragraph style is not in |
| 414 |
-- Text_Prefixed_Style_Subtype, or if this has already been |
| 415 |
-- called for the current paragraph, or if the paragraph was started |
| 416 |
-- with No_Prefix = True. |
| 417 |
|
| 418 |
procedure Text_Format (Output_Object : in out HTML_Output_Type; |
| 419 |
Format : in ARM_Output.Format_Type); |
| 420 |
-- Change the text format so that all of the properties are as specified. |
| 421 |
-- Note: Changes to these properties ought be stack-like; that is, |
| 422 |
-- Bold on, Italic on, Italic off, Bold off is OK; Bold on, Italic on, |
| 423 |
-- Bold off, Italic off should be avoided (as separate commands). |
| 424 |
|
| 425 |
procedure Clause_Reference (Output_Object : in out HTML_Output_Type; |
| 426 |
Text : in String; |
| 427 |
Clause_Number : in String); |
| 428 |
-- Generate a reference to a clause in the standard. The text of |
| 429 |
-- the reference is "text", and the number of the clause is |
| 430 |
-- Clause_Number. For hyperlinked formats, this should generate |
| 431 |
-- a link; for other formats, the text alone is generated. |
| 432 |
|
| 433 |
procedure Index_Target (Output_Object : in out HTML_Output_Type; |
| 434 |
Index_Key : in Natural); |
| 435 |
-- Generate a index target. This marks the location where an index |
| 436 |
-- reference occurs. Index_Key names the index item involved. |
| 437 |
-- For hyperlinked formats, this should generate a link target; |
| 438 |
-- for other formats, nothing is generated. |
| 439 |
|
| 440 |
procedure Index_Reference (Output_Object : in out HTML_Output_Type; |
| 441 |
Text : in String; |
| 442 |
Index_Key : in Natural; |
| 443 |
Clause_Number : in String); |
| 444 |
-- Generate a reference to an index target in the standard. The text |
| 445 |
-- of the reference is "Text", and Index_Key and Clause_Number denotes |
| 446 |
-- the target. For hyperlinked formats, this should generate |
| 447 |
-- a link; for other formats, the text alone is generated. |
| 448 |
|
| 449 |
procedure DR_Reference (Output_Object : in out HTML_Output_Type; |
| 450 |
Text : in String; |
| 451 |
DR_Number : in String); |
| 452 |
-- Generate a reference to an DR from the standard. The text |
| 453 |
-- of the reference is "Text", and DR_Number denotes |
| 454 |
-- the target. For hyperlinked formats, this should generate |
| 455 |
-- a link; for other formats, the text alone is generated. |
| 456 |
|
| 457 |
procedure AI_Reference (Output_Object : in out HTML_Output_Type; |
| 458 |
Text : in String; |
| 459 |
AI_Number : in String); |
| 460 |
-- Generate a reference to an AI from the standard. The text |
| 461 |
-- of the reference is "Text", and AI_Number denotes |
| 462 |
-- the target (in folded format). For hyperlinked formats, this should |
| 463 |
-- generate a link; for other formats, the text alone is generated. |
| 464 |
|
| 465 |
procedure Local_Target (Output_Object : in out HTML_Output_Type; |
| 466 |
Text : in String; |
| 467 |
Target : in String); |
| 468 |
-- Generate a local target. This marks the potential target of local |
| 469 |
-- links identified by "Target". Text is the text of the target. |
| 470 |
-- For hyperlinked formats, this should generate a link target; |
| 471 |
-- for other formats, only the text is generated. |
| 472 |
|
| 473 |
procedure Local_Link (Output_Object : in out HTML_Output_Type; |
| 474 |
Text : in String; |
| 475 |
Target : in String; |
| 476 |
Clause_Number : in String); |
| 477 |
-- Generate a local link to the target and clause given. |
| 478 |
-- Text is the text of the link. |
| 479 |
-- For hyperlinked formats, this should generate a link; |
| 480 |
-- for other formats, only the text is generated. |
| 481 |
|
| 482 |
procedure Local_Link_Start (Output_Object : in out HTML_Output_Type; |
| 483 |
Target : in String; |
| 484 |
Clause_Number : in String); |
| 485 |
-- Generate a local link to the target and clause given. |
| 486 |
-- The link will surround text until Local_Link_End is called. |
| 487 |
-- Local_Link_End must be called before this routine can be used again. |
| 488 |
-- For hyperlinked formats, this should generate a link; |
| 489 |
-- for other formats, only the text is generated. |
| 490 |
|
| 491 |
procedure Local_Link_End (Output_Object : in out HTML_Output_Type; |
| 492 |
Target : in String; |
| 493 |
Clause_Number : in String); |
| 494 |
-- End a local link for the target and clause given. |
| 495 |
-- This must be in the same paragraph as the Local_Link_Start. |
| 496 |
-- For hyperlinked formats, this should generate a link; |
| 497 |
-- for other formats, only the text is generated. |
| 498 |
|
| 499 |
procedure URL_Link (Output_Object : in out HTML_Output_Type; |
| 500 |
Text : in String; |
| 501 |
URL : in String); |
| 502 |
-- Generate a link to the URL given. |
| 503 |
-- Text is the text of the link. |
| 504 |
-- For hyperlinked formats, this should generate a link; |
| 505 |
-- for other formats, only the text is generated. |
| 506 |
|
| 507 |
procedure Picture (Output_Object : in out HTML_Output_Type; |
| 508 |
Name : in String; |
| 509 |
Descr : in String; |
| 510 |
Alignment : in ARM_Output.Picture_Alignment; |
| 511 |
Height, Width : in Natural; |
| 512 |
Border : in ARM_Output.Border_Kind); |
| 513 |
-- Generate a picture. |
| 514 |
-- Name is the (simple) file name of the picture; Descr is a |
| 515 |
-- descriptive name for the picture (it will appear in some web |
| 516 |
-- browsers). |
| 517 |
-- We assume that it is a .PNG or .JPG and that it will be present |
| 518 |
-- in the same directory as the output files. |
| 519 |
-- Alignment specifies the picture alignment. |
| 520 |
-- Height and Width specify the picture size in pixels. |
| 521 |
-- Border specifies the kind of border. |
| 522 |
|
| 523 |
private |
| 524 |
|
| 525 |
type Column_Text_Item_Type; |
| 526 |
type Column_Text_Ptr is access Column_Text_Item_Type; |
| 527 |
type Column_Text_Item_Type is record |
| 528 |
Text : String (1..240); |
| 529 |
Length : Natural; |
| 530 |
Item : Natural; -- Which item. |
| 531 |
End_Para : Boolean; -- True if this item is an end paragraph. |
| 532 |
Next : Column_Text_Ptr; |
| 533 |
end record; |
| 534 |
type Column_Text_Ptrs_Type is array (1..5) of Column_Text_Ptr; |
| 535 |
|
| 536 |
subtype Prefix_String is String(1..5); |
| 537 |
type HTML_Output_Type is new ARM_Output.Output_Type with record |
| 538 |
Is_Valid : Boolean := False; |
| 539 |
|
| 540 |
-- Global properties: |
| 541 |
File_Prefix : Prefix_String; -- Blank padded. |
| 542 |
Output_Path : Ada.Strings.Unbounded.Unbounded_String; |
| 543 |
Big_Files : Boolean; -- For HTML, this means to generate a single monster file. |
| 544 |
DOS_Filenames : Boolean; -- Generate 8.3 MS-DOS filenames. |
| 545 |
Title : Ada.Strings.Unbounded.Unbounded_String; |
| 546 |
HTML_Kind : HTML_Type; |
| 547 |
Use_Unicode : Boolean; |
| 548 |
Number_Paragraphs : Boolean; |
| 549 |
Ref_URL : Ada.Strings.Unbounded.Unbounded_String; |
| 550 |
Srch_URL : Ada.Strings.Unbounded.Unbounded_String; |
| 551 |
Index_URL : Ada.Strings.Unbounded.Unbounded_String; |
| 552 |
Use_Buttons : Boolean := True; |
| 553 |
Nav_On_Top : Boolean := True; |
| 554 |
Nav_On_Bottom : Boolean := True; |
| 555 |
Tab_Emulation : Tab_Emulation_Type; |
| 556 |
Script_HTML : Ada.Strings.Unbounded.Unbounded_String; |
| 557 |
Header_HTML : Ada.Strings.Unbounded.Unbounded_String; |
| 558 |
Footer_HTML : Ada.Strings.Unbounded.Unbounded_String; |
| 559 |
Body_Font : ARM_Output.Font_Family_Type := ARM_Output.Roman; |
| 560 |
Force_New_Revision_Colors : Boolean; |
| 561 |
Text_Color : Color_String; |
| 562 |
Background_Color : Color_String; |
| 563 |
Link_Color : Color_String; |
| 564 |
VLink_Color : Color_String; |
| 565 |
ALink_Color : Color_String; |
| 566 |
|
| 567 |
-- Current formatting properties: |
| 568 |
Is_In_Paragraph : Boolean := False; |
| 569 |
Paragraph_Style : ARM_Output.Paragraph_Style_Type; |
| 570 |
Paragraph_Indent : ARM_Output.Paragraph_Indent_Type; |
| 571 |
Had_Prefix : Boolean := False; -- If in paragraph, value of not No_Prefix. |
| 572 |
Column_Count : ARM_Output.Column_Count := 1; |
| 573 |
Output_File : Ada.Text_IO.File_Type; |
| 574 |
Section_Name : String(1..3); |
| 575 |
Char_Count : Natural := 0; -- Characters on current line. |
| 576 |
Disp_Char_Count : Natural := 0; -- Displayed characters on current line. |
| 577 |
Disp_Large_Char_Count : Natural := 0; -- Displayed large characters on current line (others are "small" characters). |
| 578 |
-- Large characters are capitals, 'm', 'w', and numbers. |
| 579 |
Any_Nonspace : Boolean := False; -- Have we output any non-space on this line? |
| 580 |
Last_was_Space : Boolean := False; -- True if the last visible character |
| 581 |
-- output was a space (any kind), or this is the |
| 582 |
-- start of a line. |
| 583 |
Conditional_Space : Boolean := False; -- If True, output a space if the |
| 584 |
-- next *visible* character is not a space or |
| 585 |
-- punctuation. |
| 586 |
Saw_Hang_End : Boolean := False; -- If we are in a hanging paragraph, |
| 587 |
-- have we seen the end of the hanging part yet? |
| 588 |
Is_Bold : Boolean; -- Is the text currently bold? |
| 589 |
Is_Italic : Boolean; -- Is the text current italics? |
| 590 |
Font : ARM_Output.Font_Family_Type; -- What is the current font family? |
| 591 |
Size : ARM_Output.Size_Type; -- What is the current relative size? |
| 592 |
Color : ARM_Output.Color_Type := ARM_Output.Default; |
| 593 |
Change : ARM_Output.Change_Type := ARM_Output.None; |
| 594 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 595 |
Added_Version : ARM_Contents.Change_Version_Type := '0'; |
| 596 |
Location : ARM_Output.Location_Type := ARM_Output.Normal; |
| 597 |
Tab_Stops : ARM_Output.Tab_Info := ARM_Output.NO_TABS; |
| 598 |
Can_Emulate_Tabs : Boolean := False; -- Can we emulate tabs in the current style? |
| 599 |
|
| 600 |
Is_In_Table : Boolean := False; -- Are we processing a table? |
| 601 |
In_Header : Boolean := False; -- If Is_In_Table, are we processing the header? |
| 602 |
Table_Column_Alignment : ARM_Output.Column_Text_Alignment; -- If Is_In_Table, specifies the column alignment. |
| 603 |
Table_Has_Small_Text : Boolean := False; -- If Is_In_Table, specifies the text size. |
| 604 |
|
| 605 |
Current_Column : Natural := 0; -- When processing 4-column+ text, the current column number. |
| 606 |
Current_Item : Natural := 0; -- When processing 4-column+ text, the current item within the column. |
| 607 |
Column_Text : Column_Text_Ptrs_Type := (others => null); |
| 608 |
-- If we are processing 4-column+ text, the text for the columns. |
| 609 |
|
| 610 |
In_Local_Link : Boolean := False; |
| 611 |
|
| 612 |
Current_Clause : Ada.Strings.Unbounded.Unbounded_String; |
| 613 |
-- The name of the clause of the currently open file (for |
| 614 |
-- Big_Files = False); used to generate the navigation bar. |
| 615 |
end record; |
| 616 |
|
| 617 |
end ARM_HTML; |