Skip to content

Conversation

@UnknownPlatypus
Copy link
Owner

@UnknownPlatypus UnknownPlatypus commented Dec 6, 2025

Fixes #29

This will currently skip formatting if there are interpolations inside the <script> tag

The codspeed regression is expected since we now format script tag that we were ignoring previously

Blocked by 179 upstream for now

might need script_formatter option

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

ecosystem-check results (partial, see full diff here)

pr vs main diff

ℹ️ ecosystem check detected format changes. (+727 -707 lines in 40 files in 12 projects; 6 projects unchanged)

zulip/zulip (+35 -31 lines across 3 files)

templates/corporate/team.html~L124

 <!-- Compiled using lodash -->
 <script type="text/template" id="contributors-template">
     <div class="person">
-        <a href="<%= profile_url %>" target="_blank" rel="noopener noreferrer" class="no-underline">
-            <div class="avatar">
-                <img class="avatar_img" src="<%= avatar %>" alt="{{ _('Avatar') }}" />
-            </div>
-            <div class='info'>
-                <b><%= name %></b><br />
-                <%= commits %> <%= commits === 1 ? 'commit' : 'commits' %>
-            </div>
-        </a>
-    </div>
+    <a href="<%= profile_url %>" target="_blank" rel="noopener noreferrer" class="no-underline">
+        <div class="avatar">
+            <img class="avatar_img" src="<%= avatar %>" alt="{{ _('Avatar') }}" />
+        </div>
+        <div class='info'>
+            <b><%= name %></b><br />
+            <%= commits %> <%= commits === 1 ? 'commit' : 'commits' %>
+        </div>
+    </a>
+</div>
 </script>
 
 <script type="text/template" id="loading-template">
     <p class="tab-loading">
-        Loading…
-    </p>
+    Loading…
+</p>;
 </script>
 
 <script type="text/template" id="total-count-template">
     <p class="contributor-count">
-        <%= contributor_count %> total contributors
-        (<%= hundred_plus_contributor_count %> with 100+ commits;
-         <%= twenty_plus_contributor_count %> with 20+ commits)
-    </p>
+    <%= contributor_count %> total contributors
+    (<%= hundred_plus_contributor_count %> with 100+ commits;
+     <%= twenty_plus_contributor_count %> with 20+ commits)
+</p>
 </script>
 
 <script type="text/template" id="count-template">
     <p class="contributor-count">
-        <%= contributor_count %> contributors
-        (<%= hundred_plus_contributor_count %> with 100+ commits) to
-        <% repo_list.forEach(function(repo_name, index) { %>
-        <a href="<%= repo_url_list[index] %>" target="_blank" rel="noopener noreferrer">
-            zulip/<%= repo_name %><% if (index < repo_list.length - 1) { %>, <% } %>
-        </a>
-            <% }); %>
-    </p>
+    <%= contributor_count %> contributors
+    (<%= hundred_plus_contributor_count %> with 100+ commits) to
+    <% repo_list.forEach(function(repo_name, index) { %>
+    <a href="<%= repo_url_list[index] %>" target="_blank" rel="noopener noreferrer">
+        zulip/<%= repo_name %><% if (index < repo_list.length - 1) { %>, <% } %>
+    </a>
+        <% }); %>
+</p>
 </script>
 
 <p class="last-updated">

templates/zerver/app/index.html~L145

         <p>{% trans %}Error loading Zulip. Try <a class="reload-lnk">reloading</a> the page.{% endtrans %}</p>
     </div>
     <script nonce="{{ csp_nonce }}">
-        document.addEventListener('DOMContentLoaded', function () {
-            function reload() {
-                window.location.reload(true);
-            }
-            document.querySelectorAll('.reload-lnk').forEach(lnk => lnk.addEventListener('click', reload));
-        });
+        document.addEventListener("DOMContentLoaded", function () {
+        function reload() {
+            window.location.reload(true);
+        }
+        document.querySelectorAll(".reload-lnk").forEach((lnk) => lnk.addEventListener("click", reload));
+    });
     </script>
 </div>
 

templates/zerver/base.html~L31

 
 {% if sentry_params is defined %}
     <script id="sentry-params" type="text/json">
-        {{ sentry_params|tojson }}
+        {
+        {
+            sentry_params | tojson;
+        }
+    }
     </script>
 {% endif %}
 

django/django (+3 -3 lines across 2 files)

djangofmt (excluding django/contrib/admin/templates/admin/edit_inline/stacked.html django/contrib/admin/templates/admin/edit_inline/tabular.html django/contrib/admin/templates/admin/includes/fieldset.html django/contrib/admin/templates/admin/widgets/clearable_file_input.html django/contrib/admin/templates/admin/widgets/foreign_key_raw_id.html django/contrib/admin/templates/admin/widgets/url.html django/forms/templates/django/forms/field.html django/forms/templates/django/forms/widgets/input_option.html django/forms/templates/django/forms/widgets/multiple_input.html django/forms/templates/django/forms/widgets/select.html django/views/templates/technical_500.html tests/forms_tests/templates/forms_tests/use_fieldset.html tests/template_backends/templates/template_backends/syntax_error.html tests/test_client_regress/bad_templates/404.html)

tests/templates/custom_admin/change_list.html~L2

 
 {% block extrahead %}
     <script>
-        var hello = '{{ extra_var }}';
+        var hello = "{{ extra_var }}";
     </script>
 {% endblock %}

tests/view_tests/templates/jsi18n-multi-catalogs.html~L6

 <body>
     <p id="app1string">
         <script>
-            document.write(gettext('this app1 string is to be translated'))
+            document.write(gettext("this app1 string is to be translated"));
         </script>
     </p>
     <p id="app2string">
         <script>
-            document.write(gettext('this app2 string is to be translated'))
+            document.write(gettext("this app2 string is to be translated"));
         </script>
     </p>
 </body>

sissbruecker/linkding (+287 -281 lines across 8 files)

bookmarks/templates/bookmarks/close.html~L2

 
 {% block content %}
     <script type="application/javascript">
-        window.close()
+        window.close();
     </script>
     <p>You can now close this window.</p>
 {% endblock %}

