ホーム › ドキュメント › TSリファレンス › 関数: › encapsLines

5.10. encapsLines

プロパティ:

データタイプ:

説明:

デフォルト:

encapsTagList

list of strings

カプセル化タグとして有効となるタグのリスト小文字でなければならない。

 

例:

encapsTagList = div, p

 

この設定は下記赤線をカプセル化された行と認識する:

 

First line of text

Some <div>text</div>

<p>Some text</p>

<div>Some text</div>

<B>Some text</B>

 

remapTag.[tagname]

string

なにかのカプセル化のtagnameを単一のタグネームに統一したい場合は、ここで新しいタグネームを入力する。

 

例えば、この値を“remapTags.P=DIV”へ設定すると:

 

<p>Some text</p>

<div>Some text</div>

 

 

<div>Some text</div>

<div>Some text</div>

へ変換する。

([tagname] は大文字)

 

addAttributes.[tagname]

array of strings

カプセル化タグを付けるための属性。

 

例:

addAttributes.P {

  style=padding-bottom:0px; margin-top:1px; margin-bottom:1px;

  align=center

}

 

([tagname] は大文字)

 

.setOnly =

exists : プロパティがまだ存在していないときだけ値を設定する

blank : プロパティがまだ存在していないか、ブランク(“”)のときだけ値を設定する

 

デフォルトでは常に属性値を無効又は設定する。

 

removeWrapping

boolen

設定すると、存在するラッピングはすべて取り除かれる。

 

以下は:

 

First line of text

Some <div>text</div>

<p>Some text</p>

<div>Some text</div>

<B>Some text</B>

 

次のようになる:

 

First line of text

Some <div>text</div>

Some text

Some text

<B>Some text</B>

 

wrapNonWrappedLines

wrap

非カプセル化の行のラッピング

 

例:

.wrapNonWrappedLines = <P>|</P>

 

以下は:

 

First line of text

<p>Some text</p>

 

以下のようになる:

 

<P>First line of text</P>

<p>Some text</p>

 

innerStdWrap_all

->stdWrap

すべての行の中のコンテンツを、カプセル化されていてもいなくてもラップする。

 

encapsLinesStdWrap.[tagname]

->stdWrap

カプセル化されたすべての行の中のコンテンツをラップする。

([tagname] は大文字)

 

defaultAlign

string /stdWrap

設定された場合、この値は.encapsTagList, .bypassEncapsTagList と.nonWrappedTag両方からのラッピングタグのデフォルト”アライン”値として設定される。

 

nonWrappedTag

tagname

ラップされていないすべての行については、ここでどのタグがラップされるようにするべきかということを設定できる。例は“P”である。これは.wrapNonWrappedLinesの代わりであり、その属性は.addAttributes とdefaultAlign によって設定されるという利点がある。このようにラップされていない行、ラップされている行両方に使われているラッピングタグに容易に適合させられる。

 

[tsref:->encapsLines]

例:

encapsLines {
  encapsTagList = div,p
  remapTag.DIV = P
  wrapNonWrappedLines = <P>|</P>
  innerStdWrap_all.ifEmpty =  
}

この例はTYPO3と各行をカプセル化するのに<P>タグが使われたところのstylesheetsによってレンダリングされたコンテンツの取り扱い方を示している。

このコンテンツはRich Text Editorで作成した:

 

This is line # 1
[Above is an empty line!]
<DIV align=right>This line is right-aligned</DIV>

上記コンフィグレーションでencapsLinesによって処理された後、コンテンツは以下のように現れる:

<P>This is line # 1 </P>
<P> </P>
<P>[Above is an empty line!] </P>
<P>This line is right-aligned</P>

各行は<P>タグでうまくラップされている。すでにラップされた(しかし<DIV>タグのついた)データベースからの行は<P>へ変換されているが、そのアラインメントは維持している。全体的に言うならば、Rich Text Editorは実際右ぞろえの行を保存しただけ、すなわちRTEから一行おきにラッピングタグを付けずに保存される、だからデータベースのコンテンツは可能な限り人間に解読可能なままであるということに留意しておく。

例:

# 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>|</P>
 

  # Forcing these attributes onto the encapsulation-tags if any

  addAttributes.P {
    style=margin:0 0 0;
  }
  innerStdWrap_all.ifEmpty = &nbsp;
  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 >

これは、traditional tt_content bodytextを<P>タグでラップする方法を示した例で、<BR>タグによって生成されたように行間隔をレギュラースペースに設定しているが、クラスやアラインメントをパラグラフにアサインするといったようなRTEの機能との互換性はそのままキープしている。