Changes file.ts to mithril template

0b4cba6f82343974210e4e87595b0354198aee23

Tucker McKnight <tucker@pangolin.lan> | Sun Feb 01 2026

Changes file.ts to mithril template

Also fix a small problem with files.ts where it was showing the
"view raw file" link on a directory's page.
js_templates/file.ts:1
Before


0
1
⁣
⁣
⁣
export default async (eleventyConfig: any, data: any) => {
  const isDirectory = eleventyConfig.getFilter("isDirectory")
  const topLevelFilesOnly = eleventyConfig.getFilter("topLevelFilesOnly")
After
0
1
2
3
4
import m from 'mithril'
import render from 'mithril-node-render'

export default async (eleventyConfig: any, data: any) => {
  const isDirectory = eleventyConfig.getFilter("isDirectory")
  const topLevelFilesOnly = eleventyConfig.getFilter("topLevelFilesOnly")
js_templates/file.ts:121
Before
120
121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141
142
143



144
145
                    data.fileInfo.file,
                    data.fileInfo.repoName
                  )
                )
              }
            </code>
          </div>
        </div>
      </div>
    </div>
    `}
    
    <script type="text/javascript">      const toggleLastTouch = (event) => {
        const isOn = event.target.checked
        const annotations = document.getElementById("annotations")
        if (isOn) {
          annotations.classList.remove("d-none")
        } else {
          annotations.classList.add("d-none")
        }
      }
    
      document.getElementById("showLastTouch")?.addEventListener('click', toggleLastTouch)
⁣
⁣
⁣
    </script>
  `
}
After
120
121
122
123
124
125
126
127




128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
                    data.fileInfo.file,
                    data.fileInfo.repoName
                  )
                )))
              )
            ])
          ])
        ),
⁣
⁣
⁣
⁣
        m('script', {type: "text/javascript"},
          `
          const toggleLastTouch = (event) => {
            const isOn = event.target.checked
            const annotations = document.getElementById("annotations")
            if (isOn) {
              annotations.classList.remove("d-none")
            } else {
              annotations.classList.add("d-none")
            }
          }

          document.getElementById("showLastTouch")?.addEventListener('click', toggleLastTouch)
          `
        )
      ]
    )
  ])
}
js_templates/files.ts:24
Before
23
24
25
26
27
28
29
      )
    ),
    m('ul', {class: "list-group"}, files.map((file) => {
      return m('li', [
        file.isDirectory ? '<span>&#x1F4C1;</span>' : null,
        m('a', {
          href: `${data.reposPath}/${slugify(data.branchInfo.repoName)}/branches/${slugify(data.branchInfo.branchName)}/files/${
            file.fullPath.split('/')
After
23
24
25
26
27
28
29
      )
    ),
    m('ul', {class: "list-group"}, files.map((file) => {
      return m('li', {class: 'list-group-item'}, [
        file.isDirectory ? m.trust('<span>&#x1F4C1;</span>') : null,
        m('a', {
          href: `${data.reposPath}/${slugify(data.branchInfo.repoName)}/branches/${slugify(data.branchInfo.branchName)}/files/${
            file.fullPath.split('/')