bookmarks/templates/bookmarks/form.html~L116

     </div>
     <script type="application/javascript">
         /**
-         * - Pre-fill title and description with metadata from website as soon as URL changes
-         * - Show hint if URL is already bookmarked
-         */
-        (function init() {
-          const urlInput = document.getElementById('{{ form.url.id_for_label }}');
-          const titleInput = document.getElementById('{{ form.title.id_for_label }}');
-          const descriptionInput = document.getElementById('{{ form.description.id_for_label }}');
-          const notesDetails = document.querySelector('form details.notes');
-          const notesInput = document.getElementById('{{ form.notes.id_for_label }}');
-          const unreadCheckbox = document.getElementById('{{ form.unread.id_for_label }}');
-          const sharedCheckbox = document.getElementById('{{ form.shared.id_for_label }}');
-          const refreshButton = document.getElementById('refresh-button');
-          const bookmarkExistsHint = document.querySelector('.form-input-hint.bookmark-exists');
-          const editedBookmarkId = {{ form.instance.id|default:0 }};
-          let isTitleModified = !!titleInput.value;
-          let isDescriptionModified = !!descriptionInput.value;
+     * - Pre-fill title and description with metadata from website as soon as URL changes
+     * - Show hint if URL is already bookmarked
+     */
+    (function init() {
+      const urlInput = document.getElementById('{{ form.url.id_for_label }}');
+      const titleInput = document.getElementById('{{ form.title.id_for_label }}');
+      const descriptionInput = document.getElementById('{{ form.description.id_for_label }}');
+      const notesDetails = document.querySelector('form details.notes');
+      const notesInput = document.getElementById('{{ form.notes.id_for_label }}');
+      const unreadCheckbox = document.getElementById('{{ form.unread.id_for_label }}');
+      const sharedCheckbox = document.getElementById('{{ form.shared.id_for_label }}');
+      const refreshButton = document.getElementById('refresh-button');
+      const bookmarkExistsHint = document.querySelector('.form-input-hint.bookmark-exists');
+      const editedBookmarkId = {{ form.instance.id|default:0 }};
+      let isTitleModified = !!titleInput.value;
+      let isDescriptionModified = !!descriptionInput.value;
 
-          function toggleLoadingIcon(input, show) {
-            const icon = input.parentNode.querySelector('i.form-icon');
-            icon.style['visibility'] = show ? 'visible' : 'hidden';
-          }
+      function toggleLoadingIcon(input, show) {
+        const icon = input.parentNode.querySelector('i.form-icon');
+        icon.style['visibility'] = show ? 'visible' : 'hidden';
+      }
 
-          function updateInput(input, value) {
-            if (!input) {
-              return;
-            }
-            input.value = value;
-            input.dispatchEvent(new Event('value-changed'));
-          }
-
-          function updateCheckbox(input, value) {
-            if (!input) {
-              return;
-            }
-            input.checked = value;
-          }
+      function updateInput(input, value) {
+        if (!input) {
+          return;
+        }
+        input.value = value;
+        input.dispatchEvent(new Event('value-changed'));
+      }
 
-          function checkUrl() {
-            if (!urlInput.value) {
-              return;
-            }
+      function updateCheckbox(input, value) {
+        if (!input) {
+          return;
+        }
+        input.checked = value;
+      }
 
-            toggleLoadingIcon(urlInput, true);
+      function checkUrl() {
+        if (!urlInput.value) {
+          return;
+        }
 
-            const websiteUrl = encodeURIComponent(urlInput.value);
-            const requestUrl = `{% url 'linkding:api-root' %}bookmarks/check?url=${websiteUrl}`;
-            fetch(requestUrl)
-              .then(response => response.json())
-              .then(data => {
-                const metadata = data.metadata;
-                toggleLoadingIcon(urlInput, false);
+        toggleLoadingIcon(urlInput, true);
 
-                // Display hint if URL is already bookmarked
-                const existingBookmark = data.bookmark;
-                bookmarkExistsHint.style['display'] = existingBookmark ? 'block' : 'none';
-                refreshButton.style['display'] = existingBookmark ? 'inline-block' : 'none';
+        const websiteUrl = encodeURIComponent(urlInput.value);
+        const requestUrl = `{% url 'linkding:api-root' %}bookmarks/check?url=${websiteUrl}`;
+        fetch(requestUrl)
+          .then(response => response.json())
+          .then(data => {
+            const metadata = data.metadata;
+            toggleLoadingIcon(urlInput, false);
 
-                // Prefill form with existing bookmark data
-                if (existingBookmark) {
-                  // Workaround: tag input will be replaced by tag autocomplete, so
-                  // defer getting the input until we need it
-                  const tagsInput = document.getElementById('{{ form.tag_string.id_for_label }}');
+            // Display hint if URL is already bookmarked
+            const existingBookmark = data.bookmark;
+            bookmarkExistsHint.style['display'] = existingBookmark ? 'block' : 'none';
+            refreshButton.style['display'] = existingBookmark ? 'inline-block' : 'none';
 
-                  bookmarkExistsHint.style['display'] = 'block';
-                  notesDetails.open = !!existingBookmark.notes;
-                  updateInput(titleInput, existingBookmark.title);
-                  updateInput(descriptionInput, existingBookmark.description);
-                  updateInput(notesInput, existingBookmark.notes);
-                  updateInput(tagsInput, existingBookmark.tag_names.join(" "));
-                  updateCheckbox(unreadCheckbox, existingBookmark.unread);
-                  updateCheckbox(sharedCheckbox, existingBookmark.shared);
-                } else {
-                  // Update title and description with website metadata, unless they have been modified
-                  if (!isTitleModified) {
-                    updateInput(titleInput, metadata.title);
-                  }
-                  if (!isDescriptionModified) {
-                    updateInput(descriptionInput, metadata.description);
-                  }
-                }
+            // Prefill form with existing bookmark data
+            if (existingBookmark) {
+              // Workaround: tag input will be replaced by tag autocomplete, so
+              // defer getting the input until we need it
+              const tagsInput = document.getElementById('{{ form.tag_string.id_for_label }}');
 
-                // Preview auto tags
-                const autoTags = data.auto_tags;
-                const autoTagsHint = document.querySelector('.form-input-hint.auto-tags');
+              bookmarkExistsHint.style['display'] = 'block';
+              notesDetails.open = !!existingBookmark.notes;
+              updateInput(titleInput, existingBookmark.title);
+              updateInput(descriptionInput, existingBookmark.description);
+              updateInput(notesInput, existingBookmark.notes);
+              updateInput(tagsInput, existingBookmark.tag_names.join(" "));
+              updateCheckbox(unreadCheckbox, existingBookmark.unread);
+              updateCheckbox(sharedCheckbox, existingBookmark.shared);
+            } else {
+              // Update title and description with website metadata, unless they have been modified
+              if (!isTitleModified) {
+                updateInput(titleInput, metadata.title);
+              }
+              if (!isDescriptionModified) {
+                updateInput(descriptionInput, metadata.description);
+              }
+            }
 
-                if (autoTags.length > 0) {
-                  autoTags.sort();
-                  autoTagsHint.style['display'] = 'block';
-                  autoTagsHint.innerHTML = `Auto tags: ${autoTags.join(" ")}`;
-                } else {
-                  autoTagsHint.style['display'] = 'none';
-                }
-              });
-          }
+            // Preview auto tags
+            const autoTags = data.auto_tags;
+            const autoTagsHint = document.querySelector('.form-input-hint.auto-tags');
 
-          function refreshMetadata() {
-            if (!urlInput.value) {
-              return;
+            if (autoTags.length > 0) {
+              autoTags.sort();
+              autoTagsHint.style['display'] = 'block';
+              autoTagsHint.innerHTML = `Auto tags: ${autoTags.join(" ")}`;
+            } else {
+              autoTagsHint.style['display'] = 'none';
             }
+          });
+      }
+
+      function refreshMetadata() {
+        if (!urlInput.value) {
+          return;
+        }
 
-            toggleLoadingIcon(urlInput, true);
+        toggleLoadingIcon(urlInput, true);
 
-            const websiteUrl = encodeURIComponent(urlInput.value);
-            const requestUrl = `{% url 'linkding:api-root' %}bookmarks/check?url=${websiteUrl}&ignore_cache=true`;
+        const websiteUrl = encodeURIComponent(urlInput.value);
+        const requestUrl = `{% url 'linkding:api-root' %}bookmarks/check?url=${websiteUrl}&ignore_cache=true`;
 
-            fetch(requestUrl)
-              .then(response => response.json())
-              .then(data => {
-                const metadata = data.metadata;
-                const existingBookmark = data.bookmark;
-                toggleLoadingIcon(urlInput, false);
+        fetch(requestUrl)
+          .then(response => response.json())
+          .then(data => {
+            const metadata = data.metadata;
+            const existingBookmark = data.bookmark;
+            toggleLoadingIcon(urlInput, false);
 
-                if (metadata.title && metadata.title !== existingBookmark?.title) {
-                  titleInput.value = metadata.title;
-                  titleInput.classList.add("modified");
-                }
+            if (metadata.title && metadata.title !== existingBookmark?.title) {
+              titleInput.value = metadata.title;
+              titleInput.classList.add("modified");
+            }
 
-                if (metadata.description && metadata.description !== existingBookmark?.description) {
-                  descriptionInput.value = metadata.description;
-                  descriptionInput.classList.add("modified");
-                }
-              });
-          }
+            if (metadata.description && metadata.description !== existingBookmark?.description) {
+              descriptionInput.value = metadata.description;
+              descriptionInput.classList.add("modified");
+            }
+          });
+      }
 
-          refreshButton.addEventListener('click', refreshMetadata);
+      refreshButton.addEventListener('click', refreshMetadata);
 
-          // Fetch website metadata when page loads and when URL changes, unless we are editing an existing bookmark
-          if (!editedBookmarkId) {
-            checkUrl();
-            urlInput.addEventListener('input', checkUrl);
-            titleInput.addEventListener('input', () => {
-              isTitleModified = true;
-            });
-            descriptionInput.addEventListener('input', () => {
-              isDescriptionModified = true;
-            });
-          } else {
-            refreshButton.style['display'] = 'inline-block';
-          }
-        })();
+      // Fetch website metadata when page loads and when URL changes, unless we are editing an existing bookmark
+      if (!editedBookmarkId) {
+        checkUrl();
+        urlInput.addEventListener('input', checkUrl);
+        titleInput.addEventListener('input', () => {
+          isTitleModified = true;
+        });
+        descriptionInput.addEventListener('input', () => {
+          isDescriptionModified = true;
+        });
+      } else {
+        refreshButton.style['display'] = 'inline-block';
+      }
+    })();
     </script>
 </div>

bookmarks/templates/bookmarks/read.html~L42

 <script src="{% static 'vendor/Readability.js' %}" type="application/javascript"></script>
 <script type="application/javascript">
     function estimateReadingTime(charCount, wordsPerMinute) {
-      const avgWordLength = 5;
-      const totalWords = charCount / avgWordLength;
-      return Math.ceil(totalWords / wordsPerMinute);
+        const avgWordLength = 5;
+        const totalWords = charCount / avgWordLength;
+        return Math.ceil(totalWords / wordsPerMinute);
     }
 
     function postProcess(articleContent) {
-      articleContent.querySelectorAll('table').forEach(table => {
-        table.classList.add('table');
-      });
+        articleContent.querySelectorAll("table").forEach((table) => {
+            table.classList.add("table");
+        });
     }
 
     function makeReadable() {
-      const content = document.getElementById('content');
-      const contentHtml = content.innerHTML;
-      const dom = new DOMParser().parseFromString(contentHtml, 'text/html');
-      const article = new Readability(dom).parse();
+        const content = document.getElementById("content");
+        const contentHtml = content.innerHTML;
+        const dom = new DOMParser().parseFromString(contentHtml, "text/html");
+        const article = new Readability(dom).parse();
 
-      document.title = article.title;
+        document.title = article.title;
 
-      const container = document.createElement('div');
-      container.classList.add('container');
+        const container = document.createElement("div");
+        container.classList.add("container");
 
-      const articleTitle = document.createElement('h1');
-      articleTitle.textContent = article.title;
-      container.append(articleTitle);
+        const articleTitle = document.createElement("h1");
+        articleTitle.textContent = article.title;
+        container.append(articleTitle);
 
-      const byline = [article.byline, article.siteName].filter(Boolean);
-      if (byline.length > 0) {
-        const articleByline = document.createElement('p');
-        articleByline.textContent = byline.join(' | ');
-        articleByline.classList.add('byline');
-        container.append(articleByline);
-      }
+        const byline = [article.byline, article.siteName].filter(Boolean);
+        if (byline.length > 0) {
+            const articleByline = document.createElement("p");
+            articleByline.textContent = byline.join(" | ");
+            articleByline.classList.add("byline");
+            container.append(articleByline);
+        }
 
-      if(article.length) {
-        const minTime = estimateReadingTime(article.length, 225);
-        const maxTime = estimateReadingTime(article.length, 175);
+        if (article.length) {
+            const minTime = estimateReadingTime(article.length, 225);
+            const maxTime = estimateReadingTime(article.length, 175);
 
-        const articleReadingTime = document.createElement('p');
-        articleReadingTime.textContent = `${minTime}-${maxTime} minutes`;
-        articleReadingTime.classList.add('reading-time');
-        container.append(articleReadingTime);
-      }
+            const articleReadingTime = document.createElement("p");
+            articleReadingTime.textContent = `${minTime}-${maxTime} minutes`;
+            articleReadingTime.classList.add("reading-time");
+            container.append(articleReadingTime);
+        }
 
-      const divider = document.createElement('hr');
-      container.append(divider);
+        const divider = document.createElement("hr");
+        container.append(divider);
 
-      const articleContent = document.createElement('div');
-      articleContent.innerHTML = article.content;
-      postProcess(articleContent);
-      container.append(articleContent);
+        const articleContent = document.createElement("div");
+        articleContent.innerHTML = article.content;
+        postProcess(articleContent);
+        container.append(articleContent);
 
-      content.replaceWith(container);
+        content.replaceWith(container);
     }
     makeReadable();
 </script>

bookmarks/templates/bookmarks/updates/bookmark_view_stream.html~L2

     <template>
         {% include 'bookmarks/bookmark_list.html' %}
         <script>
-            document.dispatchEvent(new CustomEvent('bookmark-list-updated'));
+            document.dispatchEvent(new CustomEvent("bookmark-list-updated"));
         </script>
     </template>
 </turbo-stream>

bookmarks/templates/bundles/form.html~L55

 
 <script>
     (function init() {
-      const bundleForm = document.getElementById('bundle-form');
-      const previewLink = document.getElementById('preview-link');
+        const bundleForm = document.getElementById("bundle-form");
+        const previewLink = document.getElementById("preview-link");
 
-      let pendingUpdate;
+        let pendingUpdate;
 
-      function scheduleUpdate() {
-        if (pendingUpdate) {
-          clearTimeout(pendingUpdate);
-        }
-        pendingUpdate = setTimeout(() => {
-          // Ignore if link has been removed (e.g. form submit or navigation)
-          if (!previewLink.isConnected) {
-            return;
-          }
+        function scheduleUpdate() {
+            if (pendingUpdate) {
+                clearTimeout(pendingUpdate);
+            }
+            pendingUpdate = setTimeout(() => {
+                // Ignore if link has been removed (e.g. form submit or navigation)
+                if (!previewLink.isConnected) {
+                    return;
+                }
 
-          const baseUrl = previewLink.href.split('?')[0];
-          const params = new URLSearchParams();
-          const inputs = bundleForm.querySelectorAll('input[type="text"]:not([name="csrfmiddlewaretoken"]), textarea, select');
+                const baseUrl = previewLink.href.split("?")[0];
+                const params = new URLSearchParams();
+                const inputs = bundleForm.querySelectorAll(
+                    'input[type="text"]:not([name="csrfmiddlewaretoken"]), textarea, select',
+                );
 
-          inputs.forEach(input => {
-            if (input.name && input.value.trim()) {
-              params.set(input.name, input.value.trim());
-            }
-          });
+                inputs.forEach((input) => {
+                    if (input.name && input.value.trim()) {
+                        params.set(input.name, input.value.trim());
+                    }
+                });
 
-          previewLink.href = params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl;
-          previewLink.click();
-        }, 500)
-      }
+                previewLink.href = params.toString() ? `${baseUrl}?${params.toString()}` : baseUrl;
+                previewLink.click();
+            }, 500);
+        }
 
-      bundleForm.addEventListener('input', scheduleUpdate);
+        bundleForm.addEventListener("input", scheduleUpdate);
     })();
 </script>

bookmarks/templates/bundles/index.html~L85

 
     <script>
         (function init() {
-          const tableBody = document.querySelector(".crud-table tbody");
-          if (!tableBody) return;
+        const tableBody = document.querySelector(".crud-table tbody");
+        if (!tableBody) return;
 
-          let draggedElement = null;
+        let draggedElement = null;
 
-          const rows = tableBody.querySelectorAll('tr');
-          rows.forEach((item) => {
-            item.addEventListener('dragstart', handleDragStart);
-            item.addEventListener('dragend', handleDragEnd);
-            item.addEventListener('dragover', handleDragOver);
-            item.addEventListener('dragenter', handleDragEnter);
-          });
+        const rows = tableBody.querySelectorAll("tr");
+        rows.forEach((item) => {
+            item.addEventListener("dragstart", handleDragStart);
+            item.addEventListener("dragend", handleDragEnd);
+            item.addEventListener("dragover", handleDragOver);
+            item.addEventListener("dragenter", handleDragEnter);
+        });
 
-          function handleDragStart(e) {
+        function handleDragStart(e) {
             draggedElement = this;
 
-            e.dataTransfer.effectAllowed = 'move';
-            e.dataTransfer.dropEffect = 'move';
+            e.dataTransfer.effectAllowed = "move";
+            e.dataTransfer.dropEffect = "move";
 
-            this.classList.add('drag-start');
+            this.classList.add("drag-start");
             setTimeout(() => {
-              this.classList.remove('drag-start');
-              this.classList.add('dragging');
+                this.classList.remove("drag-start");
+                this.classList.add("dragging");
             }, 0);
-          }
+        }
 
-          function handleDragEnd() {
-            this.classList.remove('dragging');
+        function handleDragEnd() {
+            this.classList.remove("dragging");
 
             const moveBundleInput = document.querySelector('input[name="move_bundle"]');
             const movePositionInput = document.querySelector('input[name="move_position"]');
-            moveBundleInput.value = draggedElement.getAttribute('data-bundle-id');
+            moveBundleInput.value = draggedElement.getAttribute("data-bundle-id");
             movePositionInput.value = Array.from(tableBody.children).indexOf(draggedElement);
 
-            const form = this.closest('form');
+            const form = this.closest("form");
             form.requestSubmit(moveBundleInput);
 
             draggedElement = null;
-          }
+        }
 
-          function handleDragOver(e) {
+        function handleDragOver(e) {
             if (e.preventDefault) {
-              e.preventDefault();
+                e.preventDefault();
             }
             return false;
-          }
+        }
 
-          function handleDragEnter() {
+        function handleDragEnter() {
             if (this !== draggedElement) {
-              const listItems = Array.from(tableBody.children);
-              const draggedIndex = listItems.indexOf(draggedElement);
-              const currentIndex = listItems.indexOf(this);
-
-              if (draggedIndex < currentIndex) {
-                this.insertAdjacentElement('afterend', draggedElement);
-              } else {
-                this.insertAdjacentElement('beforebegin', draggedElement);
-              }
+                const listItems = Array.from(tableBody.children);
+                const draggedIndex = listItems.indexOf(draggedElement);
+                const currentIndex = listItems.indexOf(this);
+
+                if (draggedIndex < currentIndex) {
+                    this.insertAdjacentElement("afterend", draggedElement);
+                } else {
+                    this.insertAdjacentElement("beforebegin", draggedElement);
+                }
             }
-          }
-        })();
+        }
+    })();
     </script>
 {% endblock %}

