Template:Fgaddon aircraft source: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
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.)
m (Switch from the temporary {{project infrastructure/code}} template to {{project infrastructure}} template with the mode set to 'abbrev'.)
 
(6 intermediate revisions by the same user not shown)
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}}}}}}||NULL}}              = {{{text|
-->{{#if: {{{file|}}} | &nbsp;{{{1}}}/{{{2}}}]}} <!--
                                                        {{{t|
--><noinclude>
                                                          {{#ifeq: {{{full|}}} | 1
                                                            |
                                                            | {{#if: {{{1|}}}
                                                                |{{strip whitespace|{{{1}}}}}<!--
                                                            -->{{#if: {{{2|}}} |/{{strip whitespace|{{{2}}}}}}}
                                                                | FGAddon aircraft
                                                              }}
                                                          }}
                                                        }}}
                                                      }}}
| pre{{#if:{{{pre|}}}||NULL}}                      = {{{pre}}}
| post{{#if:{{{post|}}}||NULL}}                    = {{{post}}}
| simplepath{{#if:{{{simplepath|}}}||NULL}}        = {{{simplepath}}}
| full{{#if:{{{full|}}}||NULL}}                     = {{{full}}}
}}<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 Mediawiki 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>.
| 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{{!}}c=560{{cbr}}
{{fgaddon aircraft source|ec135|c=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}}
 
=== Custom text ===
{{obr}}fgaddon aircraft source{{!}}F-15{{!}}Nasal/fox2.nas{{!}}text=The F-15's missile system{{cbr}}
{{fgaddon aircraft source|F-15|Nasal/fox2.nas|text=The F-15's missile system}}


== Usage ==
=== URL ===
{{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''r=''{{!}}''b=''{{!}}''l=''{{!}}''file=''<!--  {{!}}''tarball=''  -->{{cbr}}
{{note|Preferably, the {{tl|fgaddon aircraft url}} template should be used instead.}}
{{obr}}fgaddon aircraft source{{!}}F-15{{!}}Nasal/fox2.nas{{!}}full=1{{cbr}}
{{fgaddon aircraft source|F-15|Nasal/fox2.nas|full=1}}


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 219:
}}
}}


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

Latest revision as of 16:21, 20 June 2019

FGAddon aircraft


The following template description is not displayed when the template is inserted in an article.

Goal

This template is for creating Mediawiki links or URLs for files in the FGAddon svn version control repository. It is a subtemplate of the master {{repo link}} template designed to simplify the interface by being specific for the FGAddon repository and avoiding the need to supply the Aircraft/ directory.

Usage

{{fgaddon aircraft source
| aircraft
| path
| cmd        =
| opt        =
| protocol   =
| login      =
| type       =
| branch     =
| commit     =
| line       =
| post       =

| view       =
| text       =
| pre        =
| simplepath =
| full       =
}}

The aircraft, path, and file parameters are unique to this template and are used to construct the parent {{repo link}} template path and text parameters. Note that the text parameter overrides file, if supplied.

Parameter Description Abbreviated
parameter
Numbered
parameter
Status
aircraft The aircraft directory name. The path is constructed as <branch>/Aircraft/<aircraft>. If empty, the path of <branch>/Aircraft/ will be used. 1 optional
path The file path following from the aircraft directory name. The full file path will be constructed as <branch>/Aircraft/<aircraft>/<path>. 2 optional
cmd An optional command line tool name + options to prepend to the URL. For example svn co. optional
opt Any additional options to show after cmd, but before the URL.
Note The separation of cmd and opt is for future non-CLI handling of a standardised set of cmd parameter values
optional
protocol The URL protocol, for example https, http, ssh, svn. This defaults to https. optional
login The optional user login. optional
type Choose between the web interface or a direct repository link. This can be one of svn, svn web. The default is svn web. optional
branch The branch name. As tags are simply branches in SVN repositories, this parameter can also be used for svn tags. This defaults to trunk. b optional
commit The commit identifier (svn revision number). This defaults to HEAD. c | r optional
line The line number(s) of the file to display.
  • For SourceForge: Use a single line number.
l optional
post Text to append. This is forms a set with the parameter cmd and opt. For example it can represent any command line options that come after the URL. optional
view View to display:
  • For SourceForge use one of tree, log, commit, or rss. If a commit is specified (the commit parameter is set and path is not), the default is commit. Otherwise the default is tree.
v optional
text Text to display as the link label. Overrides pre. t optional
pre Prefix to a link label. optional
simplepath If set, this strips off the repository name from the URL label, leaving just the contents of the path parameter.
Note The text parameter will override this.
optional
full If set to 1, the full URL will be shown rather than any text label. optional

Plain text

To create a URL or link as plain text and avoid external links, simply use the {{#tag:tagname|content}} magic word construct:

{{#tag:nowiki|
  {{repo link
  | full = 1
  }}
}}

https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/

To use the <code> tags:

{{#tag:code|{{#tag:nowiki|
  {{repo link
  | full = 1
  }}
}}}}

https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/

Examples

No parameters

{{fgaddon aircraft source}}

FGAddon aircraft

Aircraft given

{{fgaddon aircraft source|737-200}}

737-200

Revision number given

{{fgaddon aircraft source|ec135|c=560}}

ec135

Branch name given

{{fgaddon aircraft source|B-1B|b=release-3.6.0}}

B-1B

Path and line number given

{{fgaddon aircraft source|F-15|Nasal/fox2.nas}}

F-15/Nasal/fox2.nas

{{fgaddon aircraft source|F-15|f15c-set.xml|l=8}}

F-15/f15c-set.xml

Custom text

{{fgaddon aircraft source|F-15|Nasal/fox2.nas|text=The F-15's missile system}}

The F-15's missile system

URL

Note  Preferably, the {{fgaddon aircraft url}} template should be used instead.
{{fgaddon aircraft source|F-15|Nasal/fox2.nas|full=1}}

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Aircraft/F-15/Nasal/fox2.nas

The repository

{{fgaddon aircraft source
| text = The official FGAddon aircraft repository
}}

The official FGAddon aircraft repository

File

{{fgaddon aircraft source
| wrightFlyer1903
| wrightFlyer1903-set.xml
}}

wrightFlyer1903/wrightFlyer1903-set.xml

File and a branch

{{fgaddon aircraft source
| wrightFlyer1903
| wrightFlyer1903-set.xml
| branch = branches/release-2016.1
}}

wrightFlyer1903/wrightFlyer1903-set.xml

File and a commit

{{fgaddon aircraft source
| 787-8
| Nasal/systems.nas
| commit = 1333
}}

787-8/Nasal/systems.nas

File and line number

{{fgaddon aircraft source
| ornithopter
| ornithopter-set.xml
| line = 13
}}

ornithopter/ornithopter-set.xml

File, line number, and commit

{{fgaddon aircraft source
| ornithopter
| ornithopter-set.xml
| commit = 3
| line   = 10
}}

ornithopter/ornithopter-set.xml

Custom label given

{{fgaddon aircraft source
| mirage2000
| mirage2000-set.xml
| text = The Mirage 2000 *-set.xml file
}}

The Mirage 2000 *-set.xml file

Prefix of $FG_AIRCRAFT

{{fgaddon aircraft source
| SpaceShuttle
| Sounds/SpaceShuttle-Sounds.xml
| pre  = $FG_AIRCRAFT
}}

SpaceShuttle/Sounds/SpaceShuttle-Sounds.xml

Full path

{{fgaddon aircraft source
| CRJ700-family
| CRJ900-set.xml
| commit = 1418
| line   = 10
}}

CRJ700-family/CRJ900-set.xml

Related templates