Change table with codeblocks to nested div's

This commit is contained in:
Folkert Kevelam 2025-05-25 20:16:02 +02:00
parent 6cb6e6bb38
commit 8d33bcc1c1
2 changed files with 20 additions and 8 deletions

View File

@ -104,7 +104,8 @@ procedure Aqs2mdx is
-- in .md -- in .md
declare declare
-- Table structure in pandoc-types-1.23.1. See -- Table structure in pandoc-types-1.23.1. See
-- https://hackage.haskell.org/package/pandoc-types-1.23.1/docs/ -- https://hackage.haskell.org/package/pandoc-types-1.23.1/
-- docs/
-- Text-Pandoc-Definition.html -- Text-Pandoc-Definition.html
-- --
-- Table: -- Table:
@ -138,6 +139,16 @@ procedure Aqs2mdx is
Cell_List : constant League.JSON.Arrays.JSON_Array := Cell_List : constant League.JSON.Arrays.JSON_Array :=
Row (2).To_Array; Row (2).To_Array;
Columns_Div : Pandoc.Content_Arr (1 .. Cell_List.Length);
Outer_Attr : constant League.JSON.Values.JSON_Value :=
Pandoc.Attr (
+"", ( 1 => +"className"), ( 1 => +"multi-column"));
Inner_Attr : constant League.JSON.Values.JSON_Value :=
Pandoc.Attr (
+"", ( 1 => +"className"), ( 1 => +"multi-column-child"));
begin begin
pragma Assert (Content.Length = 6); pragma Assert (Content.Length = 6);
pragma Assert (Table_Body_List.Length = 1); pragma Assert (Table_Body_List.Length = 1);
@ -152,16 +163,17 @@ procedure Aqs2mdx is
Cell : constant League.JSON.Arrays.JSON_Array := Cell : constant League.JSON.Arrays.JSON_Array :=
Cell_List (J).To_Array; Cell_List (J).To_Array;
Block_List : constant League.JSON.Arrays.JSON_Array := Block_List : constant League.JSON.Values.JSON_Value :=
Cell (5).To_Array; Cell (5);
begin begin
pragma Assert (Cell.Length = 5); pragma Assert (Cell.Length = 5);
for K in 1 .. Block_List.Length loop Columns_Div (J) := Pandoc.Div (Inner_Attr, Block_List);
List.Append (Block_List (K));
end loop;
end; end;
end loop; end loop;
List.Append (Pandoc.Div (Outer_Attr, Columns_Div));
end; end;
when Block_Header => when Block_Header =>
if Block (Pandoc.Content_String).To_Array.Element (1) if Block (Pandoc.Content_String).To_Array.Element (1)

View File

@ -81,7 +81,7 @@ private
return Ada.Containers.Hash_Type; return Ada.Containers.Hash_Type;
Obj_String_Representation : Obj_String_Representation :
constant array (Object_Type) of Ustr.Universal_String := [ constant array (Object_Type) of Ustr.Universal_String := (
+"Plain", +"Plain",
+"Para", +"Para",
+"LineBlock", +"LineBlock",
@ -116,7 +116,7 @@ private
+"Image", +"Image",
+"Note", +"Note",
+"Span" +"Span"
]; );
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 => Ustr.Universal_String,