Template:Fgaddon aircraft source: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Add path, branch, and line params, expand example, add related templates)
(+-More comments and indentation; + So far commented beginnings of adding snapshot download link. Need to figure out how to throw error without code duplication)
Line 1: Line 1:
http://sourceforge.net/p/flightgear/fgaddon/{{{r|HEAD}}}/tree/{{{b|trunk}}}/Aircraft/<!--
http://sourceforge.net/p/flightgear/fgaddon/{{{r|HEAD}}}<!--  tarball?path=/*no "/tree/"*  --><!--
-->/tree/<!--
-->{{#if: {{{b|}}} <!-- Is a branch defined? -->
  | <!-- Yes, add the branch to the URL --><!--
    -->branches/{{{b}}}
  | <!-- No, default to "trunk"  --><!--
    -->trunk
  }}/Aircraft/<!--
-->{{#if: {{{1|}}} <!-- Is an aircraft defined? -->
-->{{#if: {{{1|}}} <!-- Is an aircraft defined? -->
| <!-- Yes, go to file path --><!--
  | <!-- Yes, go to the aircraft directory --><!--
  -->{{{1}}}/<!--
    -->{{{1}}}/<!--
  -->{{#if: {{{2|}}} <!-- Is a path given? --><!--
    -->{{#if: {{{2|}}} <!-- Is a file path defined? -->
  -->| {{{2}}}{{#if: {{{l|}}} | &#35;l{{{l}}} }} <!-- Yes, add it to the URL --><!--
      | <!-- Yes, got to the file --><!--
  -->}}
        -->{{{2}}}<!--
| <!-- No, go to the default --><!--
          -->{{#if: {{{l|}}} <!-- Is a line number defined -->
-->}}<noinclude>
            | <!-- Yes, go to the line number --><!--
              -->&#35;l{{{l}}}
        }}
    }}
  | <!-- No, go to the default -->
}}<noinclude>
{{Informative template|1=
{{Informative template|1=
__NOTOC__
__NOTOC__
Line 14: Line 26:


== Usage ==
== Usage ==
  {{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''r=''{{!}}''b=''{{!}}''l=''{{cbr}}
  {{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''r=''{{!}}''b=''{{!}}''l=''{{!}}''tarball=''{{cbr}}


All parameters are optional.
All parameters are optional.
Line 22: Line 34:
; path:  What follows after the aircraft's repository name in the URL.  Can be the path to a file or a directory.
; path:  What follows after the aircraft's repository name in the URL.  Can be the path to a file or a directory.


; r:  Optional revision number to use instead of <code>HEAD</code>.
; r:  Revision number to use instead of <code>HEAD</code>.


; b:  Optional branch name to use instead of <code>trunk</code>.
; b:  Branch name to use instead of <code>trunk</code>.


; l:  Used with the '''path''' parameter to link to a given line in a file.
; l:  Used with the '''path''' parameter to link to a given line in a file.
: {{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|Due to SourceForge limitations this parameter does not fork for some file types, in particular <code>.nas</code> (Nasal) files.}}
<!--
; tarball:  If not empty, the link will create and link to a <code>.tar.gz</code> (tarball) snapshot of a an aircraft directory.
: {{inote|See also the section "Technical details" below.}} -->


== Examples ==
== Examples ==
Line 43: Line 58:


=== Branch name given ===
=== Branch name given ===
  <nowiki>{{fgaddon url|B-1B|b=branches/release-3.6.0}}</nowiki>
  <nowiki>{{fgaddon url|B-1B|b=release-3.6.0}}</nowiki>
{{fgaddon url|B-1B|b=branches/release-3.6.0}}
{{fgaddon url|B-1B|b=release-3.6.0}}


=== Path and line number given ===
=== Path and line number given ===
Line 56: Line 71:
  <nowiki>[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]</nowiki>
  <nowiki>[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]</nowiki>
[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]
[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]
<!--
== Technical details ==
=== The tarball parameter ===
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.
{{inote|Creating the tarball can take some time.}}  -->


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

Revision as of 14:13, 4 October 2015

http://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/Aircraft/

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

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.

Usage

{{fgaddon url|aircraft|path|r=|b=|l=|tarball=}}

All parameters are optional.

aircraft
Aircraft directory name. If empty the URL of trunk/Aircraft/ will be returned.
path
What follows after the aircraft's repository name in the URL. Can be the path to a file or a directory.
r
Revision number to use instead of HEAD.
b
Branch name to use instead of trunk.
l
Used with the path parameter to link to a given line in a file.
Note Due to SourceForge limitations this parameter does not fork for some file types, in particular .nas (Nasal) files.

Examples

No parameters given

{{fgaddon url}}

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk

Aircraft given

{{fgaddon url|737-200}}

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/737-200

Revision number given

{{fgaddon url|ec135|r=560}}

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/ec135

Branch name given

{{fgaddon url|B-1B|b=release-3.6.0}}

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/release-3.6.0/B-1B

Path and line number given

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

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/F-15

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

https://sourceforge.net/p/flightgear/fgaddon/HEAD/tree/trunk/F-15#l8

Usage in a wiki URL

[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]

The F-15's missile system

Related templates