Automattic / Automattic/pym-shortcode

Does the `pymoptions=""` attribute actually support backslashes?

Open
#26 0 comments 0 reactions 1 assignee Claimed by @jeffersonrabb View on GitHub
status: needs tests type: bug
Dominant language
PHP
Stars
15
Forks
8
PR merge metrics
No merged PRs in 30d

Description

We have this example in readme.txt:

```
[pym src="child.html" pymoptions=" xdomain: '\\*\.npr\.org' "]
```

Which is supposed to output: (with supporting code)

```js
pym.Parent('pym_0', 'child.html', { xdomain: '*\.npr\.org' });
```

But what it actually puts on the page is this:

```js
pym.Parent('pym_0', 'child.html', { xdomain: '\*.npr.org' })
```

Inside, the `$pymoptions` variable is this:

```php
error_log( var_export( $pymoptions, true ) );
' xdomain: \'\\*.npr.org\' '
```

If we esc_js() that, it's this, still not what we're looking for:

```
' xdomain: \\\'*.npr.org\\\' '
```

In conclusion: slashes aren't being output correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.