96 lines
2.4 KiB
Ada
96 lines
2.4 KiB
Ada
package body Pandoc is
|
|
|
|
function Get_Type (B : League.JSON.Objects.JSON_Object)
|
|
return Object_Type is (Type_Mapping (B (Type_String).To_String));
|
|
|
|
function Type_To_String (T : Object_Type)
|
|
return League.Strings.Universal_String
|
|
is
|
|
begin
|
|
return Obj_String_Representation (T);
|
|
end Type_To_String;
|
|
|
|
function Attr
|
|
(Id : League.Strings.Universal_String;
|
|
Key : League.Strings.Universal_String;
|
|
Value : League.Strings.Universal_String)
|
|
return League.JSON.Values.JSON_Value
|
|
is
|
|
Key_Value_Pair : League.JSON.Arrays.JSON_Array;
|
|
Attr_Map : League.JSON.Arrays.JSON_Array;
|
|
Attr : League.JSON.Arrays.JSON_Array;
|
|
begin
|
|
Key_Value_Pair.Append (
|
|
League.JSON.Values.To_JSON_Value (Key));
|
|
Key_Value_Pair.Append (
|
|
League.JSON.Values.To_JSON_Value (Value));
|
|
|
|
Attr_Map.Append (Key_Value_Pair.To_JSON_Value);
|
|
|
|
Attr.Append (
|
|
League.JSON.Values.To_JSON_Value (Id));
|
|
|
|
Attr.Append (Attr_Map.To_JSON_Value);
|
|
|
|
return Attr.To_JSON_Value;
|
|
end Attr;
|
|
|
|
function Attr
|
|
(Id : League.Strings.Universal_String;
|
|
Key_Value : Key_Value_Pairs)
|
|
return League.JSON.Values.JSON_Value
|
|
is
|
|
Attr_Map : League.JSON.Arrays.JSON_Array;
|
|
Attr : League.JSON.Arrays.JSON_Array;
|
|
begin
|
|
|
|
for J in Key_Value'Range loop
|
|
declare
|
|
Pair : League.JSON.Arrays.JSON_Array;
|
|
begin
|
|
Pair.Append (
|
|
League.JSON.Values.To_JSON_Value (Key_Value (J).Key));
|
|
Pair.Append (
|
|
League.JSON.Values.To_JSON_Value (Key_Value (J).Value));
|
|
|
|
Attr_Map.Append (Pair.To_JSON_Value);
|
|
end;
|
|
end loop;
|
|
|
|
Attr.Append (
|
|
League.JSON.Values.To_JSON_Value (Id));
|
|
|
|
Attr.Append (Attr_Map.To_JSON_Value);
|
|
|
|
return Attr.To_JSON_Value;
|
|
end Attr;
|
|
|
|
function Attr
|
|
(Key : League.Strings.Universal_String;
|
|
Value : League.Strings.Universal_String)
|
|
return League.JSON.Values.JSON_Value
|
|
is
|
|
begin
|
|
return Attr (+"", Key, Value);
|
|
end Attr;
|
|
|
|
function Attr (Key_Value : Key_Value_Pairs)
|
|
return League.JSON.Values.JSON_Value
|
|
is
|
|
begin
|
|
return Attr (+"", Key_Value);
|
|
end Attr;
|
|
|
|
begin
|
|
|
|
for Key in Object_Type loop
|
|
declare
|
|
Str_Rep : constant League.Strings.Universal_String :=
|
|
Obj_String_Representation (Key);
|
|
begin
|
|
Type_Mapping.Insert (Str_Rep, Key);
|
|
end;
|
|
end loop;
|
|
|
|
end Pandoc;
|