Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deep-replace.ts to match single quotes and double quotes #73

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

clemenstyp
Copy link

if you want to replace something within a jinja code it is best to set the value in single quotes not in double qoutes.
if you have the following template:

decluttering_templates:
  my_first_template:
    default:
      - entities:
          - light.outdoor
          - light.indoor
    card:
      content: |
        {{ "[[entities]]' }}"
      type: markdown
      title: Test Card

The [[entities]] element in 'content' wont replaced because the json sting looks like this:
{"type": "markdown", "content":"{{ \"[[entities]]\" }} "...
Then the current regex: / "\[\[entities\]\]"/gm wont find anything. But if you put it in single quotes it will work. ;-)

if you want to replace something within a jinja code it is best to set the value in single quotes not in double qoutes.
@clemenstyp clemenstyp marked this pull request as draft October 19, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant