From bd1e7333ce1f9f2bb05f424ee3cdb8ae91e2fac5 Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Mon, 23 Mar 2026 08:10:20 +0100 Subject: [PATCH] [TASK] Improve the format.html docs Releases: main, 13.4 --- Documentation/Global/Format/Html.rst | 165 +++++++++++++++++++++------ 1 file changed, 127 insertions(+), 38 deletions(-) diff --git a/Documentation/Global/Format/Html.rst b/Documentation/Global/Format/Html.rst index d20697c..48f208d 100644 --- a/Documentation/Global/Format/Html.rst +++ b/Documentation/Global/Format/Html.rst @@ -9,83 +9,172 @@ Format.html ViewHelper `` .. typo3:viewhelper:: format.html :source: ../../Global.json + :display: tags,description,gitHubLink + :noindex: + +.. contents:: Table of contents .. _typo3-fluid-format-html-example: -Examples -======== +Using the `` ViewHelper with default arguments +============================================================= + +.. code-block:: html + + + {$myConstant.project} is a cool CMS + (TYPO3). + + +.. code-block:: html + +

TYPO3 is a cool CMS + (TYPO3).

+ +The exact output depends on TYPO3 constants. + +.. _typo3-fluid-format-html-arguments: + +Arguments of the `` ViewHelper +============================================= + +.. typo3:viewhelper:: format.html + :source: ../../Global.json + :display: arguments-only + +.. _typo3-fluid-format-html-parseFunc: + +parseFuncTSPath argument: formatting text with a custom parsing function +------------------------------------------------------------------------ -Default parameters ------------------- +The `parseFuncTSPath` argument specifies which TypoScript `parseFunc` +configuration is used to process the content. -:: +.. code-block:: html - {$myConstant.project} is a cool CMS (TYPO3). + + {someText} + -Output:: +or inline: -

TYPO3 is a cool CMS (TYPO3).

+.. code-block:: html -Depending on TYPO3 constants. + {someText -> f:format.html(parseFuncTSPath: 'lib.myParseFunc')} -Custom parseFunc ----------------- +With a custom parsing function defined in TypoScript: -:: +.. code-block:: typoscript + :caption: config/site/mysite/setup.typoscript - TYPO3 is a cool CMS (TYPO3). + lib.myParseFunc < lib.parseFunc + lib.myParseFunc { + // replace --- with soft-hyphen + short.--- = ­ + } -Output:: +.. seealso:: - TYPO3 is a cool CMS (TYPO3). + For all options see the + `TypoScript reference, chapter parseFunc `_. + +.. _typo3-fluid-format-html-arguments-data: Data argument -------------- -If you work with TypoScript :typoscript:`field` property, you should add the current record as `data` -to the ViewHelper to allow processing the `field` and `dataWrap` properties correctly. +If you use TypoScript properties such as :typoscript:`field` or :typoscript:`dataWrap`, +you should pass the current record as `data`. This ensures that field references like +`{FIELD:title}` are resolved correctly. + +.. code-block:: html + + + News title: + + +You may get the following output: + +.. code-block:: html + + News title: TYPO3, greatest CMS ever -:: +With a custom parsing function defined in TypoScript: - News title: +.. code-block:: typoscript + :caption: config/site/mysite/setup.typoscript -After "dataWrap = |{FIELD:title}" you may have this Output:: + lib.myParseFunc < lib.parseFunc + lib.myParseFunc { + dataWrap = |{FIELD:title} + } - News title: TYPO3, greatest CMS ever +.. _typo3-fluid-format-html-arguments-data-current: Current argument ----------------- -Use the `current` argument to set the current value of the content object. +Use the `current` argument to override the current value used by the TypoScript +content object. -:: +.. code-block:: html - I'm gone + + I'm gone + -After `setContentToCurrent = 1` you may have this output:: +You may get the following output: - Thanks Kasper for this great CMS +.. code-block:: html + + Thanks Kasper for this great CMS + +With the following custom parsing function defined in TypoScript: + +.. code-block:: typoscript + :caption: config/site/mysite/setup.typoscript + + lib.myParseFunc < lib.parseFunc + lib.myParseFunc { + setContentToCurrent = 1 + } + +.. _typo3-fluid-format-html-arguments-data-CurrentValueKey: CurrentValueKey argument ------------------------- -Use the `currentValueKey` argument to define a value of data object as the current value. - -:: +Use the `currentValueKey` argument to define a value of data object as the +current value. - Content: +.. code-block:: html -After `dataWrap = |{CURRENT:1}` you may have this Output:: + + Content: + - Content: How to install TYPO3 in under 2 minutes ;-) +You may get the following output: -Inline notation ---------------- +.. code-block:: html -:: + Content: How to install TYPO3 in under 2 minutes ;-) - {someText -> f:format.html(parseFuncTSPath: 'lib.parseFunc')} +With the following custom parsing function defined in TypoScript: -Output:: +.. code-block:: typoscript + :caption: config/site/mysite/setup.typoscript - TYPO3 is a cool CMS (TYPO3). + lib.myParseFunc < lib.parseFunc + lib.myParseFunc { + dataWrap = |{CURRENT:1} + }