1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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;
|