Skip to content

Commit

Permalink
published TSynMustache.Tags property
Browse files Browse the repository at this point in the history
- and other comments enhancements
  • Loading branch information
Arnaud Bouchez committed Jul 21, 2023
1 parent 9472f88 commit a2adff6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion src/core/mormot.core.mustache.pas
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ TSynMustacheTag = record
/// the kind of the tag
Kind: TSynMustacheTagKind;
/// if the Value has an included ' ' within, i.e. could be an helper
// - equals PosExChar(' ', Value)
ValueSpace: byte;
/// the tag content, excluding trailing {{ }} and corresponding symbol
// - is not set for mtText nor mtSetDelimiter
Expand Down Expand Up @@ -241,6 +242,8 @@ TSynMustacheContextData = class;

/// handle {{mustache}} template rendering context from RTTI and variables
// - the context is given via our RTTI information
// - performance is somewhat higher than TSynMustacheContextVariant because
// less computation is needed for filling the TDocVariant data
TSynMustacheContextData = class(TSynMustacheContext)
protected
fContext: array of record
Expand Down Expand Up @@ -562,10 +565,14 @@ TSynMustache = class
const OnTranslate: TOnStringTranslate = nil;
EscapeInvert: boolean = false): RawUtf8;

/// read-only access to the raw {{mustache}} template content
/// read-only access to the raw UTF-8 {{mustache}} template content
property Template: RawUtf8
read fTemplate;
/// read-only access to the internal representation of the template
property Tags: TSynMustacheTagDynArray
read fTags;
/// the maximum possible number of nested contexts
// - i.e. the depth of nested {{#....}} {{/....}} sections
property SectionMaxCount: Integer
read fSectionMaxCount;
end;
Expand Down
14 changes: 7 additions & 7 deletions src/core/mormot.core.text.pas
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,12 @@ TTextWriter = class
// - this won't escape the text as expected by JSON
procedure AddTrimSpaces(const Text: RawUtf8); overload;
{$ifdef HASINLINE}inline;{$endif}
/// append a UTF-8 String excluding any space or control char
/// append a #0-terminated UTF-8 buffer excluding any space or control char
// - this won't escape the text as expected by JSON
procedure AddTrimSpaces(P: PUtf8Char); overload;
/// append some chars, replacing a given character with another
/// append some UTF-8 chars, replacing a given character with another
procedure AddReplace(Text: PUtf8Char; Orig, Replaced: AnsiChar);
/// append some chars, quoting all " chars
/// append some UTF-8 chars, quoting all " chars
// - same algorithm than AddString(QuotedStr()) - without memory allocation,
// and with an optional maximum text length (truncated with ending '...')
// - this function implements what is specified in the official SQLite3
Expand All @@ -724,18 +724,18 @@ TTextWriter = class
// putting two single quotes in a row - as in Pascal."
procedure AddQuotedStr(Text: PUtf8Char; TextLen: PtrUInt; Quote: AnsiChar;
TextMaxLen: PtrInt = 0);
/// append some chars, escaping all HTML special chars as expected
/// append some UTF-8 chars, escaping all HTML special chars as expected
procedure AddHtmlEscape(Text: PUtf8Char; Fmt: TTextWriterHtmlFormat = hfAnyWhere); overload;
/// append some chars, escaping all HTML special chars as expected
/// append some UTF-8 chars, escaping all HTML special chars as expected
procedure AddHtmlEscape(Text: PUtf8Char; TextLen: PtrInt;
Fmt: TTextWriterHtmlFormat = hfAnyWhere); overload;
/// append some UTF-16chars, escaping all HTML special chars as expected
/// append some UTF-16 chars, escaping all HTML special chars as expected
procedure AddHtmlEscapeW(Text: PWideChar;
Fmt: TTextWriterHtmlFormat = hfAnyWhere); overload;
/// append some VCL/LCL chars, escaping all HTML special chars as expected
procedure AddHtmlEscapeString(const Text: string;
Fmt: TTextWriterHtmlFormat = hfAnyWhere);
/// append some chars, escaping all HTML special chars as expected
/// append some UTF-8 chars, escaping all HTML special chars as expected
procedure AddHtmlEscapeUtf8(const Text: RawUtf8;
Fmt: TTextWriterHtmlFormat = hfAnyWhere);
/// append some chars, escaping all XML special chars as expected
Expand Down
2 changes: 1 addition & 1 deletion src/mormot.commit.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'2.1.5674'
'2.1.5675'

0 comments on commit a2adff6

Please sign in to comment.