Template:Flightgear file: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(As per discussion on Template talk:Repo link)
 
m (Minor fixes)
Line 2: Line 2:
-->{{#if: {{{2|}}} <!-- Is a commit reference defined? -->
-->{{#if: {{{2|}}} <!-- Is a commit reference defined? -->
   | <!-- Yes, a commit reference is defined --><!--
   | <!-- Yes, a commit reference is defined --><!--
     -->{{{2}}}{{#if: {{#titleparts: {{{2|}}}|1|2}} <!-- Do the commit reference contain a slash? -->
     -->{{{2}}}<!--
       | <!-- Yes. Add a trailing slash and tilde. --><!--
    -->{{#if: {{#titleparts: {{{2|}}}|1|2}} <!-- Do the commit reference contain a slash? -->
       | <!-- Yes. Add a trailing slash and tilde after the reference (needed for the SourceForge URL). --><!--
         -->/~
         -->/~
     }}/tree/{{{1|}}} flightgear/{{{1|}}}] ({{{2}}})
     }}/tree/{{{1|}}} flightgear/{{{1|}}}] ({{{2}}})
   | <!-- 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|}}} flightgear/{{{1|}}}]
     -->next/tree/{{{1|}}} flightgear/{{{1|}}}]
}}<noinclude>
}}<noinclude>
Line 21: Line 22:
; 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.


; reference:  A commit reference.  Usually the SHA-1 commit id (which can be abbreviated), but it can also for example be a tag, the head of a branch etc.  If empty it will point to '''next'''.
; reference:  A commit reference.  Usually the SHA-1 commit id (which can be abbreviated) but it can also be for example a tag, the head of a branch etc.  If empty the link will point to '''next'''.


== Examples ==
== Examples ==
=== If given no parameters ===
=== No parameters given ===
  {{obr}}flightgear file{{cbr}}
  {{obr}}flightgear file{{cbr}}
{{flightgear file}}
{{flightgear file}}


=== If given a path ===
=== Path given ===
  {{obr}}flightgear file{{!}}src/Main/main.cxx{{cbr}}
  {{obr}}flightgear file{{!}}src/Main/main.cxx{{cbr}}
{{flightgear file|src/Main/main.cxx}}
{{flightgear file|src/Main/main.cxx}}


=== If given a path and a commit reference ===
=== 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{{!}}release/3.6.0{{cbr}}
{{flightgear file|src/Main/main.cxx|release/3.6.0}}
{{flightgear file|src/Main/main.cxx|release/3.6.0}}

Revision as of 20:59, 11 September 2015

flightgear/

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 FlightGear repository.

Usage

{{flightgear file|path|reference}}

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.
reference
A commit reference. Usually the SHA-1 commit id (which can be abbreviated) but it can also be for example a tag, the head of a branch etc. If empty the link will point to next.

Examples

No parameters given

{{flightgear file}}

flightgear/

Path given

{{flightgear file|src/Main/main.cxx}}

flightgear/src/Main/main.cxx

Path and a commit reference given

{{flightgear file|src/Main/main.cxx|release/3.6.0}}

flightgear/src/Main/main.cxx (release/3.6.0)

{{flightgear file|src/Main/main.cxx|0a822fb4}}

flightgear/src/Main/main.cxx (0a822fb4)

{{flightgear file|src/Main/main.cxx|0a822fb412e2fcc44028bf5412710e2fb32dc96b}}

flightgear/src/Main/main.cxx (0a822fb412e2fcc44028bf5412710e2fb32dc96b)

Related templates