summaryrefslogtreecommitdiff
path: root/src/deckdata-process.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/deckdata-process.adb')
-rw-r--r--src/deckdata-process.adb54
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;
+
+