Avoid abbreviations

This commit is contained in:
Maxim Reznik 2025-05-31 14:20:27 +03:00
parent 1eb07a262c
commit 1a75f9620f
3 changed files with 83 additions and 88 deletions

View File

@ -142,12 +142,10 @@ procedure Aqs2mdx is
Columns_Div : Pandoc.Content_Arr (1 .. Cell_List.Length); Columns_Div : Pandoc.Content_Arr (1 .. Cell_List.Length);
Outer_Attr : constant League.JSON.Values.JSON_Value := Outer_Attr : constant League.JSON.Values.JSON_Value :=
Pandoc.Attr ( Pandoc.Attr (+"className", +"multi-column");
+"", ( 1 => +"className"), ( 1 => +"multi-column"));
Inner_Attr : constant League.JSON.Values.JSON_Value := Inner_Attr : constant League.JSON.Values.JSON_Value :=
Pandoc.Attr ( Pandoc.Attr (+"className", +"multi-column-child");
+"", ( 1 => +"className"), ( 1 => +"multi-column-child"));
begin begin
pragma Assert (Content.Length = 6); pragma Assert (Content.Length = 6);

View File

@ -1,11 +1,21 @@
pragma Ada_2022;
with League.JSON.Arrays; with League.JSON.Arrays;
package body Pandoc is package body Pandoc is
function Attr ( function Attr
Id : Ustr.Universal_String; (Key : League.Strings.Universal_String;
Key : Ustr_Array; Value : League.Strings.Universal_String;
Value : Ustr_Array) return League.JSON.Values.JSON_Value Id : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String)
return League.JSON.Values.JSON_Value is
(Attr (Id, [Key], [Value]));
function Attr
(Id : League.Strings.Universal_String;
Key : String_Array;
Value : String_Array) return League.JSON.Values.JSON_Value
is is
Outer : League.JSON.Arrays.JSON_Array; Outer : League.JSON.Arrays.JSON_Array;
Other : League.JSON.Arrays.JSON_Array; Other : League.JSON.Arrays.JSON_Array;
@ -59,8 +69,8 @@ package body Pandoc is
return Block.To_JSON_Value; return Block.To_JSON_Value;
end Div; end Div;
function Div ( function Div
Attr : League.JSON.Values.JSON_Value; (Attr : League.JSON.Values.JSON_Value;
Content : League.JSON.Values.JSON_Value) Content : League.JSON.Values.JSON_Value)
return League.JSON.Values.JSON_Value return League.JSON.Values.JSON_Value
is is
@ -86,26 +96,13 @@ package body Pandoc is
end Div; end Div;
function Get_Type (B : League.JSON.Objects.JSON_Object) function Get_Type (B : League.JSON.Objects.JSON_Object)
return Object_Type is return Object_Type is (Type_Mapping (B (Type_String).To_String));
begin
return Type_Map.Element (
Type_Mapping.Find (
B (Type_String).To_String
)
);
end Get_Type;
function Hash (Item : Ustr.Universal_String)
return Ada.Containers.Hash_Type is
begin
return Ada.Containers.Hash_Type (League.Hash_Type'(Item.Hash));
end Hash;
begin begin
for Key in Object_Type loop for Key in Object_Type loop
declare declare
Str_Rep : constant Ustr.Universal_String := Str_Rep : constant League.Strings.Universal_String :=
Obj_String_Representation (Key); Obj_String_Representation (Key);
begin begin
Type_Mapping.Insert (Str_Rep, Key); Type_Mapping.Insert (Str_Rep, Key);

View File

@ -1,87 +1,87 @@
with Ada.Containers; with Ada.Containers;
with Ada.Containers.Hashed_Maps; with Ada.Containers.Hashed_Maps;
with League.JSON.Objects; with League.JSON.Objects;
with League.Strings.Hash;
with League.Strings; with League.Strings;
with League.JSON.Values; with League.JSON.Values;
package Pandoc is package Pandoc is
Pandoc_Type_Error : exception; type String_Array is array (Natural range <>) of
League.Strings.Universal_String;
package Ustr renames League.Strings; type Object_Type is
(Block_Plain,
type Ustr_Array is array (Natural range <>) of Ustr.Universal_String; Block_Para,
Block_LineBlock,
type Object_Type is ( Block_CodeBlock,
Block_Plain, Block_RawBlock,
Block_Para, Block_BlockQuote,
Block_LineBlock, Block_OrderedList,
Block_CodeBlock, Block_BulletList,
Block_RawBlock, Block_DefinitionList,
Block_BlockQuote, Block_Header,
Block_OrderedList, Block_HorizontalRule,
Block_BulletList, Block_Table,
Block_DefinitionList, Block_Figure,
Block_Header, Block_Div,
Block_HorizontalRule, Inline_String,
Block_Table, Inline_Emph,
Block_Figure, Inline_Underline,
Block_Div, Inline_Strong,
Inline_String, Inline_Strikeout,
Inline_Emph, Inline_Superscript,
Inline_Underline, Inline_Subscript,
Inline_Strong, Inline_SmallCaps,
Inline_Strikeout, Inline_Quoted,
Inline_Superscript, Inline_Cite,
Inline_Subscript, Inline_Code,
Inline_SmallCaps, Inline_Space,
Inline_Quoted, Inline_SoftBreak,
Inline_Cite, Inline_LineBreak,
Inline_Code, Inline_Math,
Inline_Space, Inline_RawInline,
Inline_SoftBreak, Inline_Link,
Inline_LineBreak, Inline_Image,
Inline_Math, Inline_Note,
Inline_RawInline, Inline_Span);
Inline_Link,
Inline_Image,
Inline_Note,
Inline_Span
);
type Content_Arr is array (Natural range <>) type Content_Arr is array (Natural range <>)
of League.JSON.Values.JSON_Value; of League.JSON.Values.JSON_Value;
function Get_Type ( function Get_Type (B : League.JSON.Objects.JSON_Object) return Object_Type;
B : League.JSON.Objects.JSON_Object) return Object_Type;
function "+" (T : Wide_Wide_String) return Ustr.Universal_String function "+" (T : Wide_Wide_String) return League.Strings.Universal_String
renames Ustr.To_Universal_String; renames League.Strings.To_Universal_String;
function Attr ( function Attr
Id : Ustr.Universal_String; (Key : League.Strings.Universal_String;
Key : Ustr_Array; Value : League.Strings.Universal_String;
Value : Ustr_Array) return League.JSON.Values.JSON_Value; Id : League.Strings.Universal_String :=
League.Strings.Empty_Universal_String)
return League.JSON.Values.JSON_Value;
function Div ( function Attr
Attr : League.JSON.Values.JSON_Value; (Id : League.Strings.Universal_String;
Key : String_Array;
Value : String_Array) return League.JSON.Values.JSON_Value;
function Div
(Attr : League.JSON.Values.JSON_Value;
Content : Content_Arr) return League.JSON.Values.JSON_Value; Content : Content_Arr) return League.JSON.Values.JSON_Value;
function Div ( function Div
Attr : League.JSON.Values.JSON_Value; (Attr : League.JSON.Values.JSON_Value;
Content : League.JSON.Values.JSON_Value) Content : League.JSON.Values.JSON_Value)
return League.JSON.Values.JSON_Value; return League.JSON.Values.JSON_Value;
Type_String : constant Ustr.Universal_String := +"t"; Type_String : constant League.Strings.Universal_String := +"t";
Content_String : constant Ustr.Universal_String := +"c"; Content_String : constant League.Strings.Universal_String := +"c";
private private
function Hash (Item : Ustr.Universal_String)
return Ada.Containers.Hash_Type;
Obj_String_Representation : Obj_String_Representation :
constant array (Object_Type) of Ustr.Universal_String := ( constant array (Object_Type) of League.Strings.Universal_String := (
+"Plain", +"Plain",
+"Para", +"Para",
+"LineBlock", +"LineBlock",
@ -119,10 +119,10 @@ private
); );
package Type_Map is new Ada.Containers.Hashed_Maps ( package Type_Map is new Ada.Containers.Hashed_Maps (
Key_Type => Ustr.Universal_String, Key_Type => League.Strings.Universal_String,
Element_Type => Object_Type, Element_Type => Object_Type,
Hash => Hash, Hash => League.Strings.Hash,
Equivalent_Keys => Ustr."="); Equivalent_Keys => League.Strings."=");
Type_Mapping : Type_Map.Map := Type_Map.Empty; Type_Mapping : Type_Map.Map := Type_Map.Empty;