private static @NotNull String createTemplateText(@NotNull TemplateImpl template, @NotNull CustomTemplateCallback callback,
                                                    @NotNull Map<String, String> attributes) {
    XmlTag dummyRootTag = null;
    String templateString = template.getString();
    if (!containsAttrsVar(template)) {
      PsiFile dummyFile = PsiFileFactory.getInstance(callback.getProject())
        .createFileFromText("dummy.html", callback.getFile().getLanguage(), templateString, false, true);
      dummyRootTag = PsiTreeUtil.findChildOfType(dummyFile, XmlTag.class);
      if (dummyRootTag != null && !attributes.isEmpty()) {
        addMissingAttributes(dummyRootTag, attributes);
      }
    }

    return dummyRootTag != null ? dummyRootTag.getContainingFile().getText() : templateString;
  }
private static @NotNull String createTemplateText(@NotNull TemplateImpl template, @NotNull CustomTemplateCallback callback,
                                                    @NotNull Map<String, String> attributes)