Skip to content

Commit

Permalink
Now we process & in xml
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbannon committed Jan 31, 2018
1 parent adc87e3 commit c8edcf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tomboy-ng/loadnote.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
20171007 - enabled bullets.
20171112 - added code to restore < and >
2018/01/31 - and &
}

{$mode objfpc}{$H+}
Expand Down Expand Up @@ -178,6 +179,12 @@ function TBLoadNote.ReplaceAngles(const Str : AnsiString) : AnsiString;
Start := Index + 3;
Continue;
end;
if '&amp;' = UTF8Copy(Str, Index, 5) then begin
Result := Result + UTF8Copy(Str, Start, Index - Start) + '&';
inc(Index);
Start := Index + 4;
Continue;
end;
inc(Index);
end;
Result := Result + UTF8Copy(Str, Start, Index - Start);
Expand Down
10 changes: 10 additions & 0 deletions tomboy-ng/savenote.pas
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
previous queued format changes. Possibly. This is not robust code.
2018/01/01 Yet another bug fix for BulletList(), this time I've got it !
2018/01/25 Changes to support Notebooks
2018/01/31 Added code to reprocess &
}

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

function TBSaveNote.RemoveBadCharacters(const InStr : ANSIString) : ANSIString;
// It appears that Tomboy only processes <, > and &
var
//Res : ANSIString;
Index : longint = 1;
Expand All @@ -271,6 +273,14 @@ function TBSaveNote.RemoveBadCharacters(const InStr : ANSIString) : ANSIString;
Start := Index;
continue;
end;
if InStr[Index] = '&' then begin
Result := Result + UTF8Copy(InStr, Start, Index - Start);
Result := Result + '&amp;';
inc(Index);
Start := Index;
continue;
end;

inc(Index);
end;
Result := Result + UTF8Copy(InStr, Start, Index - Start);
Expand Down

0 comments on commit c8edcf8

Please sign in to comment.