decluttering-card icon indicating copy to clipboard operation
decluttering-card copied to clipboard

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

Open clemenstyp opened this issue 1 year ago • 0 comments

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. ;-)

clemenstyp avatar Oct 19 '23 14:10 clemenstyp