import-style-guide/source/pandoc-blocks.adb
2025-06-09 16:46:12 +02:00

60 lines
1.6 KiB
Ada

package body Pandoc.Blocks is
function Create_Block
(T : Object_Type;
Content : League.JSON.Values.JSON_Value)
return League.JSON.Values.JSON_Value
is
begin
return Create_Block (T, Empty_Attribute, Content);
end Create_Block;
function Create_Block
(T : Object_Type;
Attr : League.JSON.Values.JSON_Value;
Content : League.JSON.Values.JSON_Value)
return League.JSON.Values.JSON_Value
is
Block : League.JSON.Objects.JSON_Object;
New_Content : League.JSON.Arrays.JSON_Array;
begin
New_Content.Append (Attr);
New_Content.Append (Content);
Block.Insert
(Type_String, League.JSON.Values.To_JSON_Value( Type_To_String (T)));
Block.Insert (Content_String, New_Content);
return Block.To_JSON_Value;
end Create_Block;
function Raw_Block
(T : League.Strings.Universal_String;
Content : League.Strings.Universal_String)
return League.JSON.Values.JSON_Value
is
begin
return Raw_Block (Empty_Attribute, T, Content);
end Raw_Block;
function Raw_Block
(Attr : League.JSON.Values.JSON_Value;
T : League.Strings.Universal_String;
Content : League.Strings.Universal_String
return League.JSON.Values.JSON_Value
is
Formatted_Content : League.JSON.Arrays.JSON_Array;
begin
Formatted_Content.Append (
League.JSON.Values.To_JSON_Value (T));
Formatted_Content.Append (
League.JSON.Values.To_JSON_Value (Content));
return Create_Block (Block_RawBlock, Attr, Formatted_Content);
end Raw_Block;
end Pandoc.Blocks;