Template:Fgaddon aircraft source: Difference between revisions

Jump to navigation Jump to search
Replacement of the template content with the {{fgaddon aircraft source/sandbox}} content. See the discussion page for full details. This mimics the original behaviour perfectly, while being based on the {{repo link}} master template.
m (Bugman moved page Template:Fgaddon file to Template:Fgaddon aircraft source: See the talk page for discussions - this is for the expansion and better organisation of the {{repo link}} family of templates.)
(Replacement of the template content with the {{fgaddon aircraft source/sandbox}} content. See the discussion page for full details. This mimics the original behaviour perfectly, while being based on the {{repo link}} master template.)
Line 1: Line 1:
{{#if: {{{file|}}} |[http|http}}://sourceforge.net/p/flightgear/fgaddon/{{{r|HEAD}}}<!--  tarball?path=/*no "/tree/"*  --><!--
{{repo link
-->/tree/<!--
| site                                              = {{project infrastructure|abbrev}}
-->{{#if: {{{b|}}} <!-- Is a branch defined? -->
| cmd{{#if:{{{cmd|}}}||NULL}}                      = {{{cmd}}}
  | <!-- Yes, add the branch to the URL --><!--
| opt{{#if:{{{opt|}}}||NULL}}                      = {{{opt}}}
    -->branches/{{{b}}}
| protocol{{#if:{{{protocol|}}}||NULL}}            = {{{protocol}}}
  | <!-- No, default to "trunk"  --><!--
| login{{#if:{{{login|}}}||NULL}}                  = {{{login}}}
    -->trunk
| type                                              = {{{type|svn web}}}
  }}/Aircraft/<!--
| proj                                              = flightgear
-->{{#if: {{{1|}}} <!-- Is an aircraft defined? -->
| repo                                              = fgaddon
  | <!-- Yes, go to the aircraft directory --><!--
| branch{{#if:{{{branch|{{{b|}}}}}}||NULL}}        = {{{branch|{{{b}}}}}}
    -->{{{1}}}/<!--
| path                                              = Aircraft{{#if: {{{1|}}}
    -->{{#if: {{{2|}}} <!-- Is a file path defined? -->
                                                                |/{{strip whitespace|{{{1}}}}}<!--
      | <!-- Yes, got to the file --><!--
                                                            -->{{#if: {{{2|}}}
        -->{{{2}}}<!--
                                                                  |/{{strip whitespace|{{{2}}}}}
          -->{{#if: {{{l|}}} <!-- Is a line number defined -->
                                                                }}
             | <!-- Yes, go to the line number --><!--
                                                              }}
              -->&#35;l{{{l}}}
| commit{{#if:{{{commit|{{{c|{{{r|}}}}}}}}}||NULL}} = {{{commit|{{{c|{{{r}}}}}}}}}
        }}
| line{{#if:{{{line|{{{l|}}}}}}||NULL}}            = {{{line|{{{l}}}}}}
    }}
| view{{#if:{{{view|{{{v|}}}}}}||NULL}}             = {{{view|{{{v}}}}}}
  | <!-- No, go to the default --> }} <!--
| text{{#if:{{{text|{{{t|{{{file|}}}}}}}}}||NULL}}  = {{{text|{{{t|{{#if: {{{file|}}} | {{{1}}}/{{{2}}} }} }}}}}}
-->{{#if: {{{file|}}} | &nbsp;{{{1}}}/{{{2}}}]}} <!--
| pre{{#if:{{{pre|}}}||NULL}}                      = {{{pre}}}
--><noinclude>
| post{{#if:{{{post|}}}||NULL}}                    = {{{post}}}
| simplepath{{#if:{{{simplepath|}}}||NULL}}        = {{{simplepath}}}
| full                                              = {{#if: {{{file|}}}
                                                        | 0
                                                        | {{#if: {{{text|{{{t|}}}}}}
                                                            | 0
                                                            | {{#if: {{{pre|}}}
                                                                | 0
                                                                | 1
                                                              }}
                                                          }}
                                                      }}
}}<noinclude>
 
{{Informative template|1=
{{Informative template|1=
__NOTOC__
__NOTOC__
== Goal ==
== Goal ==
This template will return the URL of an [[FGAddon]] aircraft if given the name of the aircraft directory in the repository, and optionally a file in that aircraft's directory.
This template is for creating links or URLs for files in the FGAddon svn version control repository.  It is a subtemplate of the master {{tl|repo link}} template designed to simplify the interface by being specific for the FGAddon repository and avoiding the need to supply the <code>Aircraft/</code> directory.
 
{{repo link/doc usage
| template  = fgaddon aircraft source
| param1    = 1 | name1 = aircraft | type1 = num  | pos1 = 1 | desc1 = The aircraft directory name.  The path is constructed as <code><nowiki><branch>/Aircraft/<aircraft></nowiki></code>.  If empty, the path of <code><branch>/Aircraft/</code> will be used.
| param2    = 1 | name2 = path    | type2 = num  | pos2 = 2 | desc2 = The file path following from the aircraft directory name.  The full file path will be constructed as <code><nowiki><branch>/Aircraft/<aircraft>/<path></nowiki></code>.
| param3    = 1 | name3 = file    | type3 = named            | desc3 = If set, then a link to the file rather than the full URL will be shown.
| cmd        = 1 | eg_cmd      = svn co
| opt        = 1
| protocol  = 1
| login      = 1
| type      = 1 | default_type = svn web
| branch    = 1 | short_branch = b
| commit    = 1 | short_commit = c {{!}} r
| line      = 1 | short_line  = l
| post      = 1
| view      = 1 | short_view  = v
| text      = 1 | short_text  = t
| pre        = 1
| simplepath = 1
| full      = 1
| intro      = The {{param|aircraft}}, {{param|path}}, and {{param|file}} parameters are unique to this template and are used to construct the parent {{tl|repo link}} template {{param|path}} and {{param|text}} parameters.  Note that the {{param|text}} parameter overrides {{param|file}}, if supplied.
| sf        = 1
| svn        = 1
}}
 
{{repo link/doc plain text}}
 
== Examples ==
=== No parameters ===
{{obr}}fgaddon aircraft source{{cbr}}
{{fgaddon aircraft source}}
 
=== Aircraft given ===
{{obr}}fgaddon aircraft source{{!}}737-200{{cbr}}
{{fgaddon aircraft source|737-200}}
 
=== Revision number given ===
{{obr}}fgaddon aircraft source{{!}}ec135{{!}}r=560{{cbr}}
{{fgaddon aircraft source|ec135|r=560}}
 
=== Branch name given ===
{{obr}}fgaddon aircraft source{{!}}B-1B{{!}}b=release-3.6.0{{cbr}}
{{fgaddon aircraft source|B-1B|b=branches/release-3.6.0}}
 
=== Path and line number given ===
{{obr}}fgaddon aircraft source{{!}}F-15{{!}}Nasal/fox2.nas{{cbr}}
{{fgaddon aircraft source|F-15|Nasal/fox2.nas}}
 
{{obr}}fgaddon aircraft source{{!}}F-15{{!}}f15c-set.xml{{!}}l=8{{cbr}}
{{fgaddon aircraft source|F-15|f15c-set.xml|l=8}}
 
=== Usage in a wiki URL ===
<nowiki>[</nowiki>{{obr}}fgaddon aircraft source{{!}}F-15{{!}}Nasal/fox2.nas{{cbr}} The F-15's missile system<nowiki>]</nowiki>
[{{fgaddon aircraft source|F-15|Nasal/fox2.nas}} The F-15's missile system]


== Usage ==
=== Pointer to a file ===
  {{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''r=''{{!}}''b=''{{!}}''l=''{{!}}''file=''<!--  {{!}}''tarball=''  -->{{cbr}}
  {{obr}}fgaddon aircraft source{{!}}F-15{{!}}Nasal/fox2.nas{{!}}file=yes{{cbr}}
{{fgaddon aircraft source|F-15|Nasal/fox2.nas|file=yes}}


All parameters are optional.
=== The repository ===
{{obr}}fgaddon aircraft source
{{!}} text = The official FGAddon aircraft repository
{{cbr}}


; aircraft:  Aircraft directory name.  If empty the URL of <code>trunk/Aircraft/</code> will be returned.
{{fgaddon aircraft source
| text = The official FGAddon aircraft repository
}}


; path: What follows after the aircraft's repository name in the URLCan be the path to a file or a directory.
=== File ===
  {{obr}}fgaddon aircraft source
{{!}} wrightFlyer1903
{{!}} wrightFlyer1903-set.xml
  {{cbr}}


; r:  Revision number to use instead of <code>HEAD</code>.
{{fgaddon aircraft source
| wrightFlyer1903
| wrightFlyer1903-set.xml
}}


; b: Branch name to use instead of <code>trunk</code>.
=== File and a branch ===
  {{obr}}fgaddon aircraft source
{{!}} wrightFlyer1903
{{!}} wrightFlyer1903-set.xml
{{!}} branch = branches/release-2016.1
{{cbr}}


; l:  Used with the '''path''' parameter to link to a given line in a file.
{{fgaddon aircraft source
: {{inote|Due to SourceForge limitations this parameter does not fork for some file types, in particular <code>.nas</code> (Nasal) files.}}
| wrightFlyer1903
| wrightFlyer1903-set.xml
| branch = branches/release-2016.1
}}


; file: If set, then a link to the file rather than the full URL will be shown.
=== File and a commit ===
{{obr}}fgaddon aircraft source
{{!}} 787-8
  {{!}} Nasal/systems.nas
{{!}} commit = 1333
{{cbr}}


<!--
{{fgaddon aircraft source
; tarball:  If not empty, the link will create and link to a <code>.tar.gz</code> (tarball) snapshot of a an aircraft directory.
| 787-8
: {{inote|See also the section "Technical details" below.}} -->
| Nasal/systems.nas
| commit = 1333
}}


== Examples ==
=== File and line number ===
=== No parameters given ===
  {{obr}}fgaddon aircraft source
  <nowiki>{{fgaddon url}}</nowiki>
{{!}} ornithopter
{{fgaddon url}}
{{!}} ornithopter-set.xml
{{!}} line = 13
{{cbr}}


=== Aircraft given ===
{{fgaddon aircraft source
<nowiki>{{fgaddon url|737-200}}</nowiki>
| ornithopter
{{fgaddon url|737-200}}
| ornithopter-set.xml
| line = 13
}}


=== Revision number given ===
=== File, line number, and commit ===
  <nowiki>{{fgaddon url|ec135|r=560}}</nowiki>
  {{obr}}fgaddon aircraft source
{{fgaddon url|ec135|r=560}}
{{!}} ornithopter
{{!}} ornithopter-set.xml
{{!}} commit = 3
{{!}} line  = 10
{{cbr}}


=== Branch name given ===
{{fgaddon aircraft source
<nowiki>{{fgaddon url|B-1B|b=release-3.6.0}}</nowiki>
| ornithopter
{{fgaddon url|B-1B|b=release-3.6.0}}
| ornithopter-set.xml
| commit = 3
| line  = 10
}}


=== Path and line number given ===
=== Custom label given ===
  <nowiki>{{fgaddon url|F-15|Nasal/fox2.nas}}</nowiki>
  {{obr}}fgaddon aircraft source
{{fgaddon url|F-15|Nasal/fox2.nas}}
{{!}} mirage2000
{{!}} mirage2000-set.xml
{{!}} text = The Mirage 2000 *-set.xml file
{{cbr}}


<nowiki>{{fgaddon url|F-15|f15c-set.xml|l=8}}</nowiki>
{{fgaddon aircraft source
{{fgaddon url|F-15|f15c-set.xml|l=8}}
| mirage2000
| mirage2000-set.xml
| text = The Mirage 2000 *-set.xml file
}}


=== Usage in a wiki URL ===
=== Prefix of $FG_AIRCRAFT ===
  <nowiki>[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]</nowiki>
  {{obr}}fgaddon aircraft source
[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]
{{!}} SpaceShuttle
{{!}} Sounds/SpaceShuttle-Sounds.xml
{{!}} pre  = $FG_AIRCRAFT
{{cbr}}


=== Pointer to a file ===
{{fgaddon aircraft source
<nowiki>{{fgaddon url|F-15|Nasal/fox2.nas|file=yes}}</nowiki>
| SpaceShuttle
{{fgaddon url|F-15|Nasal/fox2.nas|file=yes}}
| Sounds/SpaceShuttle-Sounds.xml
| pre  = $FG_AIRCRAFT
}}


<!--
=== Full path ===
== Technical details ==
{{obr}}fgaddon aircraft source
=== The tarball parameter ===
{{!}} CRJ700-family
When used with the '''tarball=''' parameter, the template will link to a SourceForge page that will create a <code>.tar.gz</code> (tarball) compressed archive snapshot of a directory. Currently the template is set up to only allow this for aircraft directories, in essence when no '''path''' or '''l''' (line) parameter is given.
{{!}} CRJ900-set.xml
{{!}} commit = 1418
{{!}} line  = 10
  {{cbr}}


{{inote|Creating the tarball can take some time.}} -->
{{fgaddon aircraft source
| CRJ700-family
| CRJ900-set.xml
| commit = 1418
| line  = 10
}}


== Related templates ==
== Related templates ==
Line 92: Line 217:
}}
}}


[[Category:Repository link templates‎]]
[[Category:Repository link templates]]
</noinclude>
</noinclude>

Navigation menu