Skip to content

Commit

Permalink
docs: safeString javadoc
Browse files Browse the repository at this point in the history
fix #388
  • Loading branch information
alandefreitas committed Jul 11, 2023
1 parent bdda0ae commit df92710
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions include/mrdox/Support/Handlebars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,36 +1191,33 @@ isEmpty(dom::Value const& arg);
execution. For example, the each iterator creates a single
frame which is reused for all child execution.
@param arg The value to test
@return True if the value is empty, false otherwise
@param parent The underlying frame object
@return The overlay object
@see https://mustache.github.io/mustache.5.html#Sections
*/
MRDOX_DECL
dom::Object
createFrame(dom::Object const& parent);

/** Create child data objects.
/** Create a wrapper for a safe string.
This function can be used by block helpers to create child
data objects.
The child data object is an overlay frame object implementation
that will first look for a value in the child object and if
not found will look in the parent object.
This string wrapper prevents the string from being escaped
when the template is rendered.
Helpers that modify the data state should create a new frame
object when doing so, to isolate themselves and avoid corrupting
the state of any parents.
When a helper returns a safe string, it will be marked
as safe and will not be escaped when rendered. The
string will be rendered as if converted to a `dom::Value`
and rendered as-is.
Generally, only one frame needs to be created per helper
execution. For example, the each iterator creates a single
frame which is reused for all child execution.
When constructing the string that will be marked as safe, any
external content should be properly escaped using the
`escapeExpression` function to avoid potential security concerns.
@param arg The value to test
@return True if the value is empty, false otherwise
@param str The string to mark as safe
@return The safe string wrapper
@see https://mustache.github.io/mustache.5.html#Sections
@see https://handlebarsjs.com/api-reference/utilities.html#handlebars-safestring-string
*/
MRDOX_DECL
detail::safeStringWrapper
Expand Down

0 comments on commit df92710

Please sign in to comment.