bookmarks/templates/settings/general.html~L448

 
     <script>
         (function init() {
-          const enableSharing = document.getElementById("{{ form.enable_sharing.id_for_label }}");
-          const enablePublicSharing = document.getElementById("{{ form.enable_public_sharing.id_for_label }}");
-          const defaultMarkShared = document.getElementById("{{ form.default_mark_shared.id_for_label }}");
-          const bookmarkDescriptionDisplay = document.getElementById("{{ form.bookmark_description_display.id_for_label }}");
-          const bookmarkDescriptionMaxLines = document.getElementById("{{ form.bookmark_description_max_lines.id_for_label }}");
+        const enableSharing = document.getElementById("{{ form.enable_sharing.id_for_label }}");
+        const enablePublicSharing = document.getElementById("{{ form.enable_public_sharing.id_for_label }}");
+        const defaultMarkShared = document.getElementById("{{ form.default_mark_shared.id_for_label }}");
+        const bookmarkDescriptionDisplay = document.getElementById(
+            "{{ form.bookmark_description_display.id_for_label }}",
+        );
+        const bookmarkDescriptionMaxLines = document.getElementById(
+            "{{ form.bookmark_description_max_lines.id_for_label }}",
+        );
 
-          // Automatically disable public bookmark sharing and default shared option if bookmark sharing is disabled
-          function updateSharingOptions() {
+        // Automatically disable public bookmark sharing and default shared option if bookmark sharing is disabled
+        function updateSharingOptions() {
             if (enableSharing.checked) {
-              enablePublicSharing.disabled = false;
-              defaultMarkShared.disabled = false;
+                enablePublicSharing.disabled = false;
+                defaultMarkShared.disabled = false;
             } else {
-              enablePublicSharing.disabled = true;
-              enablePublicSharing.checked = false;
-              defaultMarkShared.disabled = true;
-              defaultMarkShared.checked = false;
+                enablePublicSharing.disabled = true;
+                enablePublicSharing.checked = false;
+                defaultMarkShared.disabled = true;
+                defaultMarkShared.checked = false;
             }
-          }
+        }
 
-          updateSharingOptions();
-          enableSharing.addEventListener("change", updateSharingOptions);
+        updateSharingOptions();
+        enableSharing.addEventListener("change", updateSharingOptions);
 
-          // Automatically hide the bookmark description max lines input if the description display is set to inline
-          function updateBookmarkDescriptionMaxLines() {
+        // Automatically hide the bookmark description max lines input if the description display is set to inline
+        function updateBookmarkDescriptionMaxLines() {
             if (bookmarkDescriptionDisplay.value === "inline") {
-              bookmarkDescriptionMaxLines.closest(".form-group").classList.add("d-hide");
+                bookmarkDescriptionMaxLines.closest(".form-group").classList.add("d-hide");
             } else {
-              bookmarkDescriptionMaxLines.closest(".form-group").classList.remove("d-hide");
+                bookmarkDescriptionMaxLines.closest(".form-group").classList.remove("d-hide");
             }
-          }
+        }
 
-          updateBookmarkDescriptionMaxLines();
-          bookmarkDescriptionDisplay.addEventListener("change", updateBookmarkDescriptionMaxLines);
-        })();
+        updateBookmarkDescriptionMaxLines();
+        bookmarkDescriptionDisplay.addEventListener("change", updateBookmarkDescriptionMaxLines);
+    })();
     </script>
 {% endblock %}

