Skip to content

Commit

Permalink
perf(config-toggle): caching the unmarshal source code (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Nov 17, 2023
1 parent 734d451 commit c703a35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion layouts/partials/bootstrap/config-toggle.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
{{- end -}}
</ul>
<div class="tab-content">
{{- $src := $.Inner | htmlUnescape | transform.Unmarshal }}
{{- range $i, $lang := $langs -}}
{{- $id := printf "code-toggle-%s-%s" $idPrefix $lang -}}
{{- $code := $.Inner | htmlUnescape | transform.Unmarshal | transform.Remarshal $lang -}}
{{- $code := $src | transform.Remarshal $lang -}}
{{- $code = replaceRE "\n+" "\n" $code -}}
<div
class="tab-pane fade{{ cond (eq $i 0) ` show active` `` }}"
Expand Down

0 comments on commit c703a35

Please sign in to comment.