.. include:: /Includes.rst.txt .. index:: Functions; parseFunc parseFunc .. _parsefunc: ========= parseFunc ========= This object is used to parse some content for stuff like special typo tags, the :ref:`makeLinks`-things and so on... .. contents:: :local: .. index:: parsefunc; Properties .. _parsefunc-properties: Properties ========== .. _parsefunc-externalBlocks: externalBlocks -------------- .. confval:: externalBlocks :name: parsefunc-externalBlocks :type: list of tagnames / +properties This allows you to pre-split the content passed to parseFunc so that only content outside the blocks with the given tags is parsed. **Extra properties:** **.[tagname]** { * **callRecursive:** :ref:`data-type-boolean`. If set, the content of the block is directed into parseFunc again. Otherwise the content is passed through with no other processing than :ref:`stdwrap` (see below). * **callRecursive.dontWrapSelf:** :ref:`data-type-boolean`. If set, the tags of the block is *not* wrapped around the content returned from parseFunc. * **callRecursive.alternativeWrap:** Alternative wrapping instead of the original tags. * **callRecursive.tagStdWrap:** :ref:`stdwrap` processing of the block-tags. * **stdWrap:** :ref:`stdwrap` processing of the whole block (regardless of whether callRecursive was set.) * **stripNLprev:** :ref:`data-type-boolean`. Strips off last line break of the previous outside block. * **stripNLnext:** :ref:`data-type-boolean`. Strips off first line break of the next outside block. * **stripNL:** :ref:`data-type-boolean`. Does both of the above. * **HTMLtableCells:** :ref:`data-type-boolean`. If set, then the content is expected to be a table and every table-cell is traversed. Below, "default" means all cells and "1", "2", "3", ... overrides for specific columns. * **HTMLtableCells.[default/1/2/3/...]** { * **callRecursive:** :ref:`data-type-boolean`. The content is parsed through current parseFunc. * **stdWrap:** :ref:`stdwrap` processing of the content in the cell. * **tagStdWrap:** -> The :html:`
` will have a :php:`chr(10)` inserted between them.
.. rubric:: Example
This example is used to split regular bodytext content so that tables
and blockquotes in the bodytext are processed correctly. The
blockquotes are passed into parseFunc again (recursively) and further
their top/bottom margins are set to 0 (so no apparent line breaks are
seen)
The tables are also displayed with a number of properties of the cells
overridden
.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
tt_content.text.20.parseFunc.externalBlocks {
blockquote.callRecursive = 1
blockquote.callRecursive.tagStdWrap.HTMLparser = 1
blockquote.callRecursive.tagStdWrap.HTMLparser {
tags.blockquote.fixAttrib.style.list = margin-bottom:0;margin-top:0;
tags.blockquote.fixAttrib.style.always = 1
}
blockquote.stripNLprev = 1
blockquote.stripNLnext = 1
table.stripNL = 1
table.stdWrap.HTMLparser = 1
table.stdWrap.HTMLparser {
tags.table.overrideAttribs = border="0" style="margin-top: 10px;"
tags.tr.allowedAttribs = 0
tags.td.overrideAttribs = class="table-cell" style="font-size: 10px;"
}
}
.. _parsefunc-short:
short
-----
.. confval:: short
:name: parsefunc-short
:type: *(array of strings)*
If this property is set, you can replace a char or word
in your text with the value of the according constant.
.. rubric:: Example
This replaces all occurrences of "T3" with "TYPO3 CMS"
and "T3web" with a link to typo3.org.
.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
page.10 = TEXT
page.10.value = Learn more about T3, look here: T3web
page.10.parseFunc.short {
T3 = TYPO3 CMS
T3web = typo3.org
}
# Output: Learn more about TYPO3 CMS, look here: typo3.org
.. _parsefunc-plainTextStdWrap:
plainTextStdWrap
----------------
.. confval:: plainTextStdWrap
:name: parsefunc-plainTextStdWrap
:type: :ref:`stdwrap`
This is :ref:`stdwrap` properties for all non-tag content.
.. _parsefunc-userFunc:
userFunc
--------
.. confval:: userFunc
:name: parsefunc-userFunc
:type: :ref:`data-type-function-name`
This passes the non-tag content to a function of your own choice.
Similar to, for example, :ref:`stdwrap-postUserFunc` in :ref:`stdWrap`,
or :ref:`typolink.userFunc Example underlined text |` -tags to exist:
.. code-block:: typoscript
:caption: EXT:site_package/Configuration/TypoScript/setup.typoscript
tt_content.text.20.parseFunc {
allowTags = b,i,a,img
denyTags = *
}
.. _parsefunc-if:
if
--
.. confval:: if
:name: parsefunc-if
:type: :ref:`if`
if "if" returns false, the input value is not parsed, but returned
directly.
.. _parsefunc-examples:
Example
=======
This example takes the content of the field "bodytext" and parses it
through the :ref:`parsefunc-makelinks`-functions and substitutes all
:html:`` and :html:`
20.stdWrap.brTag =
20.stdWrap.parseFunc {
makelinks = 1
makelinks.http.keep = path
makelinks.http.extTarget = _blank
makelinks.mailto.keep = path
tags {
link = TEXT
link {
stdWrap.current = 1
stdWrap.typolink.extTarget = _blank
stdWrap.typolink.target = {$cLinkTagTarget}
stdWrap.typolink.wrap =