Template:Flightgear file: Difference between revisions
Jump to navigation
Jump to search
m (currently limited to the official repository, not suitable to be used for clones/topic branches "as it") |
Red Leader (talk | contribs) (Add t[ext] and nopath parameters, and change others as per Johan's suggestions at FGW:VP#Repository link templates) |
||
Line 1: | Line 1: | ||
[http://sourceforge.net/p/flightgear/flightgear/ci/<!-- | [http://sourceforge.net/p/flightgear/flightgear/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}}} | ||
}} flightgear/{{{1|}}}] ({{{ | }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | flightgear/ }}{{{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}}} | ||
}} flightgear/{{{1|}}}]{{#if: {{{ | }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | flightgear/ }}{{{1|}}}]{{#if: {{{l|}}} | (line {{{l}}}) }} }} | ||
}}<noinclude> | }}<noinclude> | ||
{{Informative template|1= | {{Informative template|1= | ||
Line 22: | Line 22: | ||
== Usage == | == Usage == | ||
{{obr}}'''flightgear file'''{{!}}''path''{{!}}'' | {{obr}}'''flightgear file'''{{!}}''path''{{!}}''l=''{{!}}''t=''{{!}}''r=''{{!}}''nopath=''{{cbr}} | ||
Both parameters are optional. | Both parameters are optional. | ||
Line 28: | 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 FlightGear 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 FlightGear 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 43: | Line 48: | ||
=== Path and a commit reference given === | === Path and a commit reference given === | ||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}release/3.6.0{{cbr}} | {{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}r=release/3.6.0{{cbr}} | ||
{{flightgear file|src/Main/main.cxx|release/3.6.0}} | {{flightgear file|src/Main/main.cxx|r=release/3.6.0}} | ||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}0a822f{{cbr}} | {{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}r=0a822f{{cbr}} | ||
{{flightgear file|src/Main/main.cxx|0a822f}} | {{flightgear file|src/Main/main.cxx|r=0a822f}} | ||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}0a822fb412e2fcc44028bf5412710e2fb32dc96b{{cbr}} | {{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}r=0a822fb412e2fcc44028bf5412710e2fb32dc96b{{cbr}} | ||
{{flightgear file|src/Main/main.cxx|0a822fb412e2fcc44028bf5412710e2fb32dc96b}} | {{flightgear file|src/Main/main.cxx|r=0a822fb412e2fcc44028bf5412710e2fb32dc96b}} | ||
=== Line parameter given === | === Line parameter given === | ||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}{{!}}7{{cbr}} | {{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}l=7{{cbr}} | ||
{{flightgear file|src/Main/main.cxx||7}} | {{flightgear file|src/Main/main.cxx|l=7}} | ||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}r=0a822f{{!}}l=7{{cbr}} | |||
{{flightgear file|src/Main/main.cxx|r=0a822f|l=7}} | |||
=== Custom label given === | |||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}t=main.cxx{{cbr}} | |||
{{flightgear file|src/Main/main.cxx|t=main.cxx}} | |||
{{obr}}flightgear file{{!}}src/Main/main.cxx{{!}} | === Nopath parameter given === | ||
{{flightgear file|src/Main/main.cxx| | {{obr}}flightgear file{{!}}src/Main/main.cxx{{!}}nopath=1{{cbr}} | ||
{{flightgear file|src/Main/main.cxx|nopath=1}} | |||
== Related templates == | == Related templates == |
Revision as of 15:14, 3 October 2015
The following template description is not displayed when the template is inserted in an article.
Goal
This template can be used when linking to source files or directories in the official FlightGear repository.
Usage
{{flightgear 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 FlightGear 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
{{flightgear file}}
Path given
{{flightgear file|src/Main/main.cxx}}
Path and a commit reference given
{{flightgear file|src/Main/main.cxx|r=release/3.6.0}}
flightgear/src/Main/main.cxx (release/3.6.0)
{{flightgear file|src/Main/main.cxx|r=0a822f}}
flightgear/src/Main/main.cxx (0a822f)
{{flightgear file|src/Main/main.cxx|r=0a822fb412e2fcc44028bf5412710e2fb32dc96b}}
flightgear/src/Main/main.cxx (0a822fb412e2fcc44028bf5412710e2fb32dc96b)
Line parameter given
{{flightgear file|src/Main/main.cxx|l=7}}
flightgear/src/Main/main.cxx (line 7)
{{flightgear file|src/Main/main.cxx|r=0a822f|l=7}}
flightgear/src/Main/main.cxx (0a822f, line 7)
Custom label given
{{flightgear file|src/Main/main.cxx|t=main.cxx}}
Nopath parameter given
{{flightgear file|src/Main/main.cxx|nopath=1}}
Related templates
- {{repo link}}
- {{simgear file}}
- {{fgdata file}}
- {{fgaddon url}}