Bug 41324 - Tidy kohaTable block
Summary: Tidy kohaTable block
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 39715
Blocks: 41323
  Show dependency treegraph
 
Reported: 2025-11-27 14:20 UTC by Jonathan Druart
Modified: 2025-11-27 14:42 UTC (History)
6 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41324: Add a xt test (2.18 KB, patch)
2025-11-27 14:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41324: Tidy some kohaTable blocks - examples (4.94 KB, patch)
2025-11-27 14:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41324: Tidy modified files (19.66 KB, patch)
2025-11-27 14:32 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-11-27 14:20:54 UTC
Bug 39715 removed quotes around DataTables options. We should enforce it with a test to prevent further occurrences.
Comment 1 Jonathan Druart 2025-11-27 14:32:12 UTC
Created attachment 189994 [details] [review]
Bug 41324: Add a xt test

Patch from commit a307855
Comment 2 Jonathan Druart 2025-11-27 14:32:13 UTC
Created attachment 189995 [details] [review]
Bug 41324: Tidy some kohaTable blocks - examples

Commit using --no-verify to ease rebase
Comment 3 Jonathan Druart 2025-11-27 14:32:15 UTC
Created attachment 189996 [details] [review]
Bug 41324: Tidy modified files

Commit the tidiness

perl misc/devel/tidy.pl $(git diff --name-only HEAD~1)
Comment 4 Jonathan Druart 2025-11-27 14:42:17 UTC
Patches for discussion.

One last thing that is not tidy is the script tags from the .tt files.

If script tags have TT tags, the prettier plugin cannot tidy them.

I was trying to provide a solution to prevent regressions for bug 39715. I think this is great, but it will introduce conflicts.

I am happy to continue, but I first need to know if people want that.

The idea is to use JS variables instead of TT variables, and have the assignment in a first script block.

example:

```
<script>
    // This cannot be tidy
    [% IF foo %]
        # do something
        [% ELSE %]
        let foo = 42;
    [% END %]
</script>
```

=>

```
<script>
    // This still cannot be tidy
    let foo = [% foo ? 1 : 0 %];
</script>

<script>
    // But now this will be tidy automatically!
    if ( foo ) {
        # do something
    } else {
        let foo = 42;
    }
</script>
```

On this bug report I will mainly focus on kohaTable, but it may actually impact whole template file. See also bug 41323 for the "remaining ones".