Ghost/core/frontend/helpers
Hannah Wolfe fbc23459fc
Added full SafeString handling to match helper
refs: https://github.com/TryGhost/Team/issues/759

- No matter what, a handlebars helper outputs a string. So if you return true, you'll always get 'true'.
- SafeStrings are handlebars's way of passing around a string whilst also maintaining a record of the original value e.g. new SafeString(true) results in {string: true}
- We need this for the match helper, so that we know when doing a comparison that we're meant to be comparing against a boolean true, not a string true
- Therefore, we need to putput SafeStrings, but also process them when passed in

The logic
- Figuring out the correct logic here has been a little tricky but essentially:
  - {{match safestring}} with a single arg, will return true for any truthy value
  - {{match safestring "=" true}} does a direct comparison with the original value of the safe string, so if it was a boolean true, the match will be true else false
  - {{match (match something) "=" true}} will therefore work for any level of nesting
  - this can result in slightly inconsistent results, but feels correct and documentable

This is documented extensively through the test cases
2021-10-14 16:29:41 +01:00
..
tpl Added beta {{products}} helper for tiers list on post (#13267) 2021-09-10 09:30:41 +05:30
asset.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
author.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
authors.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
body_class.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
cancel_link.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
concat.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
content.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
date.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
encode.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
excerpt.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
facebook_url.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
foreach.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
get.js Refactored helper registration code into a service 2021-10-05 10:04:02 +01:00
ghost_foot.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
ghost_head.js Refactored helper registration code into a service 2021-10-05 10:04:02 +01:00
has.js Removed core @tryghost pkg usage from f/e proxy 2021-09-28 12:19:02 +01:00
img_url.js Removed core @tryghost pkg usage from f/e proxy 2021-09-28 12:19:02 +01:00
is.js Removed core @tryghost pkg usage from f/e proxy 2021-09-28 12:19:02 +01:00
lang.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
link_class.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
link.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
match.js Added full SafeString handling to match helper 2021-10-14 16:29:41 +01:00
meta_description.js Moved helper proxy into a service 2020-04-08 17:22:44 +01:00
meta_title.js Moved helper proxy into a service 2020-04-08 17:22:44 +01:00
navigation.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
page_url.js Moved helper proxy into a service 2020-04-08 17:22:44 +01:00
pagination.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
plural.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
post_class.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
prev_post.js Refactored helper registration code into a service 2021-10-05 10:04:02 +01:00
price.js Removed core @tryghost pkg usage from f/e proxy 2021-09-28 12:19:02 +01:00
products.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
raw.js Added raw handlebars helper 2020-04-06 17:26:50 +01:00
reading_time.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
t.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
tags.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
title.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
twitter_url.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00
url.js Divided f/e proxy into true proxy + rendering service 2021-09-29 13:10:14 +01:00