Template:Simgear file: Difference between revisions
Jump to navigation
Jump to search
Red Leader (talk | contribs) (Add line parameter; fix "simgear/simgear/..." > "simgear.." abbreviation bug; slightly shorten abbreviated commit IDs to match the SF abbreviation; add link to {{fgaddon url}}) |
(Added a depreciation note about using the {{simgear source}} template instead.) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[http://sourceforge.net/p/flightgear/simgear/ci/<!-- | [http://sourceforge.net/p/flightgear/simgear/ci/<!-- | ||
-->{{#if: {{{ | -->{{#if: {{{r|}}} <!-- Is a commit reference defined? --> | ||
| <!-- Yes, a commit reference is defined --><!-- | | <!-- Yes, a commit reference is defined --><!-- | ||
-->{{{ | -->{{{r}}}<!-- | ||
-->{{#if: {{#titleparts: {{{ | -->{{#if: {{#titleparts: {{{r|}}}|1|2}} <!-- Does the commit reference contain a slash? --> | ||
| <!-- Yes. Add a trailing slash and tilde after the reference (needed for the SourceForge URL). --><!-- | | <!-- Yes. Add a trailing slash and tilde after the reference (needed for the SourceForge URL). --><!-- | ||
-->/~ | -->/~ | ||
}}/tree/{{{1|}}}<!-- | }}/tree/{{{1|}}}<!-- | ||
-->{{#if: {{{ | -->{{#if: {{{l|}}} <!-- Is a line defined? --> | ||
| #l{{{ | | #l{{{l}}} | ||
}} | }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | simgear/ }}{{{1|}}}] ({{{r}}}{{#if: {{{l|}}} | , line {{{l}}} }}) }} | ||
| <!-- No, a commit reference is not defined. Fall back on "next" and do not display commit reference. --><!-- | | <!-- No, a commit reference is not defined. Fall back on "next" and do not display commit reference. --><!-- | ||
-->next/tree/{{{1|}}}<!-- | -->next/tree/{{{1|}}}<!-- | ||
-->{{#if: {{{ | -->{{#if: {{{l|}}} <!-- Is a line defined? --> | ||
| #l{{{ | | #l{{{l}}} | ||
}} | }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | simgear/ }}{{{1|}}}]{{#if: {{{l|}}} | (line {{{l}}}) }} }} | ||
}}<noinclude> | }}<noinclude> | ||
{{Informative template|1= | {{Informative template|1= | ||
__NOTOC__ | __NOTOC__ {{depreciated|The newer {{tl|simgear source}} template provides far greater functionality and should be used instead. This is not a subtemplate of the master {{tl|repo link}} template.}} | ||
== Goal == | == Goal == | ||
This template can be used when linking to source files or directories in the [[SimGear]] repository. | This template can be used when linking to source files or directories in the [[SimGear]] repository. | ||
== Usage == | == Usage == | ||
{{obr}}'''simgear file'''{{!}}''path''{{!}}'' | {{obr}}'''simgear file'''{{!}}''path''{{!}}''l=''{{!}}''t=''{{!}}''r=''{{!}}''nopath=''{{cbr}} | ||
Both parameters are optional. | Both parameters are optional. | ||
Line 38: | Line 28: | ||
; path: What follows after <code>/tree/</code> in the URL. Can be the path to a file or a directory. If empty, the link will point to the root of the SimGear repository. | ; path: What follows after <code>/tree/</code> in the URL. Can be the path to a file or a directory. If empty, the link will point to the root of the SimGear repository. | ||
; | ; l: A line number. This should just be a single number, as SourceForge does not support multiple line numbers. | ||
: {{inote|This parameter will not work if the linked file is of a certain file type, such as <code>.nas</code>. However, this is to do with SourceForge, not the template.}} | |||
; r: A commit reference. Usually the SHA-1 commit ID (which can be abbreviated), but it can also be a tag or a branch name. If empty, the link will point to the '''next''' branch. | |||
; t: Text to show as the URL's label instead of file path. | |||
; | ; nopath: Strips off the <code>fgdata/</code> part of the URL label, leaving just the contents of the '''path''' parameter. | ||
: {{inote| | : {{inote|The '''t''' parameter will override this parameter.}} | ||
== Examples == | == Examples == | ||
Line 53: | Line 48: | ||
=== Path and a commit reference given === | === Path and a commit reference given === | ||
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}release/2.12.0{{cbr}} | {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}r=release/2.12.0{{cbr}} | ||
{{simgear file|simgear/canvas/Canvas.cxx|release/2.12.0}} | {{simgear file|simgear/canvas/Canvas.cxx|r=release/2.12.0}} | ||
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c2{{cbr}} | {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}r=4f94c2{{cbr}} | ||
{{simgear file|simgear/canvas/Canvas.cxx|4f94c2}} | {{simgear file|simgear/canvas/Canvas.cxx|r=4f94c2}} | ||
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c22241e5ef90026fd087168b24a13ee5ef9b{{cbr}} | {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}r=4f94c22241e5ef90026fd087168b24a13ee5ef9b{{cbr}} | ||
{{simgear file|simgear/canvas/Canvas.cxx|4f94c22241e5ef90026fd087168b24a13ee5ef9b}} | {{simgear file|simgear/canvas/Canvas.cxx|r=4f94c22241e5ef90026fd087168b24a13ee5ef9b}} | ||
=== | === Line parameter given === | ||
{{obr}}simgear file{{!}} | {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}l=5{{cbr}} | ||
{{simgear file| | {{simgear file|simgear/canvas/Canvas.cxx|l=5}} | ||
=== | {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}r=4f94c2{{!}}l=5{{cbr}} | ||
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}} | {{simgear file|simgear/canvas/Canvas.cxx|r=4f94c2|l=5}} | ||
{{simgear file|simgear/canvas/Canvas.cxx| | |||
=== Custom label given === | |||
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}t=Canvas.cxx{{cbr}} | |||
{{simgear file|simgear/canvas/Canvas.cxx|t=Canvas.cxx}} | |||
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}} | === Nopath parameter given === | ||
{{simgear file|simgear/canvas/Canvas.cxx| | {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}nopath=1{{cbr}} | ||
{{simgear file|simgear/canvas/Canvas.cxx|nopath=1}} | |||
== Related templates == | == Related templates == | ||
{{repo link/doc related}} | |||
}} | }} |
Latest revision as of 17:20, 23 May 2016
The following template description is not displayed when the template is inserted in an article.
Deprecated The newer {{simgear source}} template provides far greater functionality and should be used instead. This is not a subtemplate of the master {{repo link}} template. |
Goal
This template can be used when linking to source files or directories in the SimGear repository.
Usage
{{simgear file|path|l=|t=|r=|nopath=}}
Both parameters are optional.
- path
- What follows after
/tree/
in the URL. Can be the path to a file or a directory. If empty, the link will point to the root of the SimGear repository.
- l
- A line number. This should just be a single number, as SourceForge does not support multiple line numbers.
- Note This parameter will not work if the linked file is of a certain file type, such as
.nas
. However, this is to do with SourceForge, not the template.
- r
- A commit reference. Usually the SHA-1 commit ID (which can be abbreviated), but it can also be a tag or a branch name. If empty, the link will point to the next branch.
- t
- Text to show as the URL's label instead of file path.
- nopath
- Strips off the
fgdata/
part of the URL label, leaving just the contents of the path parameter. - Note The t parameter will override this parameter.
Examples
No parameters given
{{simgear file}}
Path given
{{simgear file|simgear/canvas/Canvas.cxx}}
simgear/simgear/canvas/Canvas.cxx
Path and a commit reference given
{{simgear file|simgear/canvas/Canvas.cxx|r=release/2.12.0}}
simgear/simgear/canvas/Canvas.cxx (release/2.12.0)
{{simgear file|simgear/canvas/Canvas.cxx|r=4f94c2}}
simgear/simgear/canvas/Canvas.cxx (4f94c2)
{{simgear file|simgear/canvas/Canvas.cxx|r=4f94c22241e5ef90026fd087168b24a13ee5ef9b}}
simgear/simgear/canvas/Canvas.cxx (4f94c22241e5ef90026fd087168b24a13ee5ef9b)
Line parameter given
{{simgear file|simgear/canvas/Canvas.cxx|l=5}}
simgear/simgear/canvas/Canvas.cxx (line 5)
{{simgear file|simgear/canvas/Canvas.cxx|r=4f94c2|l=5}}
simgear/simgear/canvas/Canvas.cxx (4f94c2, line 5)
Custom label given
{{simgear file|simgear/canvas/Canvas.cxx|t=Canvas.cxx}}
Nopath parameter given
{{simgear file|simgear/canvas/Canvas.cxx|nopath=1}}
Related templates
|