我試圖在我們的wiki中設置一個頁面,該頁面覆蓋了我們軟件中特定操作符的某些參數。 軟件中的每個參數都可以是特定的類型,如「菜單」或「切換」。將參數傳遞給嵌套模板
所以我想我會創建2個模板。首先被稱爲「參數」,其次被稱爲「菜單」。
參數模板看起來是這樣的:
'''{{{label}}}''' <code>{{{name}}}</code> - {{{summary}}}
{{{items}}}
和菜單模板看起來是這樣的:
* {{{label}}} <code>{{{name}}}</code> - {{{summary}}}
爲我的網頁的內容是這樣的:
{{Parameter
|type=menu
|label=Interpolation
|name=interp
|items=
{{
{{menu|name=nointerp|label=No Interpolation|summary=Use the value of the nearest sample.}}
|{{menu|name=linear|label=Linear|summary=Use linear interpolation between samples when the interval is lengthened. Averages all samples near the new sample when the interval is shortened.}}
|{{menu|name=cubic|label=Cubic|summary=Cubically interpolates between samples, for smoother curves than Linear. This method is not recommended for channels with sharp changes.}}
|{{menu|name=edge|label=Pulse Preserve|summary=A linear interpolation that recognizes single sample pulses and preserves their height and one sample width. A pulse is a non-zero value preceded and followed by zero-value samples.}}
}}
|summary=The interpolation method to use when resampling.}}
這幾乎可以工作,但我得到額外的字符,如「{」和「|」在實際頁面上呈現。
我的問題我猜是:是否有可能傳遞參數到「子模板」的方式,我這樣做?
非常感謝您
不,你不能將參數傳遞給子模板,但是這不是你在這裏做的。您將模板作爲參數傳遞給另一個模板。這很好,雖然你在這裏似乎有一堆不匹配的大括號。 – Tgr
謝謝。這就是它。我想我需要通過參數,但調用其他模板是我實際上在做什麼。 –