Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives
Summary: Translatability: Add tt filter to allow html tags inside tt directives
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Marc Véron
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 18629 18684
  Show dependency treegraph
 
Reported: 2017-05-24 14:05 UTC by Marc Véron
Modified: 2018-06-04 20:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives (2.54 KB, patch)
2017-05-24 14:22 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 18665: Add test for HtmlTags.pm (1.28 KB, patch)
2017-05-25 19:56 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 15465: Fix typo in bugs.k-c.org (964 bytes, patch)
2017-05-26 19:18 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives (2.67 KB, patch)
2017-05-28 06:38 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18665: Add test for HtmlTags.pm (1.33 KB, patch)
2017-05-28 06:39 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 18665 - Translatability: Add tt filter to allow html tags inside tt directives (2.74 KB, patch)
2017-06-16 19:20 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 18665: Add test for HtmlTags.pm (1.40 KB, patch)
2017-06-16 19:20 UTC, Brendan Gallagher
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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