Skip to content

Commit c8edcf8

Browse files
committed
Now we process & in xml
1 parent adc87e3 commit c8edcf8

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tomboy-ng/loadnote.pas

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
3939
20171007 - enabled bullets.
4040
20171112 - added code to restore < and >
41+
2018/01/31 - and &
4142
}
4243

4344
{$mode objfpc}{$H+}
@@ -178,6 +179,12 @@ function TBLoadNote.ReplaceAngles(const Str : AnsiString) : AnsiString;
178179
Start := Index + 3;
179180
Continue;
180181
end;
182+
if '&amp;' = UTF8Copy(Str, Index, 5) then begin
183+
Result := Result + UTF8Copy(Str, Start, Index - Start) + '&';
184+
inc(Index);
185+
Start := Index + 4;
186+
Continue;
187+
end;
181188
inc(Index);
182189
end;
183190
Result := Result + UTF8Copy(Str, Start, Index - Start);

tomboy-ng/savenote.pas

+10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
previous queued format changes. Possibly. This is not robust code.
4949
2018/01/01 Yet another bug fix for BulletList(), this time I've got it !
5050
2018/01/25 Changes to support Notebooks
51+
2018/01/31 Added code to reprocess &
5152
}
5253

5354
{$mode objfpc}{$H+}
@@ -250,6 +251,7 @@ procedure TBSaveNote.BulletList(var Buff : ANSIString);
250251
end;
251252

252253
function TBSaveNote.RemoveBadCharacters(const InStr : ANSIString) : ANSIString;
254+
// It appears that Tomboy only processes <, > and &
253255
var
254256
//Res : ANSIString;
255257
Index : longint = 1;
@@ -271,6 +273,14 @@ function TBSaveNote.RemoveBadCharacters(const InStr : ANSIString) : ANSIString;
271273
Start := Index;
272274
continue;
273275
end;
276+
if InStr[Index] = '&' then begin
277+
Result := Result + UTF8Copy(InStr, Start, Index - Start);
278+
Result := Result + '&amp;';
279+
inc(Index);
280+
Start := Index;
281+
continue;
282+
end;
283+
274284
inc(Index);
275285
end;
276286
Result := Result + UTF8Copy(InStr, Start, Index - Start);

0 commit comments

Comments
 (0)