bookmarks/templates/settings/integrations.html~L83

 
     <script>
         (function init() {
-            // Bookmarklet type toggle
-            const radioButtons = document.querySelectorAll('input[name="bookmarklet-type"]');
-            const serverBookmarklet = document.getElementById('bookmarklet-server');
-            const clientBookmarklet = document.getElementById('bookmarklet-client');
+        // Bookmarklet type toggle
+        const radioButtons = document.querySelectorAll('input[name="bookmarklet-type"]');
+        const serverBookmarklet = document.getElementById("bookmarklet-server");
+        const clientBookmarklet = document.getElementById("bookmarklet-client");
 
-            function toggleBookmarklet() {
-                const selectedValue = document.querySelector('input[name="bookmarklet-type"]:checked').value;
-                if (selectedValue === 'server') {
-                    serverBookmarklet.style.display = 'inline-block';
-                    clientBookmarklet.style.display = 'none';
-                } else {
-                    serverBookmarklet.style.display = 'none';
-                    clientBookmarklet.style.display = 'inline-block';
-                }
+        function toggleBookmarklet() {
+            const selectedValue = document.querySelector('input[name="bookmarklet-type"]:checked').value;
+            if (selectedValue === "server") {
+                serverBookmarklet.style.display = "inline-block";
+                clientBookmarklet.style.display = "none";
+            } else {
+                serverBookmarklet.style.display = "none";
+                clientBookmarklet.style.display = "inline-block";
             }
+        }
 
-            toggleBookmarklet();
-            radioButtons.forEach(function (radio) {
-                radio.addEventListener('change', toggleBookmarklet);
-            });
-        })();
+        toggleBookmarklet();
+        radioButtons.forEach(function (radio) {
+            radio.addEventListener("change", toggleBookmarklet);
+        });
+    })();
     </script>
 </section>
 

