TSRef - TypoScript Reference
5.1.10. encapsLines
|
Property: |
Data type: |
Description: |
Default: |
|---|---|---|---|
|
encapsTagList |
list of strings |
List of tags which qualify as encapsulating tags. Must be lowercase.
Example: encapsTagList = div, p
This setting will recognize the red line below as encapsulated lines:
First line of text Some <div>text</div> <p>Some text</p> <div>Some text</div> <B>Some text</B> |
|
|
remapTag.[tagname] |
string |
Enter a new tag name here if you wish the tagname of any encapsulation to be unified to a single tag name.
For instance, setting this value to "remapTags.P=DIV" would convert:
<p>Some text</p> <div>Some text</div>
to
<div>Some text</div> <div>Some text</div>
([tagname] is in uppercase.) |
|
|
addAttributes.[tagname] |
array of strings |
Attributes to set in the encapsulation tag.
Example: addAttributes.P { style=padding-bottom:0px; margin-top:1px; margin-bottom:1px; align=center }
([tagname] is in uppercase.)
.setOnly = exists : This will set the value ONLY if the property does not already exist blank : This will set the value ONLY if the property does not already exist OR is blank ("")
Default is to always override/set the attributes value. |
|
|
removeWrapping |
boolen |
If set, then all existing wrapping will be removed.
This:
First line of text Some <div>text</div> <p>Some text</p> <div>Some text</div> <B>Some text</B>
becomes this:
First line of text Some <div>text</div> Some text Some text <B>Some text</B> |
|
|
wrapNonWrappedLines |
wrap |
Wrapping for non-encapsulated lines
Example: .wrapNonWrappedLines = <P>|</P>
This:
First line of text <p>Some text</p>
becomes this:
<P>First line of text</P> <p>Some text</p> |
|
|
innerStdWrap_all |
->stdWrap |
Wraps the content inside all lines, whether they are encapsulated or not. |
|
|
encapsLinesStdWrap.[tagname] |
->stdWrap |
Wraps the content inside all encapsulated lines. ([tagname] is in uppercase.) |
|
|
defaultAlign |
string /stdWrap |
If set, this value is set as the default "align" value of the wrapping tags, both from .encapsTagList, .bypassEncapsTagList and .nonWrappedTag |
|
|
nonWrappedTag |
tagname |
For all non-wrapped lines, you can set here which tag it should be wrapped in. Example would be "P". This is an alternative to .wrapNonWrappedLines and has the advantage that it's attributes are set by .addAttributes as well as defaultAlign. Thus you can easier match the wrapping tags used for nonwrapped and wrapped lines. |
|
[tsref:->encapsLines]
Example:
encapsLines {
encapsTagList = div,p
remapTag.DIV = P
wrapNonWrappedLines = <P>|</P>
innerStdWrap_all.ifEmpty =
}
This example shows how to handle content rendered by TYPO3 and stylesheets where the <P> tag is used to encapsulate each line.
Say, you have made this content with the Rich Text Editor:
This is line # 1
[Above is an empty line!]
<DIV align=right>This line is right-aligned</DIV>
After being processed by encapsLines with the above configuration, the content looks like this:
<P>This is line # 1 </P>
<P> </P>
<P>[Above is an empty line!] </P>
<P align="right">This line is right-aligned</P>
Each line is nicely wrapped with <P> tags. The line from the database which was already wrapped (but in <DIV>-tags) has been converted to <P>, but keeps it's alignment. Overall, notice that the Rich Text Editor ONLY stored the line which was in fact right-aligned - every other line from the RTE was stored without any wrapping tags, so that the content in the database remains as human readable as possible.
Example:
# Make sure nonTypoTagStdWrap operates on content outside <typolist> and <typohead> only:
tt_content.text.20.parseFunc.tags.typolist.breakoutTypoTagContent = 1
tt_content.text.20.parseFunc.tags.typohead.breakoutTypoTagContent = 1
# ... and no <BR> before typohead.
tt_content.text.20.parseFunc.tags.typohead.stdWrap.wrap >
# Setting up nonTypoTagStdWrap to wrap the text with P-tags
tt_content.text.20.parseFunc.nonTypoTagStdWrap >
tt_content.text.20.parseFunc.nonTypoTagStdWrap.encapsLines {
encapsTagList = div,p
remapTag.DIV = P
wrapNonWrappedLines = <P style="margin:0 0 0;">|</P>
# Forcing these attributes onto the encapsulation-tags if any
addAttributes.P {
style=margin:0 0 0;
}
innerStdWrap_all.ifEmpty =
innerStdWrap_all.textStyle < tt_content.text.20.textStyle
}
# finally removing the old textstyle formatting on the whole bodytext part.
tt_content.text.20.textStyle >
# ... and <BR>-tag after the content is not needed either...
tt_content.text.20.wrap >
This is an example of how to wrap traditional tt_content bodytext with <P> tags, setting the line-distances to regular space like that generated by a <BR> tag, but staying compatible with the RTE features such as assigning classes and alignment to paragraphs.