糖耐是检查什么| 满面红光是什么意思| 什么地赞叹| 是什么歌曲| 父母都是o型血孩子是什么血型| 八月十八号是什么星座| 子宫癌筛查做什么检查| 18kgp是什么材质| 转基因和非转基因有什么区别| 慢性浅表性胃炎吃什么药| 嘴咸是什么原因| 气滞血瘀吃什么中成药| 健硕是什么意思| 龙的三合生肖是什么| 手足口病挂什么科| 2023年属什么| 涌泉穴在什么位置| 什么是恒牙| 县副局长是什么级别| 吃什么能排湿气| 硫酸羟氯喹片是治什么病| 轻度脂肪肝吃什么药| 蓝色加红色等于什么颜色| 以逸待劳是什么意思| 成人高考是什么| 右手麻木是什么原因引起的| 脉跳的快是什么原因| 含羞草为什么害羞| 九月二十六是什么星座| 枸杞和山楂泡水喝有什么功效| 三月二十二是什么星座| 操姓氏读什么| 石字旁有什么字| 为什么一站起来就头晕眼前发黑| 铁路12306什么时候放票| 降血脂喝什么茶最好| 喝红枣水有什么好处和坏处| 妈妈的手像什么| 人造海蜇丝是什么做的| 头顶头发稀少是什么原因| 11月29号什么星座| 夏季有什么花| 五月二十日是什么星座| adh是什么激素| 扭捏是什么意思| 无限极是干什么的| 甲状腺密度不均匀是什么意思| 什么东西养胃又治胃病| 子宫小有什么影响| 孕囊形态欠规则是什么意思| 右下眼皮跳是什么原因| 什么是brt| 1月3号什么星座| 什么治咳嗽最快最有效| 爱奇艺积分有什么用| 七月十四是什么节| 肾虚腰疼吃什么药最有效| 妗是什么意思| ipad什么时候出新款| 贫嘴是什么意思| 膝盖疼痛什么原因| 肱骨头小囊变什么意思| 利多卡因是什么| 敏感是什么意思| 豆腐吃多了有什么坏处| 椰青是什么| 玫瑰花和什么一起泡水喝好| 脐疝是什么| 36 80是什么罩杯| 孩子爱流鼻血是什么原因| 美国fda认证是什么| 枭念什么| 息肉是什么东西| 胆固醇高吃什么| 昙花一现是什么生肖| 天壤之别是什么意思| nba什么时候开始| 议员在中国相当于什么| 检查肝挂什么科| 牙周炎有什么症状| 割包皮挂什么科室| 甲状腺球蛋白抗体高是什么意思| 头眩晕看什么科| 喉咙发炎吃什么| 褶是什么意思| 乳糖是什么糖| 梦到挖坟墓是什么意思| 吃什么菜对眼睛好| 恭敬地看的词语是什么| 梦见自己开车是什么意思| 前白蛋白高是什么意思| 投射效应是什么意思| 梦见猫咬我是什么意思| 蛋疼是什么原因引起的| 品牌背书是什么意思| 列文虎克发现了什么| 月和什么有关| 爱屋及乌是什么意思| 取关是什么意思| 灵芝有什么作用| 养膘是什么意思| 爱打扮的女人说明什么| 4月29日是什么星座| 广西有什么特产| 晚上7点是什么时辰| 脂肪的克星是什么| 嘌呤是什么| 梦见剪头发预示什么| 才美不外见的见是什么意思| 乳酸杆菌大量是什么意思| 什么利尿| scr医学上是什么意思| 4a广告公司什么意思| 西兰花是什么季节的蔬菜| 疝气嵌顿是什么意思| 生殖疱疹用什么药效果好| 中央办公厅主任什么级别| 国家能源局是什么级别| edm是什么| 长沙有什么学校| 嗑药是什么意思| 什么是社会| 月指什么生肖| 蝙蝠是什么类动物| 常喝普洱茶有什么好处| 小拇指和无名指发麻是什么原因| 兰姓是什么民族| 紫花地丁有什么功效| 为什么血压高| 卡西欧属于什么档次| 脚扭伤挂什么科| 荷叶泡水喝有什么作用| 授记是什么意思| 天安门以前叫什么| 风向标是什么意思| 桔子树用什么肥料最好| 蕃秀什么意思| 为什么刚小便完又有尿意| 善莫大焉是什么意思| 海马是什么类动物| 品质是什么| 手足口用什么药| 什么茶降尿酸| 深覆合是什么样子的| 做梦梦见前男友是什么意思| 老枞是什么茶| 嘴巴长疱疹是什么原因| 喉咙疼痛吃什么药效果最好| 十二点是什么时辰| 补钾用什么药| smzco是什么药片| 怎么看微信好友什么时候加的| 男性湿热吃什么药最好| 今年56岁属什么生肖| 易是什么意思| 什么是乳头瘤| 盘根是什么| 松鼠尾巴有什么作用| 心跳过速是什么原因| 1月17号是什么星座| 南非叶有什么功效| 盎司是什么单位| 胃胀气吃什么药见效快| 真丝丝绒是什么面料| 孩子b型血父母什么血型| 上山下水什么字| 青团是什么节日吃的| 就绪是什么意思| 狗狗打喷嚏流鼻涕怎么办吃什么药| 降钙素原高是什么原因| 男人阴茎硬不起来是什么原因| 1985年属牛是什么命| 梦见海水是什么意思| 生姜放肚脐眼有什么功效| 溶豆是什么| 观察是什么意思| 扁桃体发炎挂什么科| 舌头发白是什么情况| hpv亚型是什么意思| 咽炎用什么药好| 受凉咳嗽吃什么药| 奥硝唑和甲硝唑有什么区别| 就藩什么意思| 异常灌注是什么意思| 基数大是什么意思| max是什么意思| 胃镜挂什么科| 鹅梨帐中香是什么| 维生素b什么时候吃效果最好| 什么书最香| 光年是什么单位| 愚昧是什么意思| 锐减是什么意思| 为什么床上有蚂蚁| 吃什么对肾有好处| 癫痫病是什么病| 吃软饭是什么意思| 什么是集合| 晚秋是什么意思| 青岛为什么叫青岛| 早上吃什么减肥| 梦见黄金是什么意思| 622188开头是什么银行| 肛门瘙痒是什么病| 脚凉吃什么药| 太阳筋疼是什么原因| 坐享其成是什么意思| 防晒衣什么面料好| 十斋日是什么意思| 男性裆部瘙痒用什么药好| 热疙瘩用什么药膏| 背疼是什么原因引起的女人| 小孩白细胞高是什么原因| 狮子座女和什么座最配| 乙肝病毒携带者有什么症状| 阴道里面有个肉球是什么| snoopy是什么意思| 痛风什么不能吃| 导演是干什么的| 血压不稳定是什么原因| 什么叫体位性低血压| 万里长城是什么生肖| 竹笋不能和什么一起吃| 苦肠是什么部位| 房颤有什么症状| 病理会诊是什么意思| 良辰是什么意思| 尿道炎挂什么科| 地瓜不能和什么一起吃| 聋哑人为什么不会说话| 苹果五行属什么| k9是什么意思| 二次报销需要什么条件| 赢荡为什么传位嬴稷| 大便干燥拉不出来是什么原因| 保姆是什么意思| 为什么耳鸣一直不停| 补体c3偏低是什么意思| 清炖排骨放什么调料| 手控是什么意思| 毛爷爷是什么意思| 排卵试纸强阳说明什么| 什么是尿毒症| 土地出让金什么意思| 梦见蜘蛛网是什么意思| 生物医学工程专业学什么| 天气热吃什么解暑| 胰腺炎有什么症状| 小腹胀是什么原因女性| 权衡是什么意思| 杨梅是什么季节的水果| 狗狗湿疹用什么药膏最有效| 3岁小孩不会说话是什么原因| 支气管炎不能吃什么| 原发性高血压什么意思| 孩子脚后跟疼是什么原因| 鞠婧祎什么星座| 36岁生日有什么讲究| 云加一笔是什么字| 1936年中国发生了什么| 备孕检查什么项目| bc什么意思| 什么是生命之本| 一直不射精是什么原因| 百度Jump to content

担心贸易摩擦影响美出口 大豆期价下跌

From Wikipedia, the free encyclopedia
百度 《永远在路上——践行“三严三实”大家谈征文活动获奖作品集》为推进“三严三实”专题教育深入扎实开展,拓宽各级党组织和广大党员干部学习教育载体和互动交流渠道,经中直工委领导批准,中直党建网联合人民网·中国共产党新闻网于2015年5月至2016年1月在各级党组织和广大党员干部群众中开展了“践行‘三严三实’大家谈”征文活动。

Substitution is a function whereby, when an editor saves a page, an item in the wikicode is permanently replaced with its current value. In particular, templates and magic words can be substituted, as an alternative to transclusion. The difference is that when a template is substituted on a page, its appearance on that page will no longer be affected by later changes made to the template itself (as is the case in a transcluded template).

Substitution is done using the subst: modifier after the double opening braces. For example, to substitute the template {{Article for deletion}}, type {{subst:Article for deletion}}. You can check the resulting wikitext before saving by clicking "Show changes" (and see what the page will look like by clicking "Show preview").

Variables and parser functions can also be substituted, meaning that their current value will be recorded permanently on the page – they will not be re-evaluated whenever someone views the page.

When to use substitution

[edit]

Generally speaking, templates are transcluded rather than substituted, although there are some that are specifically designed to be substituted (and may not work if transcluded). Some reasons for substituting templates include:

  • making the resulting page independent of future changes to the template
  • enabling other automatic replacements to occur (for example, a template may contain four tildes, which will be replaced by the user's signature and timestamp provided the template is substituted)
  • enabling the page to be copied to another project without copying the template
  • making page rendering faster for the server
  • making the correspondence between wikitext and rendered page easier to understand (the opposite may also apply)

Disadvantages of substitution may include:

  • Updates to the template will not be reflected on the target page
  • The resulting wikitext is longer and more complicated
  • Other users cannot see that the text was produced using a template (and will not learn to use the template)
    • Many templates add a hidden comment such as <!-- Template:Foo --> to the end of their output to mitigate this issue.

Time-dependent variables are substituted to make the rendered page independent of the time at which it is viewed. Substituting page-dependent variables makes the resulting wikitext independent of renaming of the page and of copying to another page.

For more detailed guidance, including lists of templates which should or should not be substituted, see Wikipedia:Substitution.

Syntax

[edit]

To substitute a template, use the same syntax as for transclusion, but include subst: after the opening double braces. For example, to substitute the template {{afd}}, type {{subst:afd}}. Parameters can be included as in the case of transclusion, for example {{subst:afd|Some article}}.

Pages not in the template namespace can also be substituted, e.g. {{subst:User:Cleverclogs/My box}}. To substitute the current content of a page in mainspace (i.e. one with no namespace prefix), two colons are required, as in {{subst::Page}}. If a substituted page or template does not exist, the entire expression (with braces and subst:) will remain unchanged in the wikitext and on the page.

Use the same syntax to substitute variables and parser functions, e.g. {{subst:PAGENAME}} or {{subst:#switch:{{NUMBEROFADMINS}}|1=Foo|1000=Bar|#default=Baz}}.

There may be whitespace between the opening braces and the "subst:". However it is recommended not to have any space or newlines immediately after the "subst:", as this will not work in every case.

Technical implementation

[edit]

Substitution is part of the process performed on saving a page, and causes the wikitext saved as a result of the edit to differ from the text which the user actually entered in the edit window. Other replacements performed during this process include expansion of links using the pipe trick, and replacement of multiple tildes with signatures and timestamps.

This means that substitution necessarily occurs before any actions performed at the time of page rendering (conversion of the stored wikitext to HTML). In particular, substitutions are done before transclusions. So typing {{subst:Help:L{{in(tut)}}k}} will not do substitution, even though {{in(tut)}} returns the text "in" and Help:Link exists. The transclusion of {{in(tut)}} has not yet taken place when the substitution is attempted. However, replace {{in(tut)}} with {{subst:in(tut)}}, and both substitutions will be performed in the expected order.

Similarly:

  • Typing {{subst:#if:{{x0}}|yes|no}} gives the wikitext "yes", even though {{x0}} is an empty template, since the conditional parameter evaluates to the non-empty string "{{x0}}". However {{subst:#if:{{subst:x0}}|yes|no}} produces "no", since the inner substitution is performed first.
  • Typing {{subst:#expr:2*{{{p|3}}}}} returns Expression error: unrecognised punctuation character "{", as the undefined parameter {{{p}}} has not been replaced by its default value (3) when the substitution occurs.
  • If {{t6}} contains the text "t2|a", then {{ {{subst:t6}} }} will produce the wikitext "{{ t2|a }}", rendered as "[[w:List of people by name: a{{{2}}}|a{{{2}}}]]" Contrast this with the behaviour of {{ {{t6}} }}, which is rendered as "{{ t2|a }}", because the parser does not reinterpret the pipe as a separator during the non-substituted expansion stage. (Similarly, {{subst:{{subst:t6}} }} gives the wikitext {{subst:t2|a }}, which only on the next edit will be substituted with [[w:List of people by name: a{{{2}}}|a{{{2}}}]].)

Clicking the "Show changes" button during editing shows the wikitext that will result after substitution and other immediate replacements are carried out. Clicking "Show preview" shows what the rendered page will look like after these replacements.

If a page substitutes itself (e.g. in the noinclude part of a template page) it substitutes the old version, as it was before the current edit.

If the expansion of a substituted template itself contains instances of the subst: syntax, then the substitutions are performed recursively. However substitution is not automatically recursive – if a substituted template contains ordinary transclusions or variables and parser functions which are not explicitly substituted, then these will not be substituted.

Note also that if instances of the subst: syntax appear in a template that is being transcluded, then they will be rendered unchanged (as "{{subst:...}}"), since no substitution in wikitext is possible at the rendering stage. This feature can be exploited to control template behaviour (see § Making templates behave differently when transcluded or substituted). However, it may be inconvenient when a template is designed to be possible to transclude as well as substitute – in this case safesubst: can be used instead of subst: (see § The safesubst: modifier).

The safesubst: modifier

[edit]

The subst: modifier can be replaced by the alternative modifier safesubst:. The two have the same behaviour, except when they are encountered during non-substituted expansion (transclusion or direct viewing) of a template. In such a situation, the code {{subst:...}} remains unparsed, whereas the {{safesubst:...}} is treated as if no modifier were present – and so the subtemplate is transcluded or the variable or parser function evaluated.

Hence the safesubst: modifier is used in the code of templates which are designed to produce recursive substitution when substituted; but that are also intended to work when transcluded or simply to be viewed directly. Contrasted with using the subst: modifier, such templates would break in such cases of transclusion (and possibly on direct viewing).

For details on how to implement this (in particular, how to prevent the substitution from being performed as soon as the template code is saved), see § Recursive substitution.

Recursive substitution

[edit]

As mentioned above, substitution is not automatically recursive. So if a substituted template has code containing transclusions of other templates and parser functions, that code will be copied "as is" into the resulting wikitext – the transcluded items will not themselves be substituted.

To make substitution work recursively, you must include the subst: syntax in the code of the calling template. However, you cannot do this by simply typing "subst:" within the template, as the substitution would then be performed as soon as the template is saved. There are two ways to work around this problem:

  • Use subst:<noinclude /> in place of plain subst:. The noinclude tag breaks up the substitution syntax when the template is saved, but will be stripped away when it is later substituted, allowing the inner substitution to take effect. Alternatively, a larger part of the template code can be wrapped in <onlyinclude>...</onlyinclude>. Then the wrapped code is ignored on the template page itself but not when it is transcluded.
  • Make "subst:" the possible value of an expression containing a parameter, such as {{{subst-foo|subst:}}}, which will evaluate to "subst:" provided the parameter subst-foo is not set. This is a more flexible solution, as it allows the behaviour to be controlled via the parameter. For example, such a template might be called using {{subst:Templatename|subst-foo=|...}}, assigning the parameter an empty value and thus turning off the second level of substitution. If it is not planned to use the parameter, the parameter name is often chosen to be the empty string, giving {{{|subst:}}}, but this can have unexpected results if a value is assigned to the empty string parameter (e.g. {{Templatename|=foo}}).

To ensure that the template will still work as intended if it is transcluded instead of substituted, use safesubst: instead of subst:. This also applies if the template is also to be viewed directly, on its own page (although in this case, if the first of the above methods is used, plain subst: will still work, as the includeonly tags will cause the parser to ignore the subst: on direct viewing).

To see what a template will produce when fully expanded, without the need to explicitly substitute all subtemplates etc., the Special:ExpandTemplates tool can be used.

For more information, see the Recursive conversion of wikitext help page at Meta. See also Help:Calculation § Substitution, m:Template:Example table with computations, with optional substitution (backlinks edit), and the feature request at substall.

Recursive substitution in guided tours

[edit]

Guided tours can make posts on behalf of users, such as automatically posting the contents of a wiki page onto a talk page. Unlike normal substitution or transclusion, however, this function of guided tours does not respect <includeonly>...</includeonly> and similar markup. To make recursive substitution work via guided tour posting, you can use the Delaying substitution with Template:subst method.

An example of recursion in action

[edit]

This is an example using the actual Template:Like, and a hypothetical Template:Foo. You are attempting to include the Template:Foo, and indirectly the Template:Like, on a third page through transclusion and substitution. Template:Like displays this symbol: ?? Like

For example, let's say the Template:Foo contained the wikitext {{Like}}. If you then transclude it, using the wikitext {{Foo}}, this will transclude the Template:Like as you would expect. But if you use the wikitext {{subst:Foo}}, when you save it, you find the wikitext {{Like}} substituted rather than the wikitext of the page Template:Like. The substitution has not been recursive.

An example of recursion would be if the Template:Foo contained the wikitext {{{{{|safesubst:}}}Like}}. Now if you transclude it, using the wikitext {{Foo}}, this will transclude the Template:Like just as before. And if you save {{subst:Foo}} it will substitute the full actual wikitext of the Template:Like. You have therefore achieved recursive substitution.

Further examples

[edit]

Note: {{!}} substitutes to |.

Wikitext of Template:Foo When you view Template:Foo,
it looks like:
The result of {{Foo}}
if included on this page
The result of {{subst:Foo}}
if included on this page
saves as: renders as: saves as: renders as:
{{!}}

{{PAGENAME}}

{{#if: 1 | yes | no}}
|

Foo

yes

{{Foo}}
|

Substitution

yes

{{!}}

{{PAGENAME}}

{{#if: 1 | yes | no}}
|

Substitution

yes

{{{{{|subst:}}}!}}

{{{{{|subst:}}}PAGENAME}}

{{{{{|subst:}}}#if: 1 | yes | no}}
{{subst:!}}

{{subst:PAGENAME}}

{{subst:#if: 1 | yes | no}}

{{Foo}}
{{subst:!}}

{{subst:PAGENAME}}

{{subst:#if: 1 | yes | no}}

|

Substitution

yes
|

Substitution

yes

{{{{{|safesubst:}}}!}}

{{{{{|safesubst:}}}PAGENAME}}

{{{{{|safesubst:}}}#if: 1 | yes | no}}
|

Foo

yes

{{Foo}}
|

Substitution

yes

|

Substitution

yes
|

Substitution

yes

Making templates behave differently when transcluded or substituted

[edit]

Sometimes it is desirable to make a template behave differently when substituted rather than when transcluded. A common trick for doing this is to use an expression like {{{{{subst|subst:}}}ns:0}}. This evaluates to the empty string if the template is being substituted (since the inner substitution takes effect, giving the prefix of namespace 0, which is empty), but to "{{subst:ns:0}}" if the template is being transcluded (since substitution cannot take place after transclusion).

A common application is in templates which are designed only to be substituted, to make them produce a warning if they are mistakenly transcluded instead. This is done in templates like {{prod}}, which are designed to produce a timestamp (e.g. for adding pages to dated categories), and will not be able to do this if transcluded.

A template, {{issubst}}, has been created to simplify this. It returns "yes" if substitution is being performed, or the empty string otherwise. This can then be used as the parameter of a conditional parser function to make the template display a warning method if it is being transcluded, or to otherwise change the behaviour of a template depending on whether it is being transcluded or substituted.

Documenting substitution

[edit]

Usage of a template through subst: does not automatically show up in page histories. Therefore, providing the line of wikitext containing "subst:" in the edit summary is especially useful.

Also, pages with a substituted template do not show up in backlinks, and the template does not appear in the list of transcluded templates on the edit page. The template could add pages to a category to track substitutions, but listing this category on a page may clutter the list of content-based categories the page is in. Also, comments outside noinclude tags are included in the wikitext. Thus a comment can be used to mention the template. Substitution of parameters does not work inside comments, but a workaround for this is to begin an intended comment with <!<noinclude />-- so that it turns into a comment once transcluded.

Limitation

[edit]

Substitution is not available inside <ref>...</ref> and <gallery>...</gallery> tags. If you write {{subst:foo}}, it is not substituted nor transcluded, but remains as-is (it's a known bug, see T4700 and gerrit:272916 for current status).

However it is possible to bypass this limitation by using the magic word #tag. If you write, for instance, {{safesubst:#tag:ref|content of the reference}}, the content of the reference will be substituted and the {{#tag:ref|...}} will be replaced with <ref>...</ref>. A more concrete example: If you write for instance {{safesubst:#tag:ref|...Title=ExampleTitle|archivedate={{subst:TODAY}}|Edition=Hardcover...}} then the software will perform substitutions on the text within the last field and the {{#tag:ref|...}} will be replaced with <ref>...</ref>around the altered text, and the reference will be saved with the substitution; it'll be saved as "{{|...Title=ExampleTitle|archivedate=29 January 2016|Edition=Hardcover|...}}" with <ref>...</ref> around it. In other words, first the software will expand the templates and then place that expanded text within reference tags.

Templates for substitution

[edit]

See also

[edit]
杏色搭配什么颜色好看 空调用什么插座 大生化检查都包括什么项目 胃出血是什么原因引起的 胃烂了是什么病严重吗
男人补身体吃什么好 蜂蜜什么时候喝最好 玻璃瓶属于什么垃圾 微信是什么时候开始有的 死精吃什么能调理成活精
隐喻的意思是什么 cea是什么检查项目 鹿参膏有什么作用和功效 做胃镜前喝的那个液体是什么 血压正常心跳快是什么原因
圣人是什么意思 割伤用什么药愈合伤口 糠疹是什么引起的 掉头发是什么原因导致的 ebay是什么
内热外寒感冒用什么药hcv7jop9ns6r.cn 小腿肚酸疼是什么原因xinjiangjialails.com 尔尔是什么意思hcv8jop5ns5r.cn 安全监察是一种带有什么的监督hcv8jop2ns9r.cn 赛治是什么药inbungee.com
三伏天晒背有什么好处hcv7jop9ns3r.cn 糖类抗原724偏高是什么原因hcv8jop0ns2r.cn mrd是什么意思hcv8jop2ns0r.cn 马拉松pb是什么意思hcv9jop1ns4r.cn 妇科炎症吃什么药最好hcv8jop3ns3r.cn
赛博朋克什么意思hcv8jop4ns6r.cn 师字五行属什么xinmaowt.com 什么动物不怕热hcv8jop2ns1r.cn 蟋蟀吃什么hcv9jop0ns0r.cn 泡菜生花用什么方法可以去掉hanqikai.com
流鼻涕咳嗽吃什么药chuanglingweilai.com 征兆是什么意思gysmod.com 什么叫肺大泡hcv9jop5ns6r.cn 喝生鸡蛋有什么好处hcv9jop3ns6r.cn 什么的草叶hcv7jop7ns1r.cn
百度