bookmarks/templates/settings/integrations.html~L185

 
     <script>
         (function init() {
-            // Copy new token key to clipboard
-            const copyButton = document.getElementById('copy-new-token-key');
-            if (copyButton) {
-                copyButton.addEventListener('click', () => {
-                    const tokenInput = document.getElementById('new-token-key');
-                    const tokenValue = tokenInput.value;
-                    navigator.clipboard.writeText(tokenValue).then(() => {
-                        copyButton.textContent = 'Copied!';
-                        setTimeout(() => {
-                            copyButton.textContent = 'Copy';
-                        }, 2000);
-                    }, (err) => {
-                        console.error('Could not copy text: ', err);
-                    });
+        // Copy new token key to clipboard
+        const copyButton = document.getElementById("copy-new-token-key");
+        if (copyButton) {
+            copyButton.addEventListener("click", () => {
+                const tokenInput = document.getElementById("new-token-key");
+                const tokenValue = tokenInput.value;
+                navigator.clipboard.writeText(tokenValue).then(() => {
+                    copyButton.textContent = "Copied!";
+                    setTimeout(() => {
+                        copyButton.textContent = "Copy";
+                    }, 2000);
+                }, (err) => {
+                    console.error("Could not copy text: ", err);
                 });
-            }
-        })();
+            });
+        }
+    })();
     </script>
 </turbo-frame>
 

django-commons/django-debug-toolbar (+51 -49 lines across 6 files)

djangofmt (excluding debug_toolbar/templates/debug_toolbar/includes/panel_button.html debug_toolbar/templates/debug_toolbar/panels/sql_explain.html)

example/templates/index.html~L36

         const asyncButton = document.querySelector("#asyncRequest");
         const value = document.querySelector("#session-value");
         incrementFetch.addEventListener("click", function () {
-          fetch(incrementFetch.dataset.url).then( function (response) {
-            response.json().then(function(data) {
-              value.innerHTML = data.value;
+            fetch(incrementFetch.dataset.url).then(function (response) {
+                response.json().then(function (data) {
+                    value.innerHTML = data.value;
+                });
             });
-          });
         });
         incrementXHR.addEventListener("click", function () {
-          const xhr = new XMLHttpRequest();
-          xhr.onreadystatechange = () => {
-            if (xhr.readyState === 4) {
-              value.innerHTML = JSON.parse(xhr.response).value;
-            }
-          }
-          xhr.open('GET', incrementXHR.dataset.url, true);
-          xhr.send('');
+            const xhr = new XMLHttpRequest();
+            xhr.onreadystatechange = () => {
+                if (xhr.readyState === 4) {
+                    value.innerHTML = JSON.parse(xhr.response).value;
+                }
+            };
+            xhr.open("GET", incrementXHR.dataset.url, true);
+            xhr.send("");
         });
         asyncButton.addEventListener("click", function () {
-          fetch(asyncButton.dataset.url).then( function (response) {
-            response.json().then(function(data) {
-              console.log(data)
+            fetch(asyncButton.dataset.url).then(function (response) {
+                response.json().then(function (data) {
+                    console.log(data);
+                });
             });
-          });
         });
     </script>
 </body>

example/templates/jquery/index.html~L5

     <title>jQuery Test</title>
     <script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
     <script>
-        $(document).ready(function() {
-            $('p.djdt-hidden').show();
-            $('#v').text($.fn.jquery);
+        $(document).ready(function () {
+            $("p.djdt-hidden").show();
+            $("#v").text($.fn.jquery);
         });
     </script>
 </head>

example/templates/mootools/index.html~L5

     <title>MooTools Test</title>
     <script src="//ajax.googleapis.com/ajax/libs/mootools/1.6.0/mootools.min.js"></script>
     <script>
-        window.addEvent('domready', function() {
-            $$('p.djdt-hidden').setStyle('display', 'block');
-            $('v').set('text', MooTools.version);
+        window.addEvent("domready", function () {
+            $$("p.djdt-hidden").setStyle("display", "block");
+            $("v").set("text", MooTools.version);
         });
     </script>
 </head>

example/templates/prototype/index.html~L5

     <title>Prototype Test</title>
     <script src="//ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script>
     <script>
-        document.observe('dom:loaded', function() {
-            $('showme').removeClassName('djdt-hidden');
-            $('v').textContent = Prototype.Version;
+        document.observe("dom:loaded", function () {
+            $("showme").removeClassName("djdt-hidden");
+            $("v").textContent = Prototype.Version;
         });
     </script>
 </head>

example/templates/turbo/index.html~L34

     const incrementXHR = document.querySelector("#incrementXHR");
     const value = document.querySelector("#session-value");
     incrementFetch.addEventListener("click", function () {
-      fetch(incrementFetch.dataset.url).then( function (response) {
-        response.json().then(function(data) {
-          value.innerHTML = data.value;
+        fetch(incrementFetch.dataset.url).then(function (response) {
+            response.json().then(function (data) {
+                value.innerHTML = data.value;
+            });
         });
-      });
     });
     incrementXHR.addEventListener("click", function () {
-      const xhr = new XMLHttpRequest();
-      xhr.onreadystatechange = () => {
-        if (xhr.readyState === 4) {
-          value.innerHTML = JSON.parse(xhr.response).value;
-        }
-      }
-      xhr.open('GET', incrementXHR.dataset.url, true);
-      xhr.send('');
+        const xhr = new XMLHttpRequest();
+        xhr.onreadystatechange = () => {
+            if (xhr.readyState === 4) {
+                value.innerHTML = JSON.parse(xhr.response).value;
+            }
+        };
+        xhr.open("GET", incrementXHR.dataset.url, true);
+        xhr.send("");
     });
 </script>
 <a href="{% url "home" %}">Home</a>

tests/templates/ajax/ajax.html~L5

 
     <script>
         let click_for_ajax = document.getElementById("click_for_ajax");
-        function send_ajax() {
-          let xhr = new XMLHttpRequest();
-          let url = '/json_view/';
-          xhr.open("GET", url, true);
-          xhr.onreadystatechange = function () {
-              if (this.readyState == 4 && this.status == 200) {
-                  console.log(this.responseText);
-              }
-          }
-          xhr.send();
-        }
-        document.addEventListener("click", (event) => {send_ajax()});
+    function send_ajax() {
+        let xhr = new XMLHttpRequest();
+        let url = "/json_view/";
+        xhr.open("GET", url, true);
+        xhr.onreadystatechange = function () {
+            if (this.readyState == 4 && this.status == 200) {
+                console.log(this.responseText);
+            }
+        };
+        xhr.send();
+    }
+    document.addEventListener("click", (event) => {
+        send_ajax();
+    });
     </script>
 {% endblock content %}

django-oscar/django-oscar (+9 -9 lines across 2 files)

djangofmt (excluding tests/_site/templates/oscar/layout.html src/oscar/templates/oscar/dashboard/partners/partner_manage.html src/oscar/templates/oscar/dashboard/shipping/messages/band_deleted.html src/oscar/templates/oscar/dashboard/users/detail.html src/oscar/templates/oscar/catalogue/browse.html src/oscar/templates/oscar/catalogue/reviews/partials/review_stars.html src/oscar/templates/oscar/checkout/shipping_address.html src/oscar/templates/oscar/dashboard/reviews/review_list.html)

src/oscar/templates/oscar/base.html~L37

     <!-- jQuery -->
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
     <script>
-        window.jQuery || document.write('<script src="{% static "oscar/js/jquery/jquery.min.js" %}"><\/script>')
+        window.jQuery || document.write('<script src="{% static "oscar/js/jquery/jquery.min.js" %}"><\/script>');
     </script>
 {% endblock %}
 

src/oscar/templates/oscar/partials/google_analytics.html~L2

     <script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_id }}"></script>
     <script>
         window.dataLayer = window.dataLayer || [];
-        function gtag(){dataLayer.push(arguments)};
-        gtag('js', new Date());
+      function gtag(){dataLayer.push(arguments)};
+      gtag('js', new Date());
 
-        {% if user.is_authenticated %}
-          gtag('config', "{{ google_analytics_id }}", { 'user_id': "{{ user.pk }}" });
-        {% else %}
-          gtag('config', "{{ google_analytics_id }}");
-        {% endif %}
-        {% block extratracking %}{% endblock %}
+      {% if user.is_authenticated %}
+        gtag('config', "{{ google_analytics_id }}", { 'user_id': "{{ user.pk }}" });
+      {% else %}
+        gtag('config', "{{ google_analytics_id }}");
+      {% endif %}
+      {% block extratracking %}{% endblock %}
     </script>
 {% endif %}

django-cms/django-cms (+3 -3 lines across 3 files)

djangofmt (excluding cms/templates/admin/cms/page/tree/actions_dropdown.html cms/templates/admin/cms/page/tree/base.html cms/templates/cms/headless/placeholder.html cms/templates/cms/noapphook.html cms/test_utils/project/sampleapp/templates/sampleapp/home.html)

cms/test_utils/project/templates/integration/plugins/sekizai.html~L3

 
 {% addtoblock "js" %}
 <script>
-    alert('{{ now }}');
+    alert("{{ now }}");
 </script>
 {% endaddtoblock %}

cms/test_utils/project/templates/pluginapp/plugins/sekizai.html~L3

 
 {% addtoblock "js" %}
 <script>
-    alert('{{ now }}');
+    alert("{{ now }}");
 </script>
 {% endaddtoblock %}

cms/test_utils/project/templates/plugins/sekizai.html~L3

 
 {% addtoblock "js" %}
 <script>
-    alert('{{ now }}');
+    alert("{{ now }}");
 </script>
 {% endaddtoblock %}

wagtail/wagtail (+6 -6 lines across 2 files)

djangofmt (excluding wagtail/admin/templates/wagtailadmin/shared/icon.html wagtail/admin/templates/wagtailadmin/tables/references_cell.html)

wagtail/admin/templates/wagtailadmin/panels/inline_panel.html~L45

 
 {% block js_init %}
     <script>
-        (function() {
-            var panel = new InlinePanel(JSON.parse("{{options_json|escapejs}}"));
-        })();
+        (function () {
+        var panel = new InlinePanel(JSON.parse("{{options_json|escapejs}}"));
+    })();
     </script>
 {% endblock %}

wagtail/admin/templates/wagtailadmin/panels/multiple_chooser_panel.html~L18

     {% endwith %}
 
     <script>
-        (function() {
-            var panel = new MultipleChooserPanel(JSON.parse("{{options_json|escapejs}}"));
-        })();
+        (function () {
+        var panel = new MultipleChooserPanel(JSON.parse("{{options_json|escapejs}}"));
+    })();
     </script>
 {% endblock %}

pennersr/django-allauth (+2 -2 lines across 1 file)

djangofmt (excluding examples/regular-django/example/templates/allauth/elements/form.html allauth/templates/allauth/elements/button.html examples/regular-django/example/templates/allauth/elements/button.html)

allauth/headless/templates/headless/spec/swagger_cdn.html~L18

     dom_id: "#swagger-ui",
     presets: [
         SwaggerUIBundle.presets.apis,
-        SwaggerUIBundle.SwaggerUIStandalonePreset
+        SwaggerUIBundle.SwaggerUIStandalonePreset,
     ],
     requestInterceptor: (req) => {
-        req.headers['X-CSRFToken'] = "{{csrf_token}}";
+        req.headers["X-CSRFToken"] = "{{csrf_token}}";
         return req;
     },
 };

silentsokolov/django-admin-rangefilter (+105 -99 lines across 4 files)

djangofmt (excluding rangefilter/templates/rangefilter/date_range_quick_select_list_filter.html)

rangefilter/templates/rangefilter/date_filter.html~L75

 <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
 <script type="text/javascript" nonce="{{ spec.request.csp_nonce }}">
     django.jQuery('document').ready(function () {
-        django.jQuery('.admindatefilter #{{ choices.0.system_name }}-form input[type="submit"]').click(function(event) {
-            event.preventDefault();
-            var form = django.jQuery(this).closest('div.admindatefilter').find('form');
-            var query_string = django.jQuery('input#{{ choices.0.system_name }}-query-string').val();
-            var form_data = form.serialize();
-            var amp = query_string === "?" ? "" : "&";  // avoid leading ?& combination
-            window.location = window.location.pathname + query_string + amp + form_data;
-        });
+    django.jQuery('.admindatefilter #{{ choices.0.system_name }}-form input[type="submit"]').click(function(event) {
+        event.preventDefault();
+        var form = django.jQuery(this).closest('div.admindatefilter').find('form');
+        var query_string = django.jQuery('input#{{ choices.0.system_name }}-query-string').val();
+        var form_data = form.serialize();
+        var amp = query_string === "?" ? "" : "&";  // avoid leading ?& combination
+        window.location = window.location.pathname + query_string + amp + form_data;
+    });
 
-        django.jQuery('.admindatefilter #{{ choices.0.system_name }}-form input[type="reset"]').click(function() {
-            var form = django.jQuery(this).closest('div.admindatefilter').find('form');
-            var query_string = form.find('input#{{ choices.0.system_name }}-query-string').val();
-            window.location = window.location.pathname + query_string;
-        });
+    django.jQuery('.admindatefilter #{{ choices.0.system_name }}-form input[type="reset"]').click(function() {
+        var form = django.jQuery(this).closest('div.admindatefilter').find('form');
+        var query_string = form.find('input#{{ choices.0.system_name }}-query-string').val();
+        window.location = window.location.pathname + query_string;
     });
-    {% comment %}
-    // Code below makes sure that the DateTimeShortcuts.js is loaded exactly once
-    // regardless the presence of AdminDateWidget
-    // How it worked:
-    //  - First Django loads the model formset with predefined widgets for different
-    //    field types. If there's a date based field, then it loads the AdminDateWidget
-    //    and it's required media to context under {{media.js}} in admin/change_list.html.
-    //    (Note: it accumulates media in django.forms.widgets.Media object,
-    //    which prevents duplicates, but the DateRangeFilter is not included yet
-    //    since it's not model field related.
-    //    List of predefined widgets is in django.contrib.admin.options.FORMFIELD_FOR_DBFIELD_DEFAULTS)
-    //  - After that Django starts rendering forms, which have the {{form.media}}
-    //    tag. Only then the DjangoRangeFilter.get_media is called and rendered,
-    //    which creates the duplicates.
-    // How it works:
-    //  - first step is the same, if there's a AdminDateWidget to be loaded then
-    //    nothing changes
-    //  - DOM gets rendered and if the AdminDateWidget was rendered then
-    //    the DateTimeShortcuts.js is initiated which sets the window.DateTimeShortcuts.
-    //    Otherwise, the window.DateTimeShortcuts is undefined.
-    //  - The lines below check if the DateTimeShortcuts has been set and if not
-    //    then the DateTimeShortcuts.js and calendar.js is rendered
-    //
-    //  https://github.com/silentsokolov/django-admin-rangefilter/issues/9
-    //
-    // Django 2.1
-    //  https://github.com/silentsokolov/django-admin-rangefilter/issues/21
-    {% endcomment %}
-    function embedScript(url) {
-        return new Promise(function pr(resolve, reject) {
-            var newScript = document.createElement("script");
-            newScript.type = "text/javascript";
-            newScript.src = url;
-            newScript.onload = resolve;
-            if ("{{ spec.request.csp_nonce }}" !== "") {
-                newScript.setAttribute("nonce", "{{ spec.request.csp_nonce }}");
-            }
-            document.head.appendChild(newScript);
-        });
-    }
+});
+{% comment %}
+// Code below makes sure that the DateTimeShortcuts.js is loaded exactly once
+// regardless the presence of AdminDateWidget
+// How it worked:
+//  - First Django loads the model formset with predefined widgets for different
+//    field types. If there's a date based field, then it loads the AdminDateWidget
+//    and it's required media to context under {{media.js}} in admin/change_list.html.
+//    (Note: it accumulates media in django.forms.widgets.Media object,
+//    which prevents duplicates, but the DateRangeFilter is not included yet
+//    since it's not model field related.
+//    List of predefined widgets is in django.contrib.admin.options.FORMFIELD_FOR_DBFIELD_DEFAULTS)
+//  - After that Django starts rendering forms, which have the {{form.media}}
+//    tag. Only then the DjangoRangeFilter.get_media is called and rendered,
+//    which creates the duplicates.
+// How it works:
+//  - first step is the same, if there's a AdminDateWidget to be loaded then
+//    nothing changes
+//  - DOM gets rendered and if the AdminDateWidget was rendered then
+//    the DateTimeShortcuts.js is initiated which sets the window.DateTimeShortcuts.
+//    Otherwise, the window.DateTimeShortcuts is undefined.
+//  - The lines below check if the DateTimeShortcuts has been set and if not
+//    then the DateTimeShortcuts.js and calendar.js is rendered
+//
+//  https://github.com/silentsokolov/django-admin-rangefilter/issues/9
+//
+// Django 2.1
+//  https://github.com/silentsokolov/django-admin-rangefilter/issues/21
+{% endcomment %}
+function embedScript(url) {
+    return new Promise(function pr(resolve, reject) {
+        var newScript = document.createElement("script");
+        newScript.type = "text/javascript";
+        newScript.src = url;
+        newScript.onload = resolve;
+        if ("{{ spec.request.csp_nonce }}" !== "") {
+            newScript.setAttribute("nonce", "{{ spec.request.csp_nonce }}");
+        }
+        document.head.appendChild(newScript);
+    });
+}
 
-    django.jQuery(window).on('load', function () {
-        if (!('DateTimeShortcuts' in window)) {
-            var promiseList = [];
+django.jQuery(window).on('load', function () {
+    if (!('DateTimeShortcuts' in window)) {
+        var promiseList = [];
 
-            {% for m in spec.form.js %}
-                promiseList.push(embedScript("{{ m }}"));
-            {% endfor %}
+        {% for m in spec.form.js %}
+            promiseList.push(embedScript("{{ m }}"));
+        {% endfor %}
 
-            Promise.all(promiseList).then(function() {
-                django.jQuery('.datetimeshortcuts').remove();
-                if ('DateTimeShortcuts' in window) {
-                    window.DateTimeShortcuts.init();
-                }
-            });
-        }
-    });
+        Promise.all(promiseList).then(function() {
+            django.jQuery('.datetimeshortcuts').remove();
+            if ('DateTimeShortcuts' in window) {
+                window.DateTimeShortcuts.init();
+            }
+        });
+    }
+});
 </script>
 {% block quick-select-choices %}{% endblock %}
 <div class="admindatefilter">

rangefilter/templates/rangefilter/date_filter_1_8.html~L57

 {% endcomment %}
 <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
 <script>
-    function datefilter_apply(event, qs_name, form_name){
+    function datefilter_apply(event, qs_name, form_name) {
         event.preventDefault();
-        var query_string = django.jQuery('input#'+qs_name).val();
-        var form_data = django.jQuery('#'+form_name).serialize();
-        amp = query_string == "?" ? "" : "&";  // avoid leading ?& combination
+        var query_string = django.jQuery("input#" + qs_name).val();
+        var form_data = django.jQuery("#" + form_name).serialize();
+        amp = query_string == "?" ? "" : "&"; // avoid leading ?& combination
         window.location = window.location.pathname + query_string + amp + form_data;
     }
-    function datefilter_reset(qs_name){
-        var query_string = django.jQuery('input#'+qs_name).val();
+    function datefilter_reset(qs_name) {
+        var query_string = django.jQuery("input#" + qs_name).val();
         window.location = window.location.pathname + query_string;
     }
 </script>

rangefilter/templates/rangefilter/numeric_filter.html~L37

 
 <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
 <script type="text/javascript" nonce="{{ spec.request.csp_nonce }}">
-    django.jQuery('document').ready(function () {
-        django.jQuery('.numericrangefilter #{{ choices.0.system_name }}-form input[type="submit"]').click(function(event) {
-            event.preventDefault();
-            var form = django.jQuery(this).closest('div.numericrangefilter').find('form');
-            var query_string = django.jQuery('input#{{ choices.0.system_name }}-query-string').val();
-            var form_data = form.serialize();
-            var amp = query_string === "?" ? "" : "&";  // avoid leading ?& combination
-            window.location = window.location.pathname + query_string + amp + form_data;
-        });
+    django.jQuery("document").ready(function () {
+        django.jQuery('.numericrangefilter #{{ choices.0.system_name }}-form input[type="submit"]').click(
+            function (event) {
+                event.preventDefault();
+                var form = django.jQuery(this).closest("div.numericrangefilter").find("form");
+                var query_string = django.jQuery("input#{{ choices.0.system_name }}-query-string").val();
+                var form_data = form.serialize();
+                var amp = query_string === "?" ? "" : "&"; // avoid leading ?& combination
+                window.location = window.location.pathname + query_string + amp + form_data;
+            },
+        );
 
-        django.jQuery('.numericrangefilter #{{ choices.0.system_name }}-form input[type="reset"]').click(function() {
-            var form = django.jQuery(this).closest('div.numericrangefilter').find('form');
-            var query_string = form.find('input#{{ choices.0.system_name }}-query-string').val();
-            window.location = window.location.pathname + query_string;
-        });
+        django.jQuery('.numericrangefilter #{{ choices.0.system_name }}-form input[type="reset"]').click(
+            function () {
+                var form = django.jQuery(this).closest("div.numericrangefilter").find("form");
+                var query_string = form.find("input#{{ choices.0.system_name }}-query-string").val();
+                window.location = window.location.pathname + query_string;
+            },
+        );
     });
 </script>
 <div class="numericrangefilter">

rangefilter/templates/rangefilter/numeric_filter_4_0.html~L33

 
 <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
 <script type="text/javascript" nonce="{{ spec.request.csp_nonce }}">
-    django.jQuery('document').ready(function () {
-        django.jQuery('.numericrangefilter #{{ choices.0.system_name }}-form input[type="submit"]').click(function(event) {
-            event.preventDefault();
-            var form = django.jQuery(this).closest('div.numericrangefilter').find('form');
-            var query_string = django.jQuery('input#{{ choices.0.system_name }}-query-string').val();
-            var form_data = form.serialize();
-            var amp = query_string === "?" ? "" : "&";  // avoid leading...*[Comment body truncated]*

@UnknownPlatypus UnknownPlatypus marked this pull request as draft December 6, 2025 17:35
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 20, 2025

CodSpeed Performance Report

Merging #116 will degrade performance by 17.59%

Comparing format-script-tags (f282be8) with main (4e92927)

Summary

❌ 1 (👁 1) regression
✅ 4 untouched

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
👁 format_templates[external_format/technical_500.html (491 lines, 17919 bytes)] 4.1 ms 5 ms -17.59%

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.

Add js external formatter integration

2 participants