Template:Fgdata file: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(New template. @Johan, can you you please see my latest comment at Template talk:Repo link)
 
(Added a depreciation note about using the {{fgdata source}} template instead.)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[http://sourceforge.net/p/flightgear/fgdata/ci/<!--
[http://sourceforge.net/p/flightgear/fgdata/ci/<!--
-->{{#if: {{{2|}}} <!-- Is a commit reference defined? -->
-->{{#if: {{{r|}}} <!-- Is a commit reference defined? -->
   | <!-- Yes, a commit reference is defined --><!--
   | <!-- Yes, a commit reference is defined --><!--
     -->{{{2}}}<!--
     -->{{{r}}}<!--
     -->{{#if: {{#titleparts: {{{2|}}}|1|2}} <!-- Do the commit reference contain a slash? -->
     -->{{#if: {{#titleparts: {{{r|}}}|1|2}} <!-- Do 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|}}} fgdata/{{{1|}}}] ({{{2}}})
     }}/tree/{{{1|}}}<!--
    -->{{#if: {{{l|}}} <!-- Is a line defined? -->
      | &#35;l{{{l}}}
    }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | fgdata/ }}{{{1|}}}] ({{{r}}}{{#if: {{{l|}}} | ,&nbsp;line&nbsp;{{{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|}}} fgdata/{{{1|}}}]
     -->next/tree/{{{1|}}}<!--
    -->{{#if: {{{l|}}} <!-- Is a line defined? -->
      | &#35;l{{{l}}}
    }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | fgdata/ }}{{{1|}}}]{{#if: {{{l|}}} | &nbsp;(line&nbsp;{{{l}}}) }} }}
}}<noinclude>
}}<noinclude>
{{Informative template|1=
{{Informative template|1=
__NOTOC__
__NOTOC__{{depreciated|The newer {{tl|fgdata 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 [[fgdata]] repository.
This template can be used when linking to source files or directories in the [[fgdata]] repository.


== Usage ==
== Usage ==
  {{obr}}'''fgdata file'''{{!}}''path''{{!}}''reference''{{cbr}}
  {{obr}}'''fgdata file'''{{!}}''path''{{!}}''l=''{{!}}''t=''{{!}}''r=''{{!}}''nopath=''{{cbr}}


Both parameters are optional.
Both parameters are optional.
Line 22: 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 fgdata 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 fgdata repository.


; reference:  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.
; 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|The '''t''' parameter will override this parameter.}}


== Examples ==
== Examples ==
Line 34: Line 48:


=== Path and a commit reference given ===
=== Path and a commit reference given ===
  {{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}release/3.6.0{{cbr}}
  {{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}r=release/3.6.0{{cbr}}
{{fgdata file|Nasal/geo.nas|release/3.6.0}}
{{fgdata file|Nasal/geo.nas|r=release/3.6.0}}
 
{{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}r=0d4a86{{cbr}}
{{fgdata file|Nasal/geo.nas|r=0d4a86}}
 
{{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}r=0d4a86e3d454a526d561be4354e0dd26bb5f6daf{{cbr}}
{{fgdata file|Nasal/geo.nas|r=0d4a86e3d454a526d561be4354e0dd26bb5f6daf}}
 
=== Line parameter given ===
{{obr}}fgdata file{{!}}Huds/default.xml{{!}}l=4{{cbr}}
{{fgdata file|Huds/default.xml|l=4}}
 
{{obr}}fgdata file{{!}}Huds/default.xml{{!}}r=5ae515{{!}}l=4{{cbr}}
{{fgdata file|Huds/default.xml|r=5ae515|l=4}}


  {{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}0d4a86e3{{cbr}}
=== Custom label given ===
{{fgdata file|Nasal/geo.nas|0d4a86e3}}
  {{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}t=geo.nas{{cbr}}
{{fgdata file|Nasal/geo.nas|t=geo.nas}}


  {{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}0d4a86e3d454a526d561be4354e0dd26bb5f6daf{{cbr}}
=== Nopath parameter given ===
{{fgdata file|Nasal/geo.nas|0d4a86e3d454a526d561be4354e0dd26bb5f6daf}}
  {{obr}}fgdata file{{!}}Huds/default.xml{{!}}nopath=1{{cbr}}
{{fgdata file|Huds/default.xml|nopath=1}}


== Related templates ==
== Related templates ==
* {{tl|repo link}}
{{repo link/doc related}}
* {{tl|flightgear file}}
* {{tl|simgear file}}


}}
}}

Latest revision as of 17:21, 23 May 2016

fgdata/

The following template description is not displayed when the template is inserted in an article.
Deprecated  The newer {{fgdata 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 fgdata repository.

Usage

{{fgdata 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 fgdata 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

{{fgdata file}}

fgdata/

Path given

{{fgdata file|Nasal/geo.nas}}

fgdata/Nasal/geo.nas

Path and a commit reference given

{{fgdata file|Nasal/geo.nas|r=release/3.6.0}}

fgdata/Nasal/geo.nas (release/3.6.0)

{{fgdata file|Nasal/geo.nas|r=0d4a86}}

fgdata/Nasal/geo.nas (0d4a86)

{{fgdata file|Nasal/geo.nas|r=0d4a86e3d454a526d561be4354e0dd26bb5f6daf}}

fgdata/Nasal/geo.nas (0d4a86e3d454a526d561be4354e0dd26bb5f6daf)

Line parameter given

{{fgdata file|Huds/default.xml|l=4}}

fgdata/Huds/default.xml (line 4)

{{fgdata file|Huds/default.xml|r=5ae515|l=4}}

fgdata/Huds/default.xml (5ae515, line 4)

Custom label given

{{fgdata file|Nasal/geo.nas|t=geo.nas}}

geo.nas

Nopath parameter given

{{fgdata file|Huds/default.xml|nopath=1}}

Huds/default.xml

Related templates