Template:Sfn

维基百科,自由的百科全书
跳转至: 导航搜索
文档图示 模板文档[查看] [编辑] [历史] [清除]

短脚注模板[编辑]

目的[编辑]

于脚注中创建短的哈佛参考文献格式。详情见「列明來源」。特点:

  • 自动整合相同脚注。
  • 自动创建到页底该引用的具体信息的链接。锚点只有当你添加了|harv=参数到目的模板才会被创建。这个链接只有当参数|last=|last2=|year=与{{sfn}}相匹配时才会被创建,或者|ref=被设置为一个其他的锚点id。

用法[编辑]

{{Sfn |Last name of author(s)|Year| loc = Location in the text}}

如果不想用選填的loc參數,可以改用以下參數其中一個:

  • |p=page
  • |pp=pages
注意
  • 第一個參數是作者的姓(last name)。
  • 可以填寫最多4位作者作為參數(見例子)。如果作者多於4位,請只列出首4位,列出更多作者就会发生奇怪的事情。
  • 下一個參數是出版年份(the year of publication)。
  • 年份和作者姓名前后不能有多余的空格,else the generated links will not work. (BUG)
  • The "loc = " parameter is the location of the cited material within the reference. 此參數是選填。
  • The parameter p is an optional page parameter; thus "{{sfn|Smith|2006| p=25}}" yields " Smith 2006,第25页".
  • The parameter pp is an optional page range parameter; thus "{{sfn|Smith|2006| pp=25–26}}" yields " Smith 2006,第25–26页".
  • 如果作者在同一年發表了多於一份著作,標準做法是在年份後面加a、b……區別(例如year=2006a 和 year=2006b)。
  • If multiple references are made to the same location of the same work, only one footnote is generated.
  • 如果需要加入更多注解,use {{Harvnb}} or {{Harvtxt}} in <ref> tags to achieve a similar effect. E.g.
    Jones writes "blah blah".<ref>Quoted in {{Harvnb|Smith|2006|p=25}}.</ref>
    


Editors editing this template are requested to consider making parallel changes to {{Harv}}, {{Harvnb}} and {{Harvs}}.

例子[编辑]

Markup Result
Article text.{{sfn |Smith|2006| p=25}} Article text.[1]
Article text.{{sfn |Smith|2006| pp=25&ndash;26}} Article text.[2] Citing multiple pages.
Article text.{{sfn |Smith|2006| loc=&sect;8.5}} Article text.[3] Using the location parameter.
Article text.{{sfn |Smith|2006| p=25}} Article text.[1] A second citation of the same page.
Article text.{{sfn |Smith|Jones|2006| p=25}} Article text.[4] Two authors.
Article text.{{sfn |Smith|Jones|Brown|2009| p=25}} Article text.[5] Three authors.
Article text.{{sfn |Smith|Jones|Brown|Black|2006| p=25}} Article text.[6] Large numbers of authors.
Article text.{{sfn |Wallace|1993a| p=25}} More text.{{sfn |Wallace|1993b| p=32}} Article text.[7] More text.[8] Two papers in the same year.
==Notes==
{{reflist}}

==References==
* {{Cite book
| last = Smith | first = John
| year = 2006
| title = Smith's Book
| ref = harv
}}
* {{Cite web
| last = Smith | first = John
| last2 = Jones | first2 = Sam
| title = Smith & Jones website
| url = http://en.wikipedia.org
| year = 2006
| ref = harv
}}
* {{Cite news
| last = Smith | first = John
| last2 = Jones | first2 = Sam
| last3 = Brown | first3 = Tom
| title = Article by Smith, Jones and Brown
| year = 2009
| newspaper = Big Urban Newspaper
| ref = harv
}}
* {{Cite journal
| last = Smith
| last2 = Jones
| last3 = Brown
| last4 = Black
| year= 2006
| title= Smith, Jones, Brown and Black's Paper
| journal = Important Journal
| ref = harv
}}
* {{Cite journal
| last = Wallace | first = Bill
| year = 1993a
| title = Wallace's first paper
| journal= Important Journal
| ref = harv
}}
* {{Cite journal
| last = Wallace | first = Bill
| year = 1993b
| title = Wallace's second paper
| journal= Another Important Journal
| ref = harv
}}
Notes
  1. ^ 1.0 1.1 Smith 2006, p. 25.
  2. ^ Smith 2006, pp. 25–26.
  3. ^ Smith 2006,§8.5.
  4. ^ Smith & Jones 2006, p. 25.
  5. ^ Smith,Jones & Brown 2009, p. 25.
  6. ^ Smith 等人 2006, p. 25.
  7. ^ Wallace 1993a, p. 25.
  8. ^ Wallace 1993b, p. 25.
References
  • Smith, John. Smith's Book. 2006. 
  • Smith, John; Jones, Sam. Smith & Jones website. 2006. 
  • Smith, John; Jones, Sam; Brown, Tom. Article by Smith, Jones and Brown. Big Urban Newspaper. 2009. 
  • Smith; Jones; Brown; Black. Smith, Jones, Brown and Black's Paper. Important Journal. 2006. 
  • Wallace, Bill. Wallace's first paper. Important Journal. 1993a. 
  • Wallace, Bill. Wallace's second paper. Another Important Journal. 1993b. 

Anchor IDs[编辑]

This template generates an HTML IDd as an anchor to link the short citation to the full citation.. The |ref=harv field is necessary in each of the {{cite ...}} templates to enable the id. The {{citation}} template always generates an id.

If the article cites multiple works by the same author in the same year, then duplicate IDs will be generated. One method to resolve this is to add an alpha suffix to the year. Example: 2009a, 2009b, 2009c.

If works are cited where the author or year is unknown— such as for a web page —then an invalid ID will be generated. To resolve this, create a custom ID:

{{sfn|cite name|year}}
{{cite ... |ref=CITEREFcite_nameyear }}

Where cite_name is a name such as the publisher, and must follow these rules:

  • Must begin with a letter A-Z or a-z
  • Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")
  • Spaces in the |ref= field must be replaced with underscores
  • Case-sensitive

SfnRef[编辑]

You may use the {{SfnRef}} template to generate the proper value for the |ref= parameter. Pass the same parameters used with {{sfn}} to {{SfnRef}}:

{{sfn|cite name|year}}
{{cite ... |ref={{SfnRef|cite name|year}} }}

Articles using {{sfn}} should be checked for duplicate IDs with the W3C Markup Validation Service.

注意[编辑]

使用sfn模板時,無需在前後加上<ref>和</ref>,例如

{{sfn|Smith|2006|p=26}}
等於如下原始碼:
<ref name=Smith200626>{{Harvnb|Smith|2006|p=26}}</ref>

相關[编辑]

對應