W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎勵
{textformat}
是一個用于格式化文本的 塊函數(shù)。 它一般會清理空格和特殊字符,該函數(shù)主要清理空格和特殊字符,對段落按單詞邊界換行和行縮進(jìn)等段落格式化處理。
你可以明確指定參數(shù),或者使用預(yù)設(shè)風(fēng)格。當(dāng)前“email”是唯一可用的風(fēng)格。
參數(shù)名稱 | 類型 | 必選參數(shù) | 默認(rèn)值 | 說明 |
---|---|---|---|---|
style | string | No | n/a | 預(yù)設(shè)風(fēng)格 |
indent | number | No | 0 | 每行縮進(jìn)的字符數(shù) |
indent_first | number | No | 0 | 首行縮進(jìn)的字符數(shù) |
indent_char | string | No | (single space) | 縮進(jìn)使用的字符 |
wrap | number | No | 80 | 每行長度(換行) |
wrap_char | string | No | \n | 斷行使用的字符 |
wrap_cut | boolean | No | FALSE | 設(shè)置TRUE 將會按字符換行,而不是按單詞邊界換行。 |
assign | string | No | n/a | 將輸出的內(nèi)容賦值到模板變量 |
Example 8.22. {textformat}
{textformat wrap=40} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
輸出:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
{textformat wrap=40 indent=4} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
輸出:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
{textformat wrap=40 indent=4 indent_first=4} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
輸出:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
{textformat style="email"} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
輸出:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
參見 {strip}
和 自動換行
.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: