Skip to content

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

Draft
clemenstyp wants to merge 1 commit into
custom-cards:masterfrom
clemenstyp:patch-1
Draft

Update deep-replace.ts to match single quotes and double quotes#73
clemenstyp wants to merge 1 commit into
custom-cards:masterfrom
clemenstyp:patch-1

Conversation

@clemenstyp

Copy link
Copy Markdown

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