Template:Fgdata file: Difference between revisions

Jump to navigation Jump to search
Add t[ext] and nopath parameters, and change others as per Johan's suggestions at FGW:VP#Repository link templates
m (Slightly shorten abbreviated commit IDs to match the SF abbreviation)
(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/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|}}}<!--
     }}/tree/{{{1|}}}<!--
     -->{{#if: {{{3|}}} <!-- Is a line defined? -->
     -->{{#if: {{{l|}}} <!-- Is a line defined? -->
       | &#35;l{{{3}}}
       | &#35;l{{{l}}}
     }} fgdata/{{{1|}}}] ({{{2}}}{{#if: {{{3|}}} | ,&nbsp;line&nbsp;{{{3}}} }})
     }} {{#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|}}}<!--
     -->next/tree/{{{1|}}}<!--
     -->{{#if: {{{3|}}} <!-- Is a line defined? -->
     -->{{#if: {{{l|}}} <!-- Is a line defined? -->
       | &#35;l{{{3}}}
       | &#35;l{{{l}}}
     }} fgdata/{{{1|}}}]{{#if: {{{3|}}} | &nbsp;(line&nbsp;{{{3}}}) }}
     }} {{#if: {{{t|}}} | {{{t}}}] | {{#if: {{{nopath|}}} | | fgdata/ }}{{{1|}}}]{{#if: {{{l|}}} | &nbsp;(line&nbsp;{{{l}}}) }} }}
}}<noinclude>
}}<noinclude>
{{Informative template|1=
{{Informative template|1=
Line 22: Line 22:


== Usage ==
== Usage ==
  {{obr}}'''fgdata file'''{{!}}''path''{{!}}''reference''{{!}}''line''{{cbr}}
  {{obr}}'''fgdata 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 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.


; lineA line number. This should just be a single number, as SourceForge does not support multiple line numbers.
; nopathStrips off the <code>fgdata/</code> part of the URL label, leaving just the contents of the '''path''' parameter.
: {{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.}}
: {{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}}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{{!}}0d4a86{{cbr}}
  {{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}r=0d4a86{{cbr}}
{{fgdata file|Nasal/geo.nas|0d4a86}}
{{fgdata file|Nasal/geo.nas|r=0d4a86}}


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


=== Line parameter given ===
=== Line parameter given ===
  {{obr}}fgdata file{{!}}Huds/default.xml{{!}}{{!}}4{{cbr}}
  {{obr}}fgdata file{{!}}Huds/default.xml{{!}}l=4{{cbr}}
{{fgdata file|Huds/default.xml||4}}
{{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}}
 
=== Custom label given ===
{{obr}}fgdata file{{!}}Nasal/geo.nas{{!}}t=geo.nas{{cbr}}
{{fgdata file|Nasal/geo.nas|t=geo.nas}}


  {{obr}}fgdata file{{!}}Huds/default.xml{{!}}5ae515{{!}}4{{cbr}}
=== Nopath parameter given ===
{{fgdata file|Huds/default.xml|5ae515|4}}
  {{obr}}fgdata file{{!}}Huds/default.xml{{!}}nopath=1{{cbr}}
{{fgdata file|Huds/default.xml|nopath=1}}


== Related templates ==
== Related templates ==

Navigation menu