From 6cbfb2c5b99a40b0a33d36a709cdc8acd3436df2 Mon Sep 17 00:00:00 2001 From: twoldanski <66474451+twoldanski@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:43:26 +0200 Subject: [PATCH] [TASK] Typoscript improvements (#642) * [TASK] Typoscript improvements - Align latest parseFunc with TYPO3 core changes - change default parsing of rte with correct parseFunc - add helper for handling inline helpers * [TASK] Typoscript improvements - move helpers to dedicated branch - assign example --------- --- .../DataProcessing/DatabaseQueryProcessor.php | 2 +- .../2.x/ContentElement/Text.typoscript | 2 +- .../2.x/ContentElement/Textmedia.typoscript | 2 +- .../2.x/ContentElement/Textpic.typoscript | 2 +- .../2.x/Helper/ParseFunc.typoscript | 69 +++++++++++-------- .../ContentElement/Shortcut.typoscript | 23 +------ .../TypoScript/ContentElement/Text.typoscript | 2 +- .../ContentElement/Textmedia.typoscript | 2 +- .../ContentElement/Textpic.typoscript | 2 +- .../ParseFunc.typoscript | 69 +++++++++++-------- .../Helpers/RenderChildren.typoscript | 44 ++++++++++++ Configuration/TypoScript/setup.typoscript | 2 + Documentation/Developer/Index.rst | 2 +- 13 files changed, 137 insertions(+), 86 deletions(-) rename Configuration/TypoScript/{ContentElement => Helpers}/ParseFunc.typoscript (74%) create mode 100755 Configuration/TypoScript/Helpers/RenderChildren.typoscript diff --git a/Classes/DataProcessing/DatabaseQueryProcessor.php b/Classes/DataProcessing/DatabaseQueryProcessor.php index 6ef97268..7bc1cd64 100644 --- a/Classes/DataProcessing/DatabaseQueryProcessor.php +++ b/Classes/DataProcessing/DatabaseQueryProcessor.php @@ -37,7 +37,7 @@ * bodytext = TEXT * bodytext { * field = bodytext - * parseFunc =< lib.parseFunc_links + * parseFunc =< lib.parseFunc_RTE * } * link = TEXT * link { diff --git a/Configuration/TypoScript/2.x/ContentElement/Text.typoscript b/Configuration/TypoScript/2.x/ContentElement/Text.typoscript index 1f64fb10..2e2dd796 100755 --- a/Configuration/TypoScript/2.x/ContentElement/Text.typoscript +++ b/Configuration/TypoScript/2.x/ContentElement/Text.typoscript @@ -6,7 +6,7 @@ tt_content.text { bodytext = TEXT bodytext { field = bodytext - parseFunc =< lib.parseFunc_links + parseFunc =< lib.parseFunc_RTE } } } diff --git a/Configuration/TypoScript/2.x/ContentElement/Textmedia.typoscript b/Configuration/TypoScript/2.x/ContentElement/Textmedia.typoscript index 869154d4..e8ffc070 100755 --- a/Configuration/TypoScript/2.x/ContentElement/Textmedia.typoscript +++ b/Configuration/TypoScript/2.x/ContentElement/Textmedia.typoscript @@ -7,7 +7,7 @@ tt_content.textmedia { bodytext = TEXT bodytext { field = bodytext - parseFunc =< lib.parseFunc_links + parseFunc =< lib.parseFunc_RTE } gallery = TEXT gallery { diff --git a/Configuration/TypoScript/2.x/ContentElement/Textpic.typoscript b/Configuration/TypoScript/2.x/ContentElement/Textpic.typoscript index afd759c6..2c4d47b4 100755 --- a/Configuration/TypoScript/2.x/ContentElement/Textpic.typoscript +++ b/Configuration/TypoScript/2.x/ContentElement/Textpic.typoscript @@ -7,7 +7,7 @@ tt_content.textpic { bodytext = TEXT bodytext { field = bodytext - parseFunc =< lib.parseFunc_links + parseFunc =< lib.parseFunc_RTE } gallery = TEXT gallery { diff --git a/Configuration/TypoScript/2.x/Helper/ParseFunc.typoscript b/Configuration/TypoScript/2.x/Helper/ParseFunc.typoscript index 903b0758..b586825f 100755 --- a/Configuration/TypoScript/2.x/Helper/ParseFunc.typoscript +++ b/Configuration/TypoScript/2.x/Helper/ParseFunc.typoscript @@ -6,22 +6,15 @@ lib { makelinks { http { keep = {$styles.content.links.keep} - extTarget.data = parameters:target + extTarget = {$styles.content.links.extTarget} } + mailto { keep = path } } + tags { - link = TEXT - link { - current = 1 - typolink { - parameter.data = parameters : allParams - extTarget.data = parameters:target - } - parseFunc.constants = 1 - } a = TEXT a { current = 1 @@ -29,14 +22,24 @@ lib { parameter.data = parameters:href title.data = parameters:title ATagParams.data = parameters:allParams - target.data = parameters:target - extTarget.data = parameters:target + # the target attribute takes precedence over config.intTarget + target.ifEmpty.data = parameters:target + # the target attribute takes precedence over the constant (styles.content.links.extTarget) + # which takes precedence over config.extTarget + # do not pass extTarget as reference, as it might not be set resulting in the string being + # written to the target attribute + extTarget { + ifEmpty < config.extTarget + ifEmpty.override = {$styles.content.links.extTarget} + override.data = parameters:target + } } } } + allowTags = {$styles.content.allowTags} denyTags = * - sword = | + # @deprecated since TYPO3 v12, remove with v13 constants = 1 nonTypoTagStdWrap { HTMLparser = 1 @@ -51,19 +54,22 @@ lib { parseFunc_RTE < lib.parseFunc parseFunc_RTE { # Processing
    ,