mORMot and Open Source friends
Check-in [8b77ebfa7a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{5537} fixed Delphi compilation issue
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8b77ebfa7ac5e8a36504106da2798f7866ff8af2
User & Date: ab 2020-01-08 17:12:51
Context
2020-01-09
18:32
{5538} several fixes to TPollAsynchSockets - including https://github.com/synopse/mORMot/pull/263 check-in: dea5f6eeab user: ab tags: trunk
2020-01-08
17:12
{5537} fixed Delphi compilation issue check-in: 8b77ebfa7a user: ab tags: trunk
09:26
{5536} small refactoring - no functional change check-in: 00a044bbaa user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynCommons.pas.

53667
53668
53669
53670
53671
53672
53673
53674
53675
53676
53677
53678
53679
53680
53681
53682
.....
53853
53854
53855
53856
53857
53858
53859
53860
53861
53862
53863
53864
53865
53866
53867
53868
53869
.....
53892
53893
53894
53895
53896
53897
53898
53899
53900
53901
53902
53903
53904
53905
53906
53907
53908
.....
61727
61728
61729
61730
61731
61732
61733

61734
61735
61736
61737
61738
61739
61740
61741
61742
61743
61744
    procedure ProcessHRef;
    function ProcessLink: boolean;
    procedure ProcessEmoji; {$ifdef HASINLINE}inline;{$endif}
    procedure Toggle(style: TTextWriterEscapeStyle);
    procedure SetLine(style: TTextWriterEscapeLineStyle);
    procedure EndOfParagraph;
    procedure NewMarkdownLine;
    procedure AddHtmlEscapeWiki(dest: TTextWriter; src: PUTF8Char; esc: TTextWriterHTMLEscape);
    procedure AddHtmlEscapeMarkdown(dest: TTextWriter; src: PUTF8Char; esc: TTextWriterHTMLEscape);
  end;

procedure TTextWriterEscape.Start(dest: TTextWriter; src: PUTF8Char; escape: TTextWriterHTMLEscape);
begin
  P := src;
  W := dest;
  st := [];
................................................................................
    else
      goto none;
  end;
  P := GotoNextNotSpaceSameLine(P+1);
end;

procedure TTextWriterEscape.AddHtmlEscapeWiki(dest: TTextWriter; src: PUTF8Char;
  esc: TTextWriterHTMLEscape);
begin
  Start(dest,src,esc);
  SetLine(twlParagraph);
  repeat
    case ProcessText([0,10,13,ord('*'),ord('+'),ord('`'),ord('\'),ord(':')]) of
    #0: break;
    #10,#13: begin
      EndOfParagraph;
      SetLine(twlParagraph);
................................................................................
    inc(P);
  until false;
  EndOfParagraph;
  SetLine(twlNone);
end;

procedure TTextWriterEscape.AddHtmlEscapeMarkdown(dest: TTextWriter;
  src: PUTF8Char; esc: TTextWriterHTMLEscape);
begin
  Start(dest,src,esc);
  NewMarkDownLine;
  repeat
    if lst>=twlCode4 then // no Markdown tags within code blocks
      if ProcessText([0,10,13])=#0 then
        break else begin
        if PWord(P)^=$0a0d then
          inc(P,2) else
................................................................................
begin // RTTI has shortstrings in adjacent L1 cache lines -> faster than EMOJI_TEXT[]
  result := TEmoji(FindShortStringListTrimLowerCase(EMOJI_RTTI,ord(high(TEmoji))-1,P,len)+1);
end;

function EmojiParseDots(var P: PUTF8Char; W: TTextWriter): TEmoji;
var c: PUTF8Char;
begin

  inc(P); // ignore trailing ':'
  c := P;
  if c[-2]<=' ' then begin
    result := eNone;
    if (c[1]<=' ') and (c^ in ['('..'|']) then
      result := EMOJI_AFTERDOTS[c^]; // e.g. :)
    if result=eNone then begin
      while c^ in ['a'..'z','A'..'Z','_'] do
        inc(c);
      if (c^=':') and (c[1]<=' ') then // try e.g. :joy_cat:
        result := EmojiFromText(P,c-P);






|
|







 







|

|







 







|

|







 







>



<







53667
53668
53669
53670
53671
53672
53673
53674
53675
53676
53677
53678
53679
53680
53681
53682
.....
53853
53854
53855
53856
53857
53858
53859
53860
53861
53862
53863
53864
53865
53866
53867
53868
53869
.....
53892
53893
53894
53895
53896
53897
53898
53899
53900
53901
53902
53903
53904
53905
53906
53907
53908
.....
61727
61728
61729
61730
61731
61732
61733
61734
61735
61736
61737

61738
61739
61740
61741
61742
61743
61744
    procedure ProcessHRef;
    function ProcessLink: boolean;
    procedure ProcessEmoji; {$ifdef HASINLINE}inline;{$endif}
    procedure Toggle(style: TTextWriterEscapeStyle);
    procedure SetLine(style: TTextWriterEscapeLineStyle);
    procedure EndOfParagraph;
    procedure NewMarkdownLine;
    procedure AddHtmlEscapeWiki(dest: TTextWriter; src: PUTF8Char; escape: TTextWriterHTMLEscape);
    procedure AddHtmlEscapeMarkdown(dest: TTextWriter; src: PUTF8Char; escape: TTextWriterHTMLEscape);
  end;

procedure TTextWriterEscape.Start(dest: TTextWriter; src: PUTF8Char; escape: TTextWriterHTMLEscape);
begin
  P := src;
  W := dest;
  st := [];
................................................................................
    else
      goto none;
  end;
  P := GotoNextNotSpaceSameLine(P+1);
end;

procedure TTextWriterEscape.AddHtmlEscapeWiki(dest: TTextWriter; src: PUTF8Char;
  escape: TTextWriterHTMLEscape);
begin
  Start(dest,src,escape);
  SetLine(twlParagraph);
  repeat
    case ProcessText([0,10,13,ord('*'),ord('+'),ord('`'),ord('\'),ord(':')]) of
    #0: break;
    #10,#13: begin
      EndOfParagraph;
      SetLine(twlParagraph);
................................................................................
    inc(P);
  until false;
  EndOfParagraph;
  SetLine(twlNone);
end;

procedure TTextWriterEscape.AddHtmlEscapeMarkdown(dest: TTextWriter;
  src: PUTF8Char; escape: TTextWriterHTMLEscape);
begin
  Start(dest,src,escape);
  NewMarkDownLine;
  repeat
    if lst>=twlCode4 then // no Markdown tags within code blocks
      if ProcessText([0,10,13])=#0 then
        break else begin
        if PWord(P)^=$0a0d then
          inc(P,2) else
................................................................................
begin // RTTI has shortstrings in adjacent L1 cache lines -> faster than EMOJI_TEXT[]
  result := TEmoji(FindShortStringListTrimLowerCase(EMOJI_RTTI,ord(high(TEmoji))-1,P,len)+1);
end;

function EmojiParseDots(var P: PUTF8Char; W: TTextWriter): TEmoji;
var c: PUTF8Char;
begin
  result := eNone;
  inc(P); // ignore trailing ':'
  c := P;
  if c[-2]<=' ' then begin

    if (c[1]<=' ') and (c^ in ['('..'|']) then
      result := EMOJI_AFTERDOTS[c^]; // e.g. :)
    if result=eNone then begin
      while c^ in ['a'..'z','A'..'Z','_'] do
        inc(c);
      if (c^=':') and (c[1]<=' ') then // try e.g. :joy_cat:
        result := EmojiFromText(P,c-P);

Changes to SynMustache.pas.

1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
end;

procedure ToHtml(const Value: variant; var result: variant; fmt: TTextWriterHTMLEscape;
  wiki: boolean=false);
var txt: RawUTF8;
    d: PDocVariantData;
begin
  d := _Safe(Value); // {{{MarkdownToHtml content,browserhasnoemoji,nohtmlescape}}}
  if (dvoIsArray in d^.Options) and (d^.Count>=2) then begin
    if VarIsEmptyOrNull(d^.Values[0]) then
      exit;
    VariantToUTF8(d^.Values[0],txt);
    if not VarIsVoid(d^.Values[1]) then
      exclude(fmt,heEmojiToUTF8);
    if (d^.Count=3) and not VarIsVoid(d^.Values[2]) then
      exclude(fmt,heHtmlEscape);
  end else // {{{MarkdownToHtml content}}}
    if VarIsEmptyOrNull(Value) then






|


|







1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
end;

procedure ToHtml(const Value: variant; var result: variant; fmt: TTextWriterHTMLEscape;
  wiki: boolean=false);
var txt: RawUTF8;
    d: PDocVariantData;
begin
  d := _Safe(Value); // {{{SimpleToHtml content,browserhasnoemoji,nohtmlescape}}}
  if (dvoIsArray in d^.Options) and (d^.Count>=2) then begin
    if VarIsEmptyOrNull(d^.Values[0]) then
      exit; // don't append 'null' text
    VariantToUTF8(d^.Values[0],txt);
    if not VarIsVoid(d^.Values[1]) then
      exclude(fmt,heEmojiToUTF8);
    if (d^.Count=3) and not VarIsVoid(d^.Values[2]) then
      exclude(fmt,heHtmlEscape);
  end else // {{{MarkdownToHtml content}}}
    if VarIsEmptyOrNull(Value) then

Changes to SynopseCommit.inc.

1
'1.18.5536'
|
1
'1.18.5537'