Bug 18665

Summary: Translatability: Add tt filter to allow html tags inside tt directives
Product: Koha Reporter: Marc Véron <veron>
Component: I18N/L10NAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: alexbuckley, f.demians, fridolin.somers, mtj
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18629, 18684    
Attachments: Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives
Bug 18665: Add test for HtmlTags.pm
Bug 15465: Fix typo in bugs.k-c.org
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives
Bug 18665: Add test for HtmlTags.pm
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives
Bug 18665: Add test for HtmlTags.pm

Description Marc Véron 2017-05-24 14:05:48 UTC
HTML tags inside template toolkit directives are not allowed because of translation issues. Instead of having many workaround in tt files it would be nice to have a filter that handles HTML tags.
Comment 1 Marc Véron 2017-05-24 14:22:44 UTC
Created attachment 63697 [details] [review]
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives

HTML tags inside template toolkit directives are not allowed because of translation issues.
Add a filter that handles HTML tags.

To test:
- Apply patch
- Add [% USE HtmlTags %] to the top of a tt file
- Add something like [% My nice title | $HtmlTags tag="h1" %] to the tt file
- Verify that in output 'My nice title' has h1 tags
- Change template directive to something like
  [% My nice title | $HtmlTags tag="h1" attributes='title="This is a nice title attribute"' %]
- Verify that title attribute displays in output (source code or tooltip on 'My nice title')

Notes: - Tests are planned for a second patch
       - Update for Wiki coding guidelines
Comment 2 Marc Véron 2017-05-24 14:24:09 UTC Comment hidden (obsolete)
Comment 3 Marc Véron 2017-05-25 19:56:12 UTC
Created attachment 63721 [details] [review]
Bug 18665: Add test for HtmlTags.pm

This patch adds tests for the tt filter HtmlTags.pm

To test: prove -v t/HtmlTags.t should pass
Comment 4 Marc Véron 2017-05-26 19:18:33 UTC Comment hidden (obsolete)
Comment 5 Marc Véron 2017-05-26 19:19:37 UTC Comment hidden (obsolete)
Comment 6 Alex Buckley 2017-05-28 06:38:54 UTC
Created attachment 63765 [details] [review]
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives

HTML tags inside template toolkit directives are not allowed because of translation issues.
Add a filter that handles HTML tags.

Note you need to write quotes ' around the text you want displayed as a
heading

To test:
- Apply patch
- Add [% USE HtmlTags %] to the top of a tt file
- Add something like [% 'My nice title' | $HtmlTags tag="h1" %] to the tt file
- Verify that in output 'My nice title' has h1 tags
- Change template directive to something like
  [% 'My nice title' | $HtmlTags tag="h1" attributes='title="This is a nice title attribute"' %]
- Verify that title attribute displays in output (source code or tooltip on 'My nice title')

Notes: - Tests are planned for a second patch
       - Update for Wiki coding guidelines

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Comment 7 Alex Buckley 2017-05-28 06:39:22 UTC
Created attachment 63766 [details] [review]
Bug 18665: Add test for HtmlTags.pm

This patch adds tests for the tt filter HtmlTags.pm

To test: prove -v t/HtmlTags.t should pass

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Comment 8 Alex Buckley 2017-05-28 06:41:29 UTC
Hi Marc

I tested and found that the patches work nicely and all tests pass but your test plan is missing that you need to write quote marks ' around the text My nice title in order for it to be displayed correctly with this patch applied.
Comment 9 Marc Véron 2017-05-28 06:54:19 UTC
(In reply to Alex Buckley from comment #8)
> Hi Marc
> 
> I tested and found that the patches work nicely and all tests pass but your
> test plan is missing that you need to write quote marks ' around the text My
> nice title in order for it to be displayed correctly with this patch applied.

Thanks for testing, Alex, and thanks for fixing my test plan!
Marc
Comment 10 Brendan Gallagher 2017-06-16 19:20:00 UTC
Created attachment 64415 [details] [review]
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives

HTML tags inside template toolkit directives are not allowed because of translation issues.
Add a filter that handles HTML tags.

Note you need to write quotes ' around the text you want displayed as a
heading

To test:
- Apply patch
- Add [% USE HtmlTags %] to the top of a tt file
- Add something like [% 'My nice title' | $HtmlTags tag="h1" %] to the tt file
- Verify that in output 'My nice title' has h1 tags
- Change template directive to something like
  [% 'My nice title' | $HtmlTags tag="h1" attributes='title="This is a nice title attribute"' %]
- Verify that title attribute displays in output (source code or tooltip on 'My nice title')

Notes: - Tests are planned for a second patch
       - Update for Wiki coding guidelines

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Comment 11 Brendan Gallagher 2017-06-16 19:20:10 UTC
Created attachment 64416 [details] [review]
Bug 18665: Add test for HtmlTags.pm

This patch adds tests for the tt filter HtmlTags.pm

To test: prove -v t/HtmlTags.t should pass

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
Comment 12 Jonathan Druart 2017-06-21 14:27:46 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 13 Fridolin Somers 2017-06-29 07:21:53 UTC
Enhancement not pushed to 17.05.x