ampproject / ampproject/amphtml

amp-mustache: Custom delimiters

Open
#12,994 21 comments 0 reactions 0 assignees View on GitHub
P3: When Possible Stale Type: Feature Request WG: runtime
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## What's the issue?

We are getting unescaped Mustache template syntax errors in from the AMP validator but there doesn't seem to be an obvious solution for escaping curly braces. We've tried several replaces (i.e. `{ { { { '\{', '\\{'`) and none of them seem to work

```
The attribute 'alt' in tag 'amp-img' is set to '{{{{{Hello}}}}} {{{{{World}}}}}', which contains unescaped Mustache template syntax.
```

The docs don't reference escaping characters and the tests don't seem to accounting for this edge case.

https://www.ampproject.org/docs/reference/components/amp-mustache
https://ampbyexample.com/components/amp-mustache/
amphtml/extensions/amp-mustache/0.1/test/test-amp-mustache.js

## What browsers are affected?

All browsers

## Which AMP version is affected?

1516337355291

Contributor guide

Open the contributing guide

Research direction

Start with the amp-mustache documentation and amphtml/extensions/amp-mustache/0.1/test/test-amp-mustache.js, focusing on the reported unescaped delimiters in amp-img alt attributes. Compare the documented behavior with the existing tests; done means the custom-delimiter or escaping behavior is defined and the reported edge case is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.