diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2021-11-09 17:05:44 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2021-11-09 17:05:44 +1300 |
commit | 36b0cbf19bd44c94bbe5aa67730347290f20628c (patch) | |
tree | d2171132faa9dc6b2ffe99e87b7bbef102c9a9c0 /src/deckdata-process.adb | |
parent | b18a53cfaea8c3cf9e838e2a1cc8000a18324234 (diff) |
Refactored packages
Diffstat (limited to 'src/deckdata-process.adb')
-rw-r--r-- | src/deckdata-process.adb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/deckdata-process.adb b/src/deckdata-process.adb new file mode 100644 index 0000000..e7756a1 --- /dev/null +++ b/src/deckdata-process.adb @@ -0,0 +1,54 @@ + + +-- This source is licensed under the Sunset License v1.0 + + +with + + Ada.Characters.Handling; + + +package body Deckdata.Process is + + + package Charhand renames Ada.Characters.Handling; + + + procedure Strip_Formatting + (Notes : in out Note_Vector) + is + procedure Strip + (Text : in out Note; + Item : in String) + is + Position : Natural; + begin + for F of Text.Fields loop + loop + Position := SU.Index + (Source => SU.Unbounded_String (F), + Pattern => Item, + Going => Ada.Strings.Forward, + Mapping => Charhand.To_Lower'Access); + exit when Position = 0; + SU.Delete (SU.Unbounded_String (F), Position, Position + Item'Length - 1); + end loop; + end loop; + end Strip; + + Formatting : array (Positive range <>) of SU.Unbounded_String := + (+"<b>", +"</b>", +"<strong>", +"</strong>", +"<i>", +"</i>", +"<em>", +"</em>", + +"<mark>", +"</mark>", +"<small>", +"</small>", +"<del>", +"</del>", + +"<ins>", +"</ins>", +"<sub>", +"</sub>", +"<sup>", +"</sup>"); + begin + for N of Notes loop + for S of Formatting loop + Strip (N, -S); + end loop; + end loop; + end Strip_Formatting; + + +end Deckdata.Process